1 | initial version |

Use variables to solve the equation symbolically:

var('a','b','c','t')

S = solve([a*t^2 + b*t + c], t)

print S

[t == -1/2*(b + sqrt(-4*a*c + b^2))/a,t == -1/2*(b - sqrt(-4*a*c + b^2))/a]

Then define g:

g(a,b,c,t)=S[0].rhs()

show(g)

$\newcommand{\Bold}[1]{\mathbf{#1}}\left( a, b, c, t \right) \ {\mapsto} \ -\frac{b + \sqrt{-4 \ a c + b^{2}}}{2 \ a}$

That is how I would write it by hand.

Proof of concept:

g(-16,48,5)

1/4*sqrt(41) + 3/2

I hope it helps.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.