ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 02 Jan 2012 06:15:59 -0600subs_expr with e^thttps://ask.sagemath.org/question/8603/subs_expr-with-et/Is there a reason why subs_expr() won't work here?
<pre>
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:
</pre>Sun, 01 Jan 2012 17:13:51 -0600https://ask.sagemath.org/question/8603/subs_expr-with-et/Answer by tririver for <p>Is there a reason why subs_expr() won't work here?</p>
<pre>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:
</pre>
https://ask.sagemath.org/question/8603/subs_expr-with-et/?answer=13084#post-id-13084Use 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
Mon, 02 Jan 2012 01:55:29 -0600https://ask.sagemath.org/question/8603/subs_expr-with-et/?answer=13084#post-id-13084Comment by Mike Witt for <p>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.</p>
<pre><code>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
</code></pre>
https://ask.sagemath.org/question/8603/subs_expr-with-et/?comment=20602#post-id-20602Great. 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!Mon, 02 Jan 2012 04:58:47 -0600https://ask.sagemath.org/question/8603/subs_expr-with-et/?comment=20602#post-id-20602Comment by kcrisman for <p>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.</p>
<pre><code>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
</code></pre>
https://ask.sagemath.org/question/8603/subs_expr-with-et/?comment=20604#post-id-20604You 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!Mon, 02 Jan 2012 04:26:53 -0600https://ask.sagemath.org/question/8603/subs_expr-with-et/?comment=20604#post-id-20604Comment by tririver for <p>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.</p>
<pre><code>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
</code></pre>
https://ask.sagemath.org/question/8603/subs_expr-with-et/?comment=20601#post-id-20601@kcrisman : Thanks for the suggestion. I will try to make a patch to the doc.Mon, 02 Jan 2012 06:15:59 -0600https://ask.sagemath.org/question/8603/subs_expr-with-et/?comment=20601#post-id-20601