Feeds:
Posts

Two days ago I was trying to expand in series a lot of functions… so I ask myself, Could it be done in SAGE? It should be possible… but, How? 😛

Solution by Andrzej Chrzeszczyk

sage: var('r');
sage: f=2*r/sinh(2*r)
sage: f.taylor(r,0,5)
14/45*r^4 - 2/3*r^2 + 1
sage: maxima(f).powerseries('r',0)
-4*r*'sum((2^(2*i2-1)-1)*2^(2*i2-1)*bern(2*i2)*r^(2*i2-1)/
(2*i2)!,i2,0,inf)

This solution uses a power series expansion from maxima… really nice feature! Isn’t it?
Ah… and this expansion is around $r=0$.

If one would like the asymptotic expansion $r\to\infty$,

sage: maxima(f).powerseries('r',infinity)
-4*r*'sum((2^(2*i3-1)-1)*2^(2*i3-1)*bern(2*i3)*r^(2*i3-1)/
(2*i3)!,i3,0,inf)

However, note that this expansion coincides with the previous one, i.e., it’s the function itself. It couldn’t be that perfect. 😉

Solution by Francois Maltey

Use the Taylor command of SAGE,

• Around zero
sage: taylor (2*x/sinh(2*x), x, 0, 10)
-292/13365*x^10 + 254/4725*x^8 - 124/945*x^6 + 14/45*x^4 - 2/3*x^2 + 1
• Around infinity… a trick! change $x\mapsto 1/x$ and expand around zero 🙂
sage: taylor (2*1/x/((exp(2/x)-exp(-2/x))/2), x, 0, 12)
4*e^(-10/x)/x + 4*e^(-6/x)/x + 4*e^(-2/x)/x
• Thank you guys!

Enjoy!

Dox

SAGE tip: rewriting expressions

Today I was calculating some stuff with the help of SAGE, and realize that the expressions got a lot (really, a lot) simpler if they where written in terms of  hyperbolic functions instead of exponentials.

$e^x = \cosh(x)+\sinh(x)$

$e^{-x} = \cosh(x)-\sinh(x)$

So I enter the sage-devel channel of IRC (freenode), but there was a lazy day around… Sunday. Therefore I decided to write to the sage-dev group on Google groups.

Francois Maltey answer my question on how to do the transformation… He has written a package that does it!

• Go to page http://wiki.sagemath.org/symbolics/rewrite
look at the second line the “attachement” (in smaller characters)
and get the most recent file.
• Then put this file in your Sage directory
In Sage, type : load “/the/good/file/in/the/good/directory’
Then call the rewrite function.
• Thank you Francois

Example

Suppose the path to the file is “/home/me/rewrite-xxx.sage”

sage: load "/home/me/rewrite-xxx.sage" sage: A = exp(x) + exp(-x) sage: rewrite(A, 'exp2sinhconh') 2*cosh(x)

If you go to http://wiki.sagemath.org/symbolics/rewrite, will find all possible commands which perform such transformations.

Enjoy!

Dox

Gmail configuration for Evolution

I’ve just re-installed Ubuntu in my Dell XPS 1330n. It looks very nice… but as I wrote in a previous post, I’d like it to be a bit different (out of the box) ’cause it tends to look much like Leopard.

• The internet connection works, but it is slow… could be the repositories.
• Firefox’s default search engine has gone back to Google. I have nothing against Yahoo!, but I’m a Google’s fan… So, good for me.
• I’ve noticed that Empathy includes Facebook chat and MySpace one. As usual, the F4 key allows you to configure your accounts. The chat windows is cuter.
• In System-> Administration -> Software Source, I changed to mIain server in Ubuntu SoftwareTab, checked the Canonical Archive box in Other Software Tab, and checked the proposed and backport boxes in the Updates Tab. Finally close for reload the changes.
• After changing the Sotfware sources… It finally began to dist-update. 103 files for a total of 117.1 Mb. Not to bad.
• I’ve just found something called Gwibber or Broadcast (when you press the mail icon in the upper panel)… It allows you to post in Social networks such as facebook, Flirk, … and many others.
• Transmission continues been the default torrent client (I really love it!).
• Still don’t use the Simple Scan program, but I liked really much Xsane… I know, I should give him a try!
• The detection of external media is as good as before.
• One of my favourite text editors, Emacs has evolved to Emacs23, I tried like one month ago and I didn’t like it much. Let’s see if this version is better.
• A Kernel problem which slow down the copy process for large files seems to be gone!

I haven’t finished the Configuration, so I’ll be posting during the day!

Bye!