Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
0

converting symbolic solve output to numbers [was "numerical value"]

asked 13 years ago

Sagud gravatar image

updated 13 years ago

Kelvin Li gravatar image

Let's say:

z=[x=1/3sqrt(3),x=1/3sqrt(3)]

How can I make numerical value of that?

numerical_approx(z)
N(z)
n(z)
z.n()
RR(z)

DON'T WORK!

Preview: (hide)

Comments

Thanks for your questions. It might be helpful to not use all capital letters for your titles, however; 'netiquette' usually reserves all-caps for extreme emphasis.

kcrisman gravatar imagekcrisman ( 13 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 13 years ago

Shashank gravatar image
z = solve(gen_legendre_P(2, 0, x) == 0, x)
for i in range(len(z)):
    print z[i].rhs().n()
Preview: (hide)
link

Comments

You could also use "for eq in z: print eq.rhs().n()" if you're not going to need the index for anything. And if you do need the index, I find it somewhat more Pythonic to use "for i, eq in enumerate(z):".

DSM gravatar imageDSM ( 13 years ago )

but it's problem when we choose 9 or even worst when we choose 10. Look

Sagud gravatar imageSagud ( 13 years ago )

y = solve(gen_legendre_P(10, 0, x) == 0, x); print "Nultocke: [", for i in range(len(y)): print y[i].rhs().n(digits=2);

Sagud gravatar imageSagud ( 13 years ago )

when we use 10 ERROR : Traceback (click to the left of this block for traceback) ... TypeError: cannot evaluate symbolic expression numerically

Sagud gravatar imageSagud ( 13 years ago )

and when we use 9 we get numbers like: -0.96 - 7.5e-6*I lol.. How can I repair that?

Sagud gravatar imageSagud ( 13 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 13 years ago

Seen: 12,748 times

Last updated: Apr 06 '11