Quadratic Functions

229 days ago by mpaul

a,b,c = var('a b c') 
       
a,b,c = -50.0,-60.0,100.0 
       
f(x) = a*x^2 + b*x + c show(f) 
       

Axis of Symmetry

h = -b/(2*a) show(h) 
       

Maximum or Minimum

k = f(h) show(k) 
       

Vertex

show((h,k)) 
       

Distance to Roots from Axis

discriminant = b^2 - 4*a*c d = abs(sqrt(discriminant)/(2*a)) show(d) 
       

Roots

if discriminant < 0: show([h+d*i,h-d*i]) else: show([h + d, h - d]) 
       

Sage on its own

show(solve(f(x) == 0, x)) 
       

Graphics

plot(f, h-2*abs(d), h+2*abs(d), color = 'blue')+points([(h,k),(h+d,0),(h-d,0)],color='red')+line([(h,0),(h,2*k)],linestyle = '--',color='black')+line([(h-d,k),(h+d,k)],linestyle = '--',color='black') 
       
 
       

Problem 10 - Seagull & Crab

h(t) = -16*t^2+30 g(t) = -8*t+15 
       
plot(h,0,2)+plot(g,0,2) 
       
solve(h(t)==g(t),t) 
       
h(5/4) 
       
g(5/4)