Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad.newshosting.com!newshosting.com!69.16.185.16.MISMATCH!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe03.iad.POSTED!7564ea0f!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
Organization: Canada Eat The Cookie Foundation
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.math.maple,sci.math.num-analysis,comp.soft-sys.matlab
Subject: Re: How to take 200th order derivative, and then evaluate it numerically?
References: <f6ebcf2b-4782-4984-aebc-7cdb5b28ccee@p2g2000prf.googlegroups.com>
In-Reply-To: <f6ebcf2b-4782-4984-aebc-7cdb5b28ccee@p2g2000prf.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Lines: 33
Message-ID: <_8ewl.90806$2O4.39726@newsfe03.iad>
NNTP-Posting-Host: 24.79.146.116
X-Complaints-To: internet.abuse@sjrb.ca
X-Trace: newsfe03.iad 1237413562 24.79.146.116 (Wed, 18 Mar 2009 21:59:22 UTC)
NNTP-Posting-Date: Wed, 18 Mar 2009 21:59:22 UTC
Date: Wed, 18 Mar 2009 16:59:28 -0500
Xref: news.mathworks.com comp.soft-sys.math.maple:24557 sci.math.num-analysis:107043 comp.soft-sys.matlab:525995


{Some of the original newsgroups removed from the list: sorry, my news server has a
crossposting limit of 4 newsgroups!}


excellentfeng@gmail.com wrote:

> We need to take the 200th order derivative of a complicated formula,
> and then evaluate it numerically.

> So a plan was to first obtain the 200th order derivative thru symbolic
> calculation in Maple, Matlab, Mathematica, and then copy the huge
> result and somehow make it into a form that is numerically evaluable
> either in Matlab or C++. Then evaluate that huge expression
> numerically. Still, that sounds daunting, the symbolic result of 200th
> order derivative will be huge and we are not sure if Maple or
> Mathematica can handle it.

With any modern version of maple, you can calculate the derivative
and then in Maple, (e.g.)

f := exp(x^3) - exp(x^(-3));
CodeGeneration[Matlab](unapply(diff(f,x$200),x),optimize,digits=16,output="f200.m",resultname=f200);

This will directly write a file named f200.m containing a procedure named f200 that does the
differentiation in Matlab.

Caution: the number of digits used on some of the constants may greatly exceed the 16
listed in the digits= parameter. This should lead you to question the accuracy of the output.
Another problem is that differentiating 200 times is likely to lead to a factor of 200!
(or so, perhaps even 205!) as one of the constants -- and that value exceeds the maximum
Matlab real number. Unfortunately, slipping a simplify(factor()) around the diff() does not
remove the 10^308 constant from the output... it just makes the final statement calculating the
return value into a huge unreadable statement.