Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to get access of a single solution from a bunch of solutions

I do not use the thing for longer time, so I had a question.

If I say

a,b,c,d,e,x = var('a b c d e x')
f(x)=a*x^4+b*x^3+c*x^2+d*x+e
f1(x)=diff(f(x),x)
f2(x)=diff(f(x),x,2)
sols = solve([f(0)==-2, f(2)==0,  f1(4)==0, f(4)==8,  f2(2)==0], a,b,c,d,e)
print(sols)

I get

 [
[a == (3/16), b == (-41/16), c == (87/8), d == -12, e == -2]
]

How can I have these single value separately?
That means: I want to get an output f(x) = 3/16*x^4 -41/16*x^3 +87/8*x^2 -12*x -2
(which I can copy and paste).