Ask Your Question
1

converting to sympy

asked 2012-04-02 07:22:57 -0500

anonymous user

Anonymous

updated 2012-04-02 08:38:11 -0500

Shashank gravatar image

Dear All

I would like to convert a sage equation to sympy, eg

x=var('x')
y=2*x+Ei(x)
y._sympy_()

... and get complains that Ei is not defined in sympy.

How can I define a (possibly fake) Ei function in sympy from sage? Or is there any other way to avoid the problem?

Thanks

Valery

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
0

answered 2014-07-25 00:34:43 -0500

updated 2014-07-25 03:54:05 -0500

You can also use sympify:

sage: x = var('x')
sage: y = 2 * x + Ei(x)
sage: import sympy
sage: sympy.sympify(y)
2*x + Ei(x)
sage: type(_)
<class 'sympy.core.add.Add'>
edit flag offensive delete link more
0

answered 2014-07-24 14:05:02 -0500

FrédéricC gravatar image

This works now (in sage 6.3.beta6).

sage: x = var('x')
sage: y = 2 * x + Ei(x)
sage: y._sympy_()
2*x + Ei(x)
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

Stats

Asked: 2012-04-02 07:22:57 -0500

Seen: 124 times

Last updated: Jul 25 '14