1 | initial version |
There is no direct equivalent in Sage to this, but I'll try to give a few ideas for how to do what you want.
Most directly, this will help:
sage: solve(legendre_P(9,x),x)[0].rhs().n()
-0.968160239507626 + 2.33721339925049e-18*I
2 | No.2 Revision |
There is no direct equivalent in Sage to this, but I'll try to give a few ideas for how to do what you want.
Most directly, this will help:
sage: solve(legendre_P(9,x),x)[0].rhs().n()
-0.968160239507626 + 2.33721339925049e-18*I
sage: solve(legendre_P(9,x),x)[0].rhs().n(prec=100)
-0.96816023950762608983557620291 + 2.7752069983964298759432951970e-32*I
Assuming that's right. solve
only gives symbolic solutions in this case, so we get at the numerical approximation this way; for high-accuracy numerical solutions immediately, use find_root
.
sage: find_root(legendre_P(9,x),-1,-.9)
-0.96816023950880892
Unfortunately, I have to do legendre_P(9,x)
and not
sage: j = var('j')
sage: F = legendre_P(j,x)
because we do not have it wrapped in a way that allows that, though presumably we could do so. Our special and other functions can use upgrading from that standpoint. In Maxima one might be able to do that directly, though.
3 | No.3 Revision |
There is no direct equivalent in Sage to this, but I'll try to give a few ideas for how to do what you want.
Most directly, this will help:
sage: solve(legendre_P(9,x),x)[0].rhs().n()
-0.968160239507626 + 2.33721339925049e-18*I
sage: solve(legendre_P(9,x),x)[0].rhs().n(prec=100)
-0.96816023950762608983557620291 + 2.7752069983964298759432951970e-32*I
Assuming that's right. solve
only gives symbolic solutions in this case, so we get at the numerical approximation this way; for high-accuracy numerical solutions immediately, use find_root
.
sage: find_root(legendre_P(9,x),-1,-.9)
-0.96816023950880892
Unfortunately, I have to do legendre_P(9,x)
and not
sage: j = var('j')
sage: F = legendre_P(j,x)
because we do not have it wrapped in a way that allows that, though presumably we could do so. Our special and other functions can use upgrading from that standpoint. In Maxima one might be able to do that directly, though.
Finally, if your last question is asking how to numerically approximate integrals, there are lots of good ways to do this. If you have a symbolic integral with endpoints, using .n()
should work to approximate it; a function worth checking out is numerical_integral
.