```Path: news.mathworks.com!not-for-mail
From: "Jonathan " <jauni6@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Nonlinear functions need to find the accuracy
Date: Fri, 9 Apr 2010 00:46:22 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 32
Message-ID: <hpltcu\$hfb\$1@fred.mathworks.com>
References: <hpla45\$q5q\$1@fred.mathworks.com> <hplevi\$7d3\$1@canopus.cc.umanitoba.ca> <hplgt2\$f5t\$1@fred.mathworks.com> <hplrue\$qiv\$1@canopus.cc.umanitoba.ca>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1270773982 17899 172.30.248.35 (9 Apr 2010 00:46:22 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 9 Apr 2010 00:46:22 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:624883

X can be any value of my choosing, but for the sake of simplicity, I have chosen x=1.  Mathematically, I know I can break the summation into two parts.  The first part would be the function evaluated from k=1 to N-1.  The second part would be an integration of the function from N to infinity.  To define accuracy better, I want the second part (the integration part) to be equal to 10^-8.  I've taken another crack at it, seperated into three parts.  In my code, I manipulate the function.  Here is my code thus far:

clc
syms z k
%
x=1;
f=(1+z)^(1/2)
g=taylor(f,3);
h=subs(g,x/k^3,z);
i=int(h*k^(-3/2),k);
j=abs(i);
%
k1=(1-z)^(1/2)
l=taylor(k1,3);
m=subs(l,x/k^3,z);
n=int(m*k^(-3/2),k);
o=abs(n);
%
p=k-f;
q=taylor(p,3);
r=subs(q,z,x/k^3);
s=int(r*k^(-3/2),k);
t=abs(s)
%
k=1;
t=0;
while s<(1/10^8);
k=k+1;
s=t+s;
end
disp(s)
disp(k)
```