preTEST1A

3113 days ago by MATH4R2012

#1) A=point((0,0)) B=point((4,0)) C=point((3,3)) D=point((1,3)) l1=line([(0,0),(4,0)]) l2=line([(4,0),(3,3)]) l3=line([(3,3),(1,3)]) l4=line([(1,3),(0,0)]) A+B+C+D+l1+l2+l3+l4 
       
#1A+1B practice) AC=sqrt(((4-1)-0)^2+(3-0)^2) BD=sqrt((1-4)^2+(3-0)^2) show(AC) show(BD) 
       

#1C+1D practice) AD=sqrt((1-0)^2+(3-0)^2) BC=sqrt(((4-1)-4)^2+(3-0)^2) show(AD) show(BC) 
       

#1A+1B) var('a,b,h') AC=sqrt(((b-a)-0)^2+(h-0)^2) BD=sqrt((a-b)^2+(h-0)^2) show(AC) show(BD) 
       

#1C+1D) AD=sqrt((a-0)^2+(h-0)^2) BC=sqrt(((b-a)-b)^2+(h-0)^2) show(AD) show(BC) 
       

#2A) equ=sqrt(15-2*x)==x;show(equ) equ=equ^2;show(equ) equ=equ+2*x-15;show(equ) show(equ.factor()) show(solve(equ,x)) 
       




#2B) plot([sqrt(15-2*x),x],-8,8) 
       
#3A) v(t)=-175*t+875 #3B) v(2) 
       
#3C) var('t') show(solve(v(t)==200,t)) show(27/7.n(digits=100)) 
       

plot([-175*x+875,200],0,4) 
       
#4g linear) var('a,b') l = [[0,58],[1,60],[2,59],[3,61],[4,63],[5,66],[6,65],[7,67],[8,70]] f(x) = a*x + b q = find_fit(l,f,solution_dict=True) show(q[a]) show(q[b]) points(l,color='purple') + plot(f(a=q[a],b=q[b]),(x,0,8,),color='red') 
       


x=range(9);show(x) y=[58,60,59,61,63,66,65,67,70];show(y) xy=[x[i]*y[i] for i in range(9)];show(xy) xSqr=[x[i]^2 for i in range(9)];show(xSqr) #4a) sumX=sum(x);show(sumX) #4b) sumY=sum(y);show(sumY) #4c) sumXY=sum(xy);show(sumXY) #4d) sumXsqr=sum(xSqr);show(sumXsqr) #4e) m=(9*sumXY-sumX*sumY)/(9*sumXsqr-sumX^2);show(m.n()) #4f) b=(sumY-m*sumX)/9;show(b.n()) 
       









#4a-4f) print "x\ty\txy\tx^2" for i in range(9): print x[i],"\t",y[i],"\t",xy[i],"\t",xSqr[i] print "sumX = ", sumX print "sumY = ", sumY print "sumXY = ", sumXY print "sumXsqr = ", sumXsqr print "m = ", m print "b = ", b print "m = ", m.n() print "b = ", b.n() 
       
x	y	xy	x^2
0 	58 	0 	0
1 	60 	60 	1
2 	59 	118 	4
3 	61 	183 	9
4 	63 	252 	16
5 	66 	330 	25
6 	65 	390 	36
7 	67 	469 	49
8 	70 	560 	64
sumX =  36
sumY =  569
sumXY =  2362
sumXsqr =  204
m =  43/30
b =  2587/45
m =  1.43333333333333
b =  57.4888888888889
x	y	xy	x^2
0 	58 	0 	0
1 	60 	60 	1
2 	59 	118 	4
3 	61 	183 	9
4 	63 	252 	16
5 	66 	330 	25
6 	65 	390 	36
7 	67 	469 	49
8 	70 	560 	64
sumX =  36
sumY =  569
sumXY =  2362
sumXsqr =  204
m =  43/30
b =  2587/45
m =  1.43333333333333
b =  57.4888888888889
#correlation coefficient? #r=(n*sumXY-sumX*sumY)/sqrt(n*sumXX-sumX^2)/sqrt(n*sumYY-sumY^2) ySqr=[y[i]^2 for i in range(9)];show(ySqr) sumYsqr=sum(ySqr);show(sumYsqr) show(((9*sumXY-sumX*sumY)/sqrt(9*sumXsqr-sumX^2)/sqrt(9*sumYsqr-sumY^2)).n()) 
       


#4g quad) var('a,b,c') l = [[0,58],[1,60],[2,59],[3,61],[4,63],[5,66],[6,65],[7,67],[8,70]] f(x) = a*x^2+b*x+c q = find_fit(l,f,solution_dict=True) show(q[a]) show(q[b]) show(q[c]) points(l,color='purple') + plot(f(a=q[a],b=q[b],c=q[c]),(x,0,8,),color='red') 
       



#4h) var('t') y(t)=1.433333*t+57.488888;show(y) y(10)