how to find a function written as a series
84 ビュー (過去 30 日間)
古いコメントを表示
Aya Alaa eldeen mohamed
2024 年 11 月 24 日 9:03
i tried to solve the following u(n+1)=-int((x-t)*u(n),t,0,x)
where n from 0 to in but matlab say to not use inf so i want to try it up to100 at least is it possible ?
wha i try asfollows but still have something missed
is any way to use index like sum(ui)=u0+u1+u3+.....
and how to find the answer using taylor seires
(this is to solve an integral equation using Adomiandecomposition method)
syms x t u
a=0;
b=x;
f=(x-t);
u0=-2+3*x-x^2;
for k=1:inf %or k=1:100 at least
u = -1*int(f*u,t,a,b);
end
u=u0+u
0 件のコメント
採用された回答
Paul
2024 年 11 月 24 日 17:04
編集済み: Paul
2024 年 11 月 24 日 20:10
Would be nice to see the actual mathematical equation to be solved. Assuming the equation and solution follows the exposition at Adomian decomposition method, the first n terms of the solution would be constructed as
syms x t
a = 0;
b = x;
f = (x-t);
u0 =-2 + 3*x - x^2;
u(1) = u0;
for k=2:10 %or k=1:100 at least
u(k) = -1*int(f*subs(u(k-1),x,t),t,a,b);
end
u,disp(char(u))
temp = u; % save for later
Summing the u(k) together yields a series-like expression
u = simplify(sum(u)),disp(char(u))
figure
hax = gca;
fplot(u,[0,10])
We can also get a closed form expression for u(x)
syms k n integer
term0(n) = (-1)^(n+1);
term1(n) = x^(2*n);
term2(n) = 3*(n+1);
term3(n) = simplify(symsum(2 + 8*k,k,0,n));
term4(n) = piecewise(n==0,1,symprod(term3(k),k,1,n));
u(n) = term0(n)*term1(n)*(x^2 - term2(n)*x + term3(n))/term4(n);
u(n) = simplify(u(n)),disp(char(u(n)))
% verify against previous solution
double(simplify(temp-u(0:9)))
Closed for expression for u(x)
u(x) = symsum(u(n),n,0,inf),disp(char(u(x)))
figure
fplot([sum(temp),u(x)],[0,10])
It would be nice to know the actual equation that the OP is trying to solve.
2 件のコメント
Torsten
2024 年 11 月 25 日 11:24
For comparison: solution is
u(x) = 3*sin(x)-2
syms u(x) v(x) t
eqns = [diff(u,x)==3-2*x-v,diff(v,x)==u];
conds = [u(0)==-2,v(0)==0];
sol = dsolve(eqns,conds);
usol(x) = simplify(sol.u)
ucomp = -2+3*x-x^2-int((x-t)*usol(t),t,0,x)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!