Integration for n-times
Fri, 11/19/2021 - 12:30 pm
I was wondering if there is any way to do a definite integral for n times (say n=50) at different points for an input variable (here P) and put the result of each integral in a wave.
Let me explain it a little bit more.
Suppose I have a function P*x^2 that I need to integrate from x=0 to x=2 with respect to x at different values of P and put each result of the integration in a wave. P runs from 0 to 49, i.e. P=0,1,2,.......,49. So I need to do the integration 50 times for 50 different values of P.
I can run the integration once for one single value of P but to do it 50 times, is there any simple way to do it in Igor? I can't pass the number of integration as a parameter in the userfunc.
#pragma rtGlobals=3 // Use modern global access method and strict wave access.
For (n=1; n<=50; n+=1)
Variable R = Integrate1D(userfunc,0,2,0)
Printf "%.10f\r" R
return 1*v^2 //Integrating function Y = P*x^2, in this case P =