Using simpson 1/3 rule for double integration I want to give first only y limit then after getting this integration I want to give x limit f(x,y)=sin​(x)(A1sinh​(y)+B1sinh​(b-y))+ C1sin(x)*s​inh(b-y)+D​1sin(x)*si​nh(y)+E1si​nh(Lx)* sin(y)+sinh(x)*sin(y)

5 次查看(过去 30 天)
is there a method in simpson 1/3 rule for double integration that first i give only y limit after getting this integration i give x limit and function has both x and y variable in multiplication so i cant use simpson 1/3 rule for single integration i am using a simpson 1/3 rule for double integration the code but in this code i have to give x and y limit both at a same time the code is
syms x y;
f = inline(f(x,y));
c = inline('1');
d = inline('2');
a =0;
b = x;
m = 4;
n = 4;
hx = (b-a)/n;
An = 0;
Ae = 0;
Ao = 0;
for i = 0:n
x = a + i*hx;
ya = c(x);
yb = d(x);
hy = (d(x) - c(x))/m;
Bn = f(x,ya) + f(x,yb);
Be = 0;
Bo = 0;
for j = 1:m-1
y = ya + j*hy;
z = f(x,y);
if rem(j,2)==0
Be = Be + z;
else
Bo = Bo + z;
end
end
A1 = (Bn + 4*Bo + 2*Be)*hy/3;
if i == 0 | i == n
An = An + A1;
else
if rem(i,2)==0
Ae = Ae + A1;
else
Ao = Ao + A1;
end
end
end
Dint = (An + 4*Ao + 2*Ae)*hx/3;
end
  2 个评论
Torsten
Torsten 2015-11-2
is there a method in simpson 1/3 rule for double integration that first i give only y limit after getting this integration i give x limit
Why do you want to do this ?
Best wishes
Torsten.
NILESH PANDEY
NILESH PANDEY 2015-11-4
because in my integration problem first i have to integrate w.r.t. y than after getting this i have to integrate dx/f(x) so if i give both x and y limit at same time it will integrate w.r.t x also to clarify this i am attaching a file i hope this will help

请先登录,再进行评论。

采纳的回答

Torsten
Torsten 2015-11-4
Write down the Simpson-rule approximation for
integral_{y=c}^{y=d) exp(f(x,y)) dy .
This will be a finite sum including the variable x. Call it sum(x).
Thus under the first integral you have an expression of the form 1/sum(x) to integrate over [a:b].
Now apply Simpson's rule again in x-direction.
Best wishes
Torsten.
  4 个评论
NILESH PANDEY
NILESH PANDEY 2015-11-7
编辑:NILESH PANDEY 2015-11-7
sir i cant understand it what is I(x) and result = simpson(@(x)I(x),a,b,deltax) what is the meaning of result and simpson. and is there a difference in answer if i use this q = integral(fun,xmin,xmax) not simpson 1d code
Torsten
Torsten 2015-11-9
编辑:Torsten 2015-11-9
In function I(x), you evaluate
1/integral_{y=c}^{y=d) exp(f(x,y)) dy
for a given value of x.
Thus by calling
result = simpson(@(x)I(x),a,b,deltax);
you integrate
1/integral_{y=c}^{y=d) exp(f(x,y)) dy
from x=a to x=b which should give you the integral you try to evaluate.
If you have problems, you may want to post the complete code you are using such that we can check it for errors.
Best wishes
Torsten.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by