help-octave
[Top][All Lists]
Advanced

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

infinite geometric series


From: Fullfill
Subject: infinite geometric series
Date: Sat, 4 Jan 2014 11:12:49 -0800 (PST)

<http://octave.1599824.n4.nabble.com/file/n4660654/1471116_731146650246828_979308716_n.jpg>
 

Hello ! 
 
I'm trying to implement infinite geometric series in octave but i don't know
if I'm doing it correctly.

function y=myfun(x)
 an=0; 
 n=0;
 s=1;
 while abs(an)< 0.3
 n=n+1;
 an=(-3*x).^n;
 s=s+an;
 end%while
 endfunction

Also I don't know how to read in x-values as a vector to this function and
get y-values as a vector.

All helpful ideas great to see. 




--
View this message in context: 
http://octave.1599824.n4.nabble.com/infinite-geometric-series-tp4660654.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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