Answer the question
In order to leave comments, you need to log in
How to calculate the coefficient of difference between numbers in a series?
There are two examples of a series of natural numbers:
1) 4 5 5 5 4 5 4 5 5 5
2) 3 10 25 4 15 40 32 9 14 19
Both there and there 10 numbers each.
In the first case, the maximum spread between the numbers is obviously small. All numbers in the series are practically equal to each other, that is, if each number is compared with each other, then the average difference between the numbers will not be more than one. You can also represent these numbers as a line on the chart - there will be an almost perfect straight line.
In the second case, the spread is obviously larger and I do not know how to calculate this average number by which each number in the series differs from the other. A very broken graph immediately appears, and in general, all this is visual if you imagine it in your head, but you need to somehow express it mathematically. Are there any options / formulas to get this coefficient, except for literally comparing each number with each other and then calculating the arithmetic mean?
Thanks :)
Answer the question
In order to leave comments, you need to log in
Although everything is fine on the codepen
display:none
function subcatHeight() {
var $subcategories = $('.subcategories-block'),
$subMenu = $('.goods-menu__subcategories').css({ visibility: 'hidden', display: 'block' });
$subcategories.each(function() {
var $parent = $(this),
item = $parent.find('.subcategories-block__item'),
itemsLength = item.length,
itemsHeight = 0,
itemLonger = 0;
item.each(function() {
itemsHeight += $(this).innerHeight();
if( $(this).innerHeight() > itemLonger )
{
itemLonger = $(this).innerHeight();
}
});
$parent.css({
"max-height" : itemsHeight/4 + itemLonger*0.7
});
});
$subMenu.css({ visibility: '', display: '' });
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question