Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: where is the mistake
Date: Sun, 27 Feb 2011 15:42:10 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 72
Message-ID: <ikdrci$jch$1@fred.mathworks.com>
References: <ikbqin$4gr$1@fred.mathworks.com> <ikdnp4$4i$1@fred.mathworks.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.com>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1298821330 19857 172.30.248.46 (27 Feb 2011 15:42:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 27 Feb 2011 15:42:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:712713

"Husam Aldahiyat" wrote in message <ikdnp4$4i$1@fred.mathworks.com>...
> If you have the symbolic math toolbox then you can get around this like so:
> 
>  function y=intxexp(n)
> 
>  intxex=sym('1');
>  y=sym('1');
>  for i=2:n
>      i*intxex
>      intxex=exp(sym('1'))-i*intxex;
>      y=intxex
>  end

I could not resist trying out my new toolbox in MATLAB.

FPF is a class that allows you to work in floating point
arithmetic with a user specified precision. So here, with
50 digits of precision in all computations...

intxex=fpf(1,50);
y=1;
n = 20;
e1 = fpf('e',50);
for i=2:n
  intxex=e1-i*intxex;
  y=intxex
end


y =
    0.7182818284590452353602874713526624977572470936999
y =
    0.5634363430819095292794250572946750044855058126002
y =
    0.4645364561314071182425872421739624798152238432991
y =
    0.3955995478020096441473512604828500986811278772044
y =
    0.3446845416469873704761799084555619056704798304735
y =
    0.3054900369301336420270281121637291580638882803854
y =
    0.2743615330179760991440625740428292332461408506167
y =
    0.2490280312972603430637243049671993985419794381496
y =
    0.2280015154864418047230444216806685123374527122039
y =
    0.210265158108185383406798832865308862045267259457
y =
    0.1950999311608206344787014769689561532140399802159
y =
    0.1819827233683769871371682707562325059747273508932
y =
    0.1705237013017674154399316807654074141110641811951
y =
    0.1604263089325340037613122598715512860912843757734
y =
    0.1514608855385011751792913134078419202966970813255
y =
    0.1434467743045252573123351434193498527133967111664
y =
    0.1362398909775906037382548898043651489161062927047
y =
    0.1297238998848237643334445650697246683512275323106
y =
    0.1238038307625699486913961699581691307326964474879


As expected, it agrees with Roger's reversed series.

John