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.Tue, 01 Jul 2014 17:51:21 +0200Working with complex symbolic expressionshttps://ask.sagemath.org/question/8716/working-with-complex-symbolic-expressions/I am a beginner at Sage so my questions may not be well informed, so bear with me.
The context: I am trying to use sage to explore the exponential function assuming all I know about it is that it is its own derivative and has the value 1 at z = 0. It is then easy to develop the Taylor series to any degree using formula like:
expp2( z ) = 1 + ( 1/ factorial( 1 ) )* z + ( 1/ factorial( 2 ) ) * ( z ^ 2 )
You can take 2 of these for z = a and z = b and multiply them together in Sage. Getting something like:
1/4*(b^2 + 2*b + 2)*(a^2 + 2*a + 2)
Now I have done the algebra by hand and know this reduces to the Taylor expansion for z = a + b.
What I do not get is how to show this part in Sage in a nice clean way ( I have some ways I do not like so much ).
Here I have 2 questions one specific, and one general ( I am interested in the answer to either one or both):
1) If this exponential question interests anyone, could you offer some tips? I have tried various ( but not all ) applications of expand and simplify. I am still plugging away.
2) Is there a guide that would help me learn how to carry out algebraic operations over complex expressions. I have looked at several basic tutorials, but they do not have much detail. The most useful single resource I have found is
http://www.sagemath.org/doc/reference/sage/symbolic/expression.html
and the pages linking from it.
Mon, 13 Feb 2012 15:07:47 +0100https://ask.sagemath.org/question/8716/working-with-complex-symbolic-expressions/Answer by rws for <p>I am a beginner at Sage so my questions may not be well informed, so bear with me. </p>
<p>The context: I am trying to use sage to explore the exponential function assuming all I know about it is that it is its own derivative and has the value 1 at z = 0. It is then easy to develop the Taylor series to any degree using formula like:</p>
<p>expp2( z ) = 1 + ( 1/ factorial( 1 ) )* z + ( 1/ factorial( 2 ) ) * ( z ^ 2 )</p>
<p>You can take 2 of these for z = a and z = b and multiply them together in Sage. Getting something like:</p>
<p>1/4<em>(b^2 + 2</em>b + 2)<em>(a^2 + 2</em>a + 2)</p>
<p>Now I have done the algebra by hand and know this reduces to the Taylor expansion for z = a + b.</p>
<p>What I do not get is how to show this part in Sage in a nice clean way ( I have some ways I do not like so much ). </p>
<p>Here I have 2 questions one specific, and one general ( I am interested in the answer to either one or both):</p>
<p>1) If this exponential question interests anyone, could you offer some tips? I have tried various ( but not all ) applications of expand and simplify. I am still plugging away.</p>
<p>2) Is there a guide that would help me learn how to carry out algebraic operations over complex expressions. I have looked at several basic tutorials, but they do not have much detail. The most useful single resource I have found is</p>
<p><a href="http://www.sagemath.org/doc/reference/sage/symbolic/expression.html">http://www.sagemath.org/doc/reference...</a> </p>
<p>and the pages linking from it.</p>
https://ask.sagemath.org/question/8716/working-with-complex-symbolic-expressions/?answer=23157#post-id-23157It is quite possible to get what you want with formal power series:
sage: R.<a,b> = PowerSeriesRing(QQ); R
Multivariate Power Series Ring in a, b over Rational Field
sage: exp(a+b)==exp(a)*exp(b)
True
sage: exp(a-b)==exp(a)/exp(b)
True
Read
- https://en.wikipedia.org/wiki/Formal_power_series
- http://sagemath.org/doc/reference/power_series/index.html
Tue, 01 Jul 2014 17:51:21 +0200https://ask.sagemath.org/question/8716/working-with-complex-symbolic-expressions/?answer=23157#post-id-23157