Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: simple Sin

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89924] Re: [mg89859] simple Sin
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Tue, 24 Jun 2008 03:32:02 -0400 (EDT)
  • References: <200806230646.CAA00151@smc.vnet.net>

In order to get a higher order Taylor expansion you have to use a  
higher order numerical ODE solver. (The default uses finite  
differences of order one.)

NDSolve[{Derivative[2][y][t] + y[t] == 0, Derivative[1][y][0] == 1,  
y[0] == 0}, y,
    {t, 0, 2*Pi}, Method -> {"ExplicitRungeKutta", "DifferenceOrder" - 
 > 6}];

sin[u_] = y[u] /. First[%];

N[Normal[Series[{sin[t], Sin[t]}, {t, 0, 5}]]]

{0.008325597762864565*t^5 + 8.18663497983204*^-7*t^4 -  
0.16666669041252172*t^3 +
    3.469446951953614*^-18*t^2 + 1.*t, 0.008333333333333333*t^5 -  
0.16666666666666666*t^3 + t}

You still get terms of degree 4 and 2 but with very small  
coefficients. You can't possibly expect to get these to be exactly 0  
with a purely numerical method!

Andrzej Kozlowski


On 23 Jun 2008, at 15:46, Narasimham wrote:

> It is surprising a bit, by numerical computation Sin[ t] has a
> different series representation, is not even an odd function of t !
> Looks like has a different chemistry.
>
> NDSolve[{y''[t] + y[t] == 0, y'[0] == 1, y[0] == 0 }, y, {t, 0, 2 Pi}]
> sin[u_] = y[u] /. First[%]
> Plot[sin[t] - Sin[t], {t, 0, 2 Pi}]
>
> Series[{sin[t], Sin[t]}, {t, 0, 8}]
>
> Also, why do we not get an expansion of  sin as Series[Im[Exp[I*t]],
> {t, 0, 8}] ?
>
> TIA
>
> Narasimham
>



  • References:
    • simple Sin
      • From: Narasimham <mathma18@hotmail.com>
  • Prev by Date: Re: Solving a Sum
  • Next by Date: Re: Mathematica performance improvements
  • Previous by thread: Re: simple Sin
  • Next by thread: Re: simple Sin