help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OctDev] Taylor expansion using the fft


From: Stephen Montgomery-Smith
Subject: Re: [OctDev] Taylor expansion using the fft
Date: Sat, 08 Oct 2011 09:57:42 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15

On 10/08/2011 08:36 AM, Carnë Draug wrote:
On 8 October 2011 13:56, Fernando<address@hidden>  wrote:
Hi there

Just want to post a simple Taylor expansion code based on Cauchy's integral
formula taking
  the contour to be a circle:

function coeff = taylor(N,r,f)

h = 2*pi/N;

n = 0:N-1; # index of coefficients
th = n*h;  # step length around a circle

coeff = real(1./(N*(r.^n)).*fft(f(r*exp(i*th))));

octave:4>  taylor(16,0.5,@(x) 1./(1-x))
ans =

  Columns 1 through 8:

   1.0000   1.0000   1.0000   1.0000   1.0000   1.0000   1.0000   1.0000

  Columns 9 through 16:

   1.0000   1.0000   1.0000   1.0000   1.0000   1.0000   1.0000   1.0000


The problem is choosing the radius of your circle, to my knowledge theres no
optimal radius r.
Also you need to choose r such that the function f is analytic in that
region, in the example I chose r<  1
as there is a pole at 1.

Just thought I share it since its so simple. Hope its useful.

It looks nice.

But shouldn't "taking the real part" be replaced by multiplying by -i? Just in case the function has complex Taylor coefficients?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]