Solver Find the Mean Absolute Deviation
Algebra
->
Statistics
->
Describing-distributions-with-numbers
-> Solver Find the Mean Absolute Deviation
Log On
Describing Distributions with Numbers. Mean, median, standard deviation, IQR
Describing
Solvers
Solvers
Lessons
Lessons
Answers archive
Answers
Source code of 'Find the Mean Absolute Deviation'
This Solver (Find the Mean Absolute Deviation)
was created by by
Shin123(626)
:
View Source
,
Show
,
Put on YOUR site
About Shin123
:
Just a kid who solves math problems for fun :)
==section input Find the MAD (mean absolute deviation) of the the following numbers, <br>*[input 100 nums=10,29,38,109,29,409,102,1839,210,849,390,12] comma separated. ==section solution perl my @numbers=split(/,/,$nums); my $n=@numbers; my $mean=0; for($i=0; $i<$n; $i++) { $mean=$mean+@numbers[$i]; } print "So first, we need the find the mean of the numbers, which is the sum of all the numbers divided by the number of numbers.<br>"; print "".join("+",@numbers)."=$mean. $mean/$n="; $mean=$mean/$n; print "$mean."; my @diff=(); print "<br>Then, you take all the values and find the absolute value of the values difference from the mean.<br>"; for($i=0; $i<$n; $i++) { push(@diff,abs(@numbers[$i]-$mean)); } for($i=0; $i<$n; $i++) { print "|".(@numbers[$i])."-$mean|=".(@diff[$i])."<br>"; } print "Lastly, you take the mean of <b>these</b> values.<br>"; my $mean2=0; print "".join("+",@diff)."="; for($i=0; $i<$n; $i++) { $mean2=$mean2+@diff[$i]; } print "$mean2. $mean2/$n="; $mean2=$mean2/$n; print "{{{highlight(highlight_green(highlight($mean2)))}}}"; print "<br>So the MAD is $mean2."; my $MAD=$mean2; ==section output ==section check