0

I'm looking to integrate a function I am building, but the function would change each iteration based on a given input. For instance:

    y=4e^(mx/4)

I would want to integrate with respect to x with a lower and upper bound, but the value of m would change. I know all my values of m.

Can I work with this? My initial assumption would be to use QROMB but that seems limited and unable to handle my issue.

WebDevBooster
  • 14,674
  • 9
  • 66
  • 70
Cam
  • 93
  • 1
  • 5

1 Answers1

0

QROMB (and other integrators) want a function of one variable, so you have to get the m in there through the back door. One way is with a common block:

function integrand,x
common int_common,int_m
return,4*exp(int_m*x/4)
end

function integrator,m,xlow,xhigh
common int_common,int_m
int_m=m
return,qromb('integrand',xlow,xhigh)
end

integrator(m,xlow,xhigh) will return the integral you want.

Ted Bunn
  • 131
  • 5