Ask Your Question
1

converting to sympy

asked 2012-04-02 14:22:57 +0200

anonymous user

Anonymous

updated 2012-04-02 15:38:11 +0200

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 07:34:43 +0200

rws gravatar image

updated 2014-07-25 10:54:05 +0200

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 21:05:02 +0200

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 14:22:57 +0200

Seen: 236 times

Last updated: Jul 25 '14