Ask Your Question
0

Numerical form of the symbolic expression

asked 2020-11-09 20:53:31 +0200

huhahu gravatar image

updated 2020-11-10 07:58:49 +0200

Emmanuel Charpentier gravatar image

I have a symbolic expression ( a variable polynomial of n degree)

1/9*sqrt(3)*(2*sqrt(3)*x^2*e^(1/2*sqrt(3)) + 3*x*e^(1/2*sqrt(3)))

If possible, I would like these in numeric form as

1.37262 x+1.58496 x^2

Is there a function which does it?

edit retag flag offensive close merge delete

Comments

Please format your math expressions as such...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2020-11-10 07:59:32 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-11-10 08:05:22 +0200

Emmanuel Charpentier gravatar image

updated 2020-11-10 08:07:24 +0200

This one-liner :

sage: sum([u[0].n()*x^u[1]
                 for u in (1/9*sqrt(3)*(2*sqrt(3)*x^2*e^(1/2*sqrt(3)) + 3*x*e^(1/2*sqrt(3)))).coefficients()])
1.58496178349078*x^2 + 1.37261716853050*x

does the trick. Is it useful ?

HTH,

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-11-09 20:53:31 +0200

Seen: 67 times

Last updated: Nov 10 '20