Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
AmCh
Creator
Creator

numerical integration

Hello all,

I am getting to use numerical integration within the trapezoidal rule.

I already have the python function and would like to converting it to a QlikView macro.

The python function:

def trapz(f,a,b,N=20):

x=np.linspace(a,b,N+1)

y=f(x)

y_r=y[1:]

y_l=y[:-1]

dx=(b-a)/N

result=(dx/2)*np.sum(y_r+y_l)

return result

 

As an example for input parameters: f(x)=exp(x)*x, a=0.1, b=0.8, N=20

 

Can anyone help me?

Many thanks in advance

Labels (4)
0 Replies