Ask Your Question
2

subs_expr with e^t

asked 2012-01-02 00:13:51 +0100

Mike Witt gravatar image

updated 2015-01-14 14:15:36 +0100

FrédéricC gravatar image

Is there a reason why subs_expr() won't work here?

sage: version()
'Sage Version 4.7.2, Release Date: 2011-10-29'
sage: t = var('t')
sage: foo = e^t
sage: foo.subs_expr(e==e.n())
e^t
sage:
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
5

answered 2012-01-02 08:55:29 +0100

Use a wild card (a variable that matches everything) to do complicated subs_expr. I would suggest this technique to be written in sage tutorials. It is very useful to me.

sage: t = var('t')
sage: foo = e^t
sage: w0 = SR.wild(0)
sage: foo.subs_expr(e^w0==e.n()^w0)
2.71828182845905^t
edit flag offensive delete link more

Comments

1

You are right about this. There are a few places it shows up if you search for things but it's not there. Why not open a ticket and post a patch to the doc for this? Thanks!

kcrisman gravatar imagekcrisman ( 2012-01-02 11:26:53 +0100 )edit

Great. This worked for me, in the much more complicated expression I was actually using (which incidentally would not plot without doing this conversion first). Thanks!

Mike Witt gravatar imageMike Witt ( 2012-01-02 11:58:47 +0100 )edit
1

@kcrisman : Thanks for the suggestion. I will try to make a patch to the doc.

tririver gravatar imagetririver ( 2012-01-02 13:15:59 +0100 )edit

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-01-02 00:13:51 +0100

Seen: 933 times

Last updated: Jan 02 '12