ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 23 Jul 2014 17:14:14 +0200expand hyperbolic trig functionshttps://ask.sagemath.org/question/23546/expand-hyperbolic-trig-functions/ Part of a symbolic expression is
ex = 2*e^(1/2*x)*sinh(1/2*x)
How to substitute sinh(x) with its expansion (e^x-e^(-x))/2 and simplify ex to e^x-1? I have tried all expand and simplify functions.Wed, 23 Jul 2014 15:48:08 +0200https://ask.sagemath.org/question/23546/expand-hyperbolic-trig-functions/Answer by FrédéricC for <p>Part of a symbolic expression is</p>
<pre><code>ex = 2*e^(1/2*x)*sinh(1/2*x)
</code></pre>
<p>How to substitute sinh(x) with its expansion (e^x-e^(-x))/2 and simplify ex to e^x-1? I have tried all expand and simplify functions.</p>
https://ask.sagemath.org/question/23546/expand-hyperbolic-trig-functions/?answer=23548#post-id-23548Is this what you need ?
sage: ex2 = ex.subs_expr(sinh(x/2) == (exp(x/2)-exp(-x/2))/2)
sage: ex2.exp_simplify()
e^x - 1
or even better
sage: w0 = SR.wild(0)
sage: ex2 = ex.subs_expr(sinh(w0) == (exp(w0)-exp(-w0))/2)
sage: ex2.exp_simplify()
e^x - 1
Wed, 23 Jul 2014 16:24:57 +0200https://ask.sagemath.org/question/23546/expand-hyperbolic-trig-functions/?answer=23548#post-id-23548Comment by kcrisman for <p>Is this what you need ?</p>
<pre><code>sage: ex2 = ex.subs_expr(sinh(x/2) == (exp(x/2)-exp(-x/2))/2)
sage: ex2.exp_simplify()
e^x - 1
</code></pre>
<p>or even better</p>
<pre><code>sage: w0 = SR.wild(0)
sage: ex2 = ex.subs_expr(sinh(w0) == (exp(w0)-exp(-w0))/2)
sage: ex2.exp_simplify()
e^x - 1
</code></pre>
https://ask.sagemath.org/question/23546/expand-hyperbolic-trig-functions/?comment=23550#post-id-23550Perhaps, but I'm not sure if it is available in any of the expansions in Ginac or Maxima.Wed, 23 Jul 2014 17:14:14 +0200https://ask.sagemath.org/question/23546/expand-hyperbolic-trig-functions/?comment=23550#post-id-23550Comment by rws for <p>Is this what you need ?</p>
<pre><code>sage: ex2 = ex.subs_expr(sinh(x/2) == (exp(x/2)-exp(-x/2))/2)
sage: ex2.exp_simplify()
e^x - 1
</code></pre>
<p>or even better</p>
<pre><code>sage: w0 = SR.wild(0)
sage: ex2 = ex.subs_expr(sinh(w0) == (exp(w0)-exp(-w0))/2)
sage: ex2.exp_simplify()
e^x - 1
</code></pre>
https://ask.sagemath.org/question/23546/expand-hyperbolic-trig-functions/?comment=23549#post-id-23549This substitution should happen on expand() or expand_trig() IMHO.Wed, 23 Jul 2014 17:01:53 +0200https://ask.sagemath.org/question/23546/expand-hyperbolic-trig-functions/?comment=23549#post-id-23549