how to find a function written as a series
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Paul
le 24 Nov 2024
Modifié(e) : Paul
le 24 Nov 2024
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 commentaires
Torsten
le 25 Nov 2024
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)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


