calculate an integral within a program
07-19-2014, 01:22 PM
Post: #1
 ThomasA Junior Member Posts: 27 Joined: May 2014
calculate an integral within a program
Hi,
I am working on a little program in optics.
One step is to evaluate an integral numerically and so I enthusiastically incorporated the int-command:
e.g. (simplified example, the real one is the representation of a Bessel function as an integral)
c := int(X^2,X,a,b);
I got an error message when compiling the code.
What is the reason for this 'result'?
Is it impossible to use higher commands like 'int' within a program (maybe because it is a CAS-command)?

Thomas
07-19-2014, 04:50 PM (This post was last modified: 07-19-2014 05:09 PM by Helge Gabert.)
Post: #2
 Helge Gabert Senior Member Posts: 467 Joined: Dec 2013
RE: calculate an integral within a program
Write your program as a CAS program - - it'll work just fine (with x, not X). That might be the least amount of hassle.

e.g.,

(a,b)->BEGIN
int(x^2,x,a,b);
END;

[edit: you can also run your CAS program from Home].
07-19-2014, 08:46 PM
Post: #3
 gsalazar Junior Member Posts: 1 Joined: Jul 2014
RE: calculate an integral within a program
(07-19-2014 01:22 PM)ThomasA Wrote:  Hi,
I am working on a little program in optics.
One step is to evaluate an integral numerically and so I enthusiastically incorporated the int-command:
e.g. (simplified example, the real one is the representation of a Bessel function as an integral)
c := int(X^2,X,a,b);
I got an error message when compiling the code.
What is the reason for this 'result'?
Is it impossible to use higher commands like 'int' within a program (maybe because it is a CAS-command)?

Thomas

If using int() doesn't work for you, try doing CAS.int(). I have had the same problem as you before, and that fixed it for me.
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)