Question: Multiple variable integration using ArrayInterpolation as function source

I am using Maple to load well-behaved function data (512 points) and using ArrayInterpolation integrate it:

P:= r -> CurveFitting:-ArrayInterpolation(xydata, Array(1 .. 1, 1 .. 1, [r]), method = spline)[1];.

While the simple integral    int(P, 0 .. 100, numeric, digits = 4)    outputs a number, if I add another variable like   int(P*a, [r = 0 .. 1, a = 0 .. 1], numeric)    it just outputs      int(P*a, [r = 0 .. 1, a = 0 .. 1], numeric)  (obviously the integral is more complex but this just shows the principle).

int(P(r)*a, [r = 0 .. 1, a = 0 .. 1], numeric)  gives and error 'invalid input: coordinates of xvalues must be of type numeric'. Does anyone know the syntax to make this integral evaluate numerically?

I really wouldn't want to use   spline()  or interpolation()  because as far as I have tried they are really slow and incompatable respectively. Actual document below.


Much thanks in advance.

restart; with(LinearAlgebra); with(CurveFitting); with(Interpolation); with(plots)

NULL

NULL

data := Import("C:/Users/Ingvars/Desktop/data.csv", output = Matrix)

NULL

NULL``

P := proc (r) options operator, arrow; CurveFitting:-ArrayInterpolation(`<|>`(Column(data, 1), `~`[`^`](Column(data, 15), 2)), Array(1 .. 1, 1 .. 1, [[r]]), method = spline)[1] end proc
``

``

NULLNULL

display(plot(P, 0 .. 10), pointplot(Column(data, 1)[1 .. 450], `~`[`^`](Column(data, 15)[1 .. 450], 2), symbolsize = 2, color = red))

 

NULL

int(P, 0 .. 100, numeric, digits = 4)

1.000

(1)

NULL

"F_R(m,l,q):=2*int(P*sin(q r cos(theta))^(2)*sin(theta)*|(Y)[l]^(m)(theta,phi)|^(2),[theta=0..Pi,phi=0..2 Pi,r=0..100],numeric,digits=4):"NULL

"F_I(m,l,q):=int(P*sin(q r cos(theta))*sin(theta)*|(Y)[l]^(m)(theta,phi)|^(2),[theta=0..Pi,phi=0..2 Pi,r=0..100],numeric,digits=4):" 

 

"F(m,l,q):=|F_R(m,l,q)-i*F_I(m,l,q)|:"

 

 

evalf(F(1, 2, 1))

abs(-2.*(Int(Int(Int(P*sin(r*cos(theta))^2*sin(theta)*abs(SphericalY(2., 1., theta, phi))^2, theta = 0. .. 3.142), phi = 0. .. 6.284), r = 0. .. 100.))+(1.*I)*(Int(Int(Int(P*sin(r*cos(theta))*sin(theta)*abs(SphericalY(2., 1., theta, phi))^2, theta = 0. .. 3.142), phi = 0. .. 6.284), r = 0. .. 100.)))

(2)

``


 

Download Au_Scattering.mw

Please Wait...