Question

6. >>x=[1 2 4 6 12]; >m mean(x) > var(x)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Python Program using numpy:-

---------------------------------------------------------------

import numpy
x=[1,2,4,6,12]
m=numpy.mean(x)
v=numpy.var(x)
print "Mean of the list is ",m
print "Variance of the list is ",v

--------------------------------------------------------------------

Program Output:-

Execute Embed main.py STDIN 1 import numpy 2 x=[1,2,4,6,12] 3 m-numpy.mean(x) I.lı Result $python main.py Mean of the list is

----------------------------------------------------------

Finally mean is-------5

Variance is---------15.2

--------------------------------------------------

Explanation:-

------------------------------------------

1.we import numpy to calculate Mean and Variance in python

2.Mean is simply "Average of all numbers"--------------------(1+2+4+6+12)/5=5

3.Formula for variance is below

に!

Steps:-

X1=1,

X2=2,

X3=4,

X4=6,

X5=12

------------------------

Mean(u)=5

-----------------

Number of items in the list(n)=5

----------------

Square of (1-5)=16

Square of (2-5)=9

Square of (4-5)=1

Square of (6-5)=1

Square of (12-5)=49

--------------------------------------------

Add all the elements=16+9+1+1+49=76

So finally variance=76/5=15.2

------------------------------------------------------------------------------

If you have any doubts regarding anything please comment defintly i will respond.Please please rate if you are satisfied.Thank you.

Add a comment
Know the answer?
Add Answer to:
6. >>x=[1 2 4 6 12]; >m mean(x) > var(x)
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT