Can MATLAB solve a integrodifferential equation?

Hi, I have checked some posts on the forum, however to no avail.
I have the given system:
{
syms h g x C
h = 2
g = 4
C = 1/sqrt(2.*pi)
y = ((exp(2.*g.*i.*x./h)).*(((h.^2)./2) + (g.*x)/2.*h.*i));
z = ((exp(-2.*g.*i.*x./h)).*(((h.^2)./2) + (g.*x)/2.*h.*-i));
[int(y.*z*.u, x], 0, 2.*pi)]==1
} which should solve for u. Is it feasible with some modifications?
Thanks

 Accepted Answer

u = 1/int(y*z,x,0,2*pi)
Best wishes
Torsten.

21 Comments

Hi Torsten, maybe I haven't outline the problem correctly:
it should be:
[int(y.*z*.u )*, x], 0, 2.*pi)]==1
where u is inside the integrator. It is not possible to extract u from the integrator by dividing by int(y,z,x,o,2i), that is why it is an integrodifferential eqn. u is inside the integration operation.
If u is a scalar, you can take it out of the int-operator.
What is u if it's not a scalar value ?
Best wishes
Torsten.
It's a function (unknown).
A scalar is also a function ...
Best wishes
Torsten.
u is a function which is multiplied with y and z, which are functions. The three of them are under then dx symbol, and thus cannot be divided per se in our out of the integral sign.
Of course u can be taken out of the integral if it does not depend on x.
Your equation is solved if you set u to be equal to the scalar value
u = 1/int(y*z,x,0,2*pi)
Maybe there are other requirements on u which make this impossible, but up to now, you didn't state them.
Best wishes
Torsten.
Torsten
Torsten on 21 Nov 2017
Edited: Torsten on 21 Nov 2017
As long as you can't set up your equation such that MATLAB doesn't treat u as a scalar, you will get the above result for u when using MATLAB's "solve".
Or how do you want to tell MATLAB that u explicitly depends on x ?
Best wishes
Torsten.
This is precisely the reason I ask here. In fact, u can even be an operator, such as d/dx
I wonder why you call your equation an "integro-differential equation". Where is the differential operator ?
Best wishes
Torsten.
u can be the differential operator, or it can be a simple function, such as "x"
Torsten
Torsten on 21 Nov 2017
Edited: Torsten on 21 Nov 2017
I think you should first take a look at the definition of an integro-differential equation:
https://en.wikipedia.org/wiki/Integro-differential_equation
There is no MATLAB program that directly solves this type of equations.
But what exactly is the equation you are trying to solve ?
If it's the one you stated and u depends on x, you must explicily specify how u depends on x, e.g. u(x)=a*cos(x) with unknown a. Then - as a next step - you can determine "a" via the "solve" command.
Best wishes
Torsten.
Thanks Torsten! I will give that a try.
Tried it, and got "a" not defined
end
syms h g x C
h = 2
g = 4
C = 1/sqrt(2.*pi)
y = ((exp(2.*g.*i.*x./h)).*(((h.^2)./2) + (g.*x)/2.*h.*i));
z = ((exp(-2.*g.*i.*x./h)).*(((h.^2)./2) + (g.*x)/2.*h.*-i));
u = 1/[int(y.*z*.*a*cos(x), x], 0, 2.*pi)]
solve
Dear Torsten, I tried this new variant:
if true
% code
end
syms h g x C
h = 1
g = 5
y=@(x)(C - (exp(2.*g.*1i.*x./h));
z=@(x)(C - (exp(-2.*g.*1i.*x./h));
prod=@(x)y(x).*z(x)*(1+x^2);
W= integral(prod,0,2*pi)==1;
and I should get the result for "C", however that is simply 0. It looks incorrect, or is the W part correctly written?
Thanks!
syms C x
h = 1;
g = 5;
y = C-exp(2*g*1i*x/h);
z = C-exp(-2*g*1i*x/h);
prod = y*z*(1+x^2);
Csol = solve(int(prod,x,0,2*pi)-1==0,C);
Best wishes
Torsten.
PS: Torsten, I get TWO values if I use double(Csol), how does that figure?
From your Ansatz, you get a quadratic equation in C which usually has two solutions.
Let MATLAB show "int(prod,x,0,2*pi)" and you'll see.
Best wishes
Torsten.
Dear Torsten,
I have the source term of the form u(1-int u) in two dimension. How to write the FDM code? Could you please tell.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!