Ask Your Question
0

Dropping higher order terms in polynomials.

asked 2015-02-09 10:39:22 +0100

anonymous user

Anonymous

updated 2015-02-09 12:04:39 +0100

Dear all,

could you please let me know how to write a code? I just get started with the SAGE and met a trouble. When I put the followings

f=e^x; f

then the output is a polynomial function with 16th order. But I wanted to drop the higher order terms and just take 3 tems. However I have no idea how to do it. It seems the truncate() or power_series(ZZ) don't work for the exponential function. Could anyone give me the solution?

thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-02-09 13:15:42 +0100

slelievre gravatar image

When I open Sage and type

 sage: f = e^x
 sage: f

I get this output:

e^x

To get the Taylor series expansion of e^x at 0 to the order 5, do:

sage: f.taylor(x,0,5)
1/120*x^5 + 1/24*x^4 + 1/6*x^3 + 1/2*x^2 + x + 1

Is that what you wanted? Did you have more code before f=e^x; f which made it produce a different output?

edit flag offensive delete link more

Comments

Thank you so much. It was just what you said. Actually I used sage on web server and I put several codes in different lines. There might be some problem in the codes that I wrote at same time. I could solved the problem with your help.

Nownuri gravatar imageNownuri ( 2015-02-09 16:45:36 +0100 )edit

@Nownuri - if so, please accept this answer so that other people coming to this question know it was answered! Thanks.

kcrisman gravatar imagekcrisman ( 2015-02-09 17:04:15 +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

1 follower

Stats

Asked: 2015-02-09 10:39:22 +0100

Seen: 493 times

Last updated: Feb 09 '15