Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 2012-09-02 08:55:57 -0500

DSM gravatar image

solve is returning a list (technically a Sequence). sols[0] is a long expression which will look something like

 t == -1/153680390222338173222270*sqrt((42892173.. etc

You can't turn a relation like this into a number, which is why Sage is complaining. You could extract the rhs:

sage: sols[0].rhs().n()
0.901734601169342 - 1.74583945992054e-17*I

Use solution_dict=True instead (my favourite), i.e.

sols=solve([f(k*t+1-t,l*t,m*t,n*t+1-t)==0], t, solution_dict=True);

and then use [different random numbers here]:

sage: sols[0][t].n() 
4.70733338158850 - 5.70444926240249e-18*I

solve is returning a list (technically a Sequence). sols[0] is a long expression which will look something like

 t == -1/153680390222338173222270*sqrt((42892173.. etc

You can't turn a relation like this into a number, which is why Sage is complaining. You could extract the rhs:

sage: sols[0].rhs().n()
0.901734601169342 - 1.74583945992054e-17*I

Use Or use solution_dict=True instead (my favourite), i.e.

sols=solve([f(k*t+1-t,l*t,m*t,n*t+1-t)==0], t, solution_dict=True);

and then use [different random numbers here]:

sage: sols[0][t].n() 
4.70733338158850 - 5.70444926240249e-18*I