HP Forums
calculate an integral within a program - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: calculate an integral within a program (/thread-1854.html)



calculate an integral within a program - ThomasA - 07-19-2014 01:22 PM

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


RE: calculate an integral within a program - Helge Gabert - 07-19-2014 04:50 PM

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].


RE: calculate an integral within a program - gsalazar - 07-19-2014 08:46 PM

(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.