Post Reply 
calculate an integral within a program
07-19-2014, 01:22 PM
Post: #1
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
Find all posts by this user
Quote this message in a reply
07-19-2014, 04:50 PM (This post was last modified: 07-19-2014 05:09 PM by Helge Gabert.)
Post: #2
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;

There a lots of older threads about this topic.

[edit: you can also run your CAS program from Home].
Find all posts by this user
Quote this message in a reply
07-19-2014, 08:46 PM
Post: #3
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.
Find all posts by this user
Quote this message in a reply
Post Reply 




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