Project #2 Draft

462 days ago by ashmarie1016@aol.com

#Project 2: Ashley Vega, Rebecca, Robert 
       
#Problem 2 #Part a # size s: weight w: #giraffes: 18 ft 3,000 lbs #antelope: 11 ft 2,000 lbs #armadillo: 3.25 ft 132 lbs #giant panda: 5 ft 330 lbs #polar bear: 10 ft 1,760 lbs #camel: 11.3 ft 1,520 lbs #cheetah: 4.7 ft 143 lbs #snow leopard: 6.92 ft 121 lbs #dolphin: 3.5 ft 88 lbs #killer whale: 23 ft 8,960 lbs #fox: 2.17 ft 12 lbs #gorilla: 6 ft 450 lbs #hedgehog: 1 ft 3.5 lbs #hippo: 16.5 ft 9,900 lbs #hyena: 4.92 ft 176 lbs #kangaroo: 6 ft 200 lbs #koala: 3 ft 19 lbs #meerkat: 1 ft 2 lbs #naked mole-rats: 0.58 ft 0.1125 lbs #okapi: 5 ft 660 lbs #sea otter: 4 ft 70 lbs #wild boar: 6.6 ft 710 lbs #porcupine: 3 ft 73 lbs #red panda: 3.33 ft 14 lbs #reindeer: 6 feet 665 lbs #seal lions: 7 ft 2,000 lbs #wombats: 2.5 ft 88 lbs #zebras: 7.17 ft 900 lbs 
       
#Part a, b # size s is shown in a vector (all the sizes of the mammals in feet) s= vector (RDF, 28); s[0]=18; s[1]=11; s[2]=3.25; s[3]=5; s[4]=10; s[5]=11.3; s[6]=4.7; s[7]=6.92; s[8]=3.5; s[9]=23; s[10]=2.17; s[11]=6; s[12]=1; s[13]=16.5; s[14]=4.92; s[15]=6; s[16]=3; s[17]=1; s[18]=0.58; s[19]=5; s[20]=4; s[21]=6.6; s[22]=3; s[23]=3.33; s[24]=6; s[25]=7; s[26]=2.5; s[27]=7.17; # weight w is shown in a vector (all the weights of the mammals in pounds) w= vector (RDF, 28); w[0]=3,000; w[1]=2,000; w[2]=132; w[3]=330; w[4]=1,760; w[5]=1,520; w[6]=143; w[7]=121; w[8]=88; w[9]=8,960; w[10]=12; w[11]=450; w[12]=3.5; w[13]=9,900; w[14]=176; w[15]=200; w[16]=19; w[17]=2; w[18]=0.1125; w[19]=660; w[20]=70; w[21]=710; w[22]=73; w[23]=14; w[24]=665; w[25]=2,000; w[26]=88; w[27]=900; print ' s w' for i in range (28): print "%2s "%(s[i]),; print "%16s "%(w[i]) Q= [[s[i],w[i]] for i in range (28)] Q; pplot= scatter_plot(Q); pplot.show() #regression line: y= 330.517*x+(-5,226,769/5,564) testline= plot(330.517*x+(-5,226,769/5,564), (x,0,100),rgbcolor=hue(0.9)) show(pplot+testline) 
       
Traceback (click to the left of this block for traceback)
...
TypeError: float() argument must be a string or a number
Traceback (most recent call last):    s[2]=3.25;
  File "", line 1, in <module>
    
  File "/tmp/tmpiWghib/___code___.py", line 37, in <module>
    w[_sage_const_0 ]=_sage_const_3 ,_sage_const_000 ;
  File "vector_double_dense.pyx", line 234, in sage.modules.vector_double_dense.Vector_double_dense.__setitem__ (sage/modules/vector_double_dense.c:4178)
  File "vector_double_dense.pyx", line 283, in sage.modules.vector_double_dense.Vector_double_dense.set_unsafe (sage/modules/vector_double_dense.c:4326)
TypeError: float() argument must be a string or a number
#Part c # size is shown in a vector (all the sizes of the mammals in feet) s= vector (RDF, 28); s[0]=18; s[1]=11; s[2]=3.25; s[3]=5; s[4]=10; s[5]=11.3; s[6]=4.7; s[7]=6.92; s[8]=3.5; s[9]=23; s[10]=2.17; s[11]=6; s[12]=1; s[13]=16.5; s[14]=4.92; s[15]=6; s[16]=3; s[17]=1; s[18]=0.58; s[19]=5; s[20]=4; s[21]=6.6; s[22]=3; s[23]=3.33; s[24]=6; s[25]=7; s[26]=2.5; s[27]=7.17; # weight w is shown in a vector (all the weights of the mammals in pounds) w= vector (RDF, 28); w[0]=3,000; w[1]=2,000; w[2]=132; w[3]=330; w[4]=1,760; w[5]=1,520; w[6]=143; w[7]=121; w[8]=88; w[9]=8,960; w[10]=12; w[11]=450; w[12]=3.5; w[13]=9,900; w[14]=176; w[15]=200; w[16]=19; w[17]=2; w[18]=0.1125; w[19]=660; w[20]=70; w[21]=710; w[22]=73; w[23]=14; w[24]=665; w[25]=2,000; w[26]=88; w[27]=900; S= ln(s[i]) W=ln(w[i]) Q= [[S[i],W[i]] for i in range (28)] Q; pplot= scatter_plot(Q); pplot.show() # least squares line to (S,W) is y=2.902*x+0.642 testline= plot(2.902*x+0.642, (x,0,30),rgbcolor=hue(0.8)) show(pplot+testline) 
       
Traceback (click to the left of this block for traceback)
...
TypeError: float() argument must be a string or a number
Traceback (most recent call last):    s[2]=3.25;
  File "", line 1, in <module>
    
  File "/tmp/tmpkYhI6I/___code___.py", line 37, in <module>
    w[_sage_const_0 ]=_sage_const_3 ,_sage_const_000 ;
  File "vector_double_dense.pyx", line 234, in sage.modules.vector_double_dense.Vector_double_dense.__setitem__ (sage/modules/vector_double_dense.c:4178)
  File "vector_double_dense.pyx", line 283, in sage.modules.vector_double_dense.Vector_double_dense.set_unsafe (sage/modules/vector_double_dense.c:4326)
TypeError: float() argument must be a string or a number
# Part d #We should expect this intercept because we are using the same set of data to reduce non-linear relationships to linear ones. #The new equation that relates to the raw weight w and size s is: 33,996.6= 2.902*182.44 
       
# Part e #approximation of for slope m to a simple rational number is: 2.9= 29/10 #A biological/ physical argument that predicts the rounded (s,w) relationship is that as animals' size gets bigger their weight will also get bigger. Smaller sized animals have a smaller weight than bigger sized animals.