HP Forums

Full Version: calculate an integral within a program
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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].
(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.
Reference URL's