Ask Your Question
1

converting to sympy

asked 13 years ago

anonymous user

Anonymous

updated 13 years ago

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

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
0

answered 10 years ago

rws gravatar image

updated 10 years ago

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'>
Preview: (hide)
link
0

answered 10 years ago

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)
Preview: (hide)
link

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: 553 times

Last updated: Jul 25 '14