[Date Index]
[Thread Index]
[Author Index]
Re: How to use the Simpson 1/3 rule to write this program
*To*: mathgroup at smc.vnet.net
*Subject*: [mg76195] Re: How to use the Simpson 1/3 rule to write this program
*From*: dh <dh at metrohm.ch>
*Date*: Thu, 17 May 2007 06:11:36 -0400 (EDT)
*References*: <f2ek5i$nq$1@smc.vnet.net>
Hi Evanescence,
Note that only K depends on z, therefore, only this function needs
integration.
First we create the x arguments for the terms that will be multiplied by
2 and 4. Then we apply the function K to these values, make a list of
all terms, flatten the list for summation and sum it:
x4=Table[-0.5+i,{i,1,32}];
x2=Table[i,{i,1,31}];
int=(1/6){K[x,0],(2 K[x,#]&/@x2),(4 K[x,#]&/@x4),K[x,32]} // Flatten //
Total
hope this helps, Daniel
Evanescence wrote:
> Hello Dear all:
> My questions are as follows:
> First I have some functions are as follows:
> K[z_,x_] is a function of z and x.
> B[x_,y_] is a function of x and y.
> F[x_] is a function of x.
> Z[x_] is a function of x.
> A[x_,y_] is a function of x and y.
> G[x_] is a function of x.
> U[x_] is a function of x.
>
> Then I have a integration as follows:
> L[x_,y_,z_]:=(x*K[z,x])*(B[x,y]*F[x]*Z[x]+2*(A[x,y]-B[x,y]*G[x])*U[x])
> L[x,y,z] integrate to x , and the upper limit is 32 , the lower limit
> is 0
> So the integration form actually is a function of y and z.
>
> Now I want to use Simpson 1/3 rule to repreaent the integration , so
> the integration becomes as follows
> (Assume I use the division is 1/2)
> W[y_,z_]:=(1/3)*(32-0/64)*(0+4(((1/2)*K[z,
> 1/2])*(B[1/2,y]*F[1/2]*Z[1/2]+2*(A[1/2,y]-B[1/2,y]*G[1/2])*U[1/2]))+
> 2(((1)*K[z,1])*(B[1,y]*F[1]*Z[1]+2*(A[1,y]-
> B[1,y]*G[1])*U[1]))+
> 4(((3/2)*K[z,
> 3/2])*(B[3/2,y]*F[3/2]*Z[3/2]+2*(A[3/2,y]-B[3/2,y]*G[3/2])*U[3/2]))+
> 2(((2)*K[z,2])*(B[2,y]*F[2]*Z[2]+2*(A[2,y]-
> B[2,y]*G[2])*U[2]))+
> 4(((5/2)*K[z,
> 5/2])*(B[5/2,y]*F[5/2]*Z[5/2]+2*(A[5/2,y]-B[5/2,y]*G[5/2])*U[5/2]))+
> .............................................................................................................
> +
> 4(((63/2)*K[z,
> 63/2])*(B[63/2,y]*F[63/2]*Z[63/2]+2*(A[63/2,y]-
> B[63/2,y]*G[63/2])*U[63/2]))+
> (((32)*K[z,
> 32])*(B[32,y]*F[32]*Z[32]+2*(A[32,y]-B[32,y]*G[32])*U[32])))
>
> My question is how to writr a computer program to represent W[y_,z_]
> and I can set the upper limit ,the lower limit,and the division in
> myself.
>
> Thank you for your advice and answer!!
> Evanescence 2007 5 15.
>
>
Prev by Date:
**Re: Solve & RotationMatrix**
Next by Date:
**Re: Where is the Mathematica Book in Documentation Center?**
Previous by thread:
**How to use the Simpson 1/3 rule to write this program**
Next by thread:
**Delete all the memory except 1 matrix**
| |