Summations

Brandon Barker bebarker at meginc.com
Tue Nov 13 04:52:09 CET 2001


Hello everyone.
I've mailed this list before and have taken the advice obtained from it to 
write a numerical integration program for some of my needs, and GiNaC seems 
to be the best way for me to accomplish this.  First of all, I have only had 
Calculus 2, and am just now taking the equivalent of a first semester in 
Computer Science course using C++ (self study - my high school doesn't offer 
Comp Science, and I don't know any programmers in my area, so I have to rely 
on on-line resources - like you people, sorry :-/  ) so this may explain why 
I found latter parts of the GiNaC tutorial harder to comprehend and also the 
fact that I'm somewhat new to C/C++ (though I've done a lot of reading, w/o 
much coding and hacking one tends to forget).

I'm actually attempting to write my first C++ program to do Numerical 
Integration, but I'm having trouble doing this and I wanted to know if 
someone could show me the source to a simple program using GiNaC to find the 
summation (for example) of f(x)=x^2 on the interval [1,2] with n=4 (where n 
== number of intervals).
Of course, a=1, b=2, n=4, and integrand=x^2 should all be variables excepted 
by the summation function.

Once I find out how to implement something simple like this, I think I'll be 
well on my way to writing the program.  Once I get it finished, I'll put it 
up on SourceForge (by finished I mean something that works and isn't too 
embarrassing).

Many thanks in advance,
Brandon Barker



More information about the GiNaC-list mailing list