The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 sum function
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

mej

Albania
Posts

Posted - 01/03/2005 :  11:34:50 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 6.1 pro
Operating System: win 2000

Hi everybody and happy new year in 2005
I would like to know if the function sum for n=0 to n=infinity of a give function exists in Origin

Thanks

Mike Buess

USA
3037 Posts

Posted - 01/03/2005 :  12:43:39 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
There's no built in function for that but you can write a LabTalk script that will extend the summation until the result reaches a predetermined precision. The following script will stop summing when the result after the nth term is within 0.1% of the previous result.

precision=1E-3;
sum=0;
for(n=0;n>=0;n++) {
x=<your function of n>;
if( abs(x)<precision*abs(sum) ) break;
sum+=x;
if( mod(n,100) ) continue;
type $(n): $(sum);
};
n=; // how long it took to converge
sum=; // resulting sum

It types a partial result every 100 terms for a reality check. (Hit Escape if it looks like the sum is not converging.)

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 01/03/2005 1:00:48 PM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000