How can I evaluate P(x) here

Hello
How I can determine the function P(x) here if v= zero ?
v=(5*diff(P(x), x))/14 - (5*diff(P(x), x, x))/14 + (906154630400843*3^(1/2)*diff(P(x), x)^2)/(13194139533312*P(x)*(4645044914673847/(6871947673600*P(x)) + 6803141486033789/(42949672960000*P(x)^2) - 3171541396992589/1099511627776)) - (906154630400843*3^(1/2)*P(x)*diff(P(x), x)^2)/(13194139533312*(4645044914673847/(6871947673600*P(x)) + 6803141486033789/(42949672960000*P(x)^2) - 3171541396992589/1099511627776))

1 Comment

Ahmad Almasri
Ahmad Almasri on 5 Jan 2019
Edited: Ahmad Almasri on 5 Jan 2019
this is the full code
syms x y P(x)
l=20e-6;
e=0.06;
d=e*l/2;
k=0;
re=300;
rs=e;
rb=1/e;
ga=1.4;
pr=0.72;
ma=0.3;
kn0=0.01;
%ha=sqrt(re*rs*rb);
ha=sqrt(re*rs*rb);
sigmau=0.85;
thu=(2-sigmau)/sigmau;
P=P(x);
kn=kn0/P;
p=2;
%ma=sqrt((1/ga)*(1/(1-(1/p))*(e/((1/re)+(rb*rs)-e))))
ma=sqrt(e);
n1=((e*re)/(ga*ma^2*ha^2));
n2=(thu*ha*sinh(ha/2));
n3=(thu^2 * ha^2 * cosh(ha/2));
n4=-cosh(ha/2);
kn=kn0./P;
u=((k-n1*diff(P,x))/((n2*kn)+(n3*kn^2)+n4))*cosh(ha*y)+k-(n1*diff(P,x));
ux=diff(u,x);
n5=(ux+(n1*diff(P, x, x)))/cosh(ha*y);
n6=((k-n1*diff(P,x))/((n2*kn)+(n3*kn^2)+n4));
n7=k-(n1*diff(P,x));
y=0.5;
v=(n1*y*diff(P,x))-((n6*sinh(ha*y)*diff(P,x))/(ha*P))-((n7*y*diff(P,x))/P)-((n5*sinh(ha*y))/ha)+((n6*sinh(ha/2)*diff(P,x))/ha*P)+((n7*diff(P,x))/(2*P))+((n5*sinh(ha/2))/ha)-((n1*diff(P,x,x))/2);

Sign in to comment.

 Accepted Answer

When I attempted to integrate it analytically with my additions (including ‘dP’ and ‘d2P’), the result was an empty sym for ‘SPv’.
Not all differential equations have analytic integrations. If you want a numerical result, use the odeToVectorField and matlabFunction functions to create an anonymous function that the numerical ODE solvers can use ...
...such as:
syms x y P(x) P0 dP0 t Y
dP = diff(P);
d2P = diff(dP);
l=20e-6;
e=0.06;
d=e*l/2;
k=0;
re=300;
rs=e;
rb=1/e;
ga=1.4;
pr=0.72;
ma=0.3;
kn0=0.01;
%ha=sqrt(re*rs*rb);
ha=sqrt(re*rs*rb);
sigmau=0.85;
thu=(2-sigmau)/sigmau;
% P=P(x); % <— This Eliminates The Function Definition Of ‘P(x)’!
kn=kn0/P;
p=2;
%ma=sqrt((1/ga)*(1/(1-(1/p))*(e/((1/re)+(rb*rs)-e))))
ma=sqrt(e);
n1=((e*re)/(ga*ma^2*ha^2));
n2=(thu*ha*sinh(ha/2));
n3=(thu^2 * ha^2 * cosh(ha/2));
n4=-cosh(ha/2);
kn=kn0./P;
u=((k-n1*diff(P,x))/((n2*kn)+(n3*kn^2)+n4))*cosh(ha*y)+k-(n1*diff(P,x));
ux=diff(u,x);
n5=(ux+(n1*diff(P, x, x)))/cosh(ha*y);
n6=((k-n1*diff(P,x))/((n2*kn)+(n3*kn^2)+n4));
n7=k-(n1*diff(P,x));
y=0.5;
% v=(n1*y*diff(P,x))-((n6*sinh(ha*y)*diff(P,x))/(ha*P))-((n7*y*diff(P,x))/P)-((n5*sinh(ha*y))/ha)+((n6*sinh(ha/2)*diff(P,x))/ha*P)+((n7*diff(P,x))/(2*P))+((n5*sinh(ha/2))/ha)-((n1*diff(P,x,x))/2);
v=(n1*y*dP)-((n6*sinh(ha*y)*dP)/(ha*P))-((n7*y*dP)/P)-((n5*sinh(ha*y))/ha)+((n6*sinh(ha/2)*dP)/ha*P)+((n7*dP)/(2*P))+((n5*sinh(ha/2))/ha)-((n1*d2P)/2);
% SPv = dsolve(v==0, P(0)==P0, dP(0)==dP0)
[VFv,Subsv] = odeToVectorField(v);
vfun = matlabFunction(VFv, 'Vars',{t,Y})
producing:
vfun =
function_handle with value:
@(t,Y)[Y(2);Y(2)+(sqrt(3.0).*Y(2).^2.*1.92299994911867e2)./(Y(1).*(6.759429983029036e2./Y(1)+1.0./Y(1).^2.*1.58397981106159e2-2.884500097018271e3))-(sqrt(3.0).*Y(1).*Y(2).^2.*1.92299994911867e2)./(6.759429983029036e2./Y(1)+1.0./Y(1).^2.*1.58397981106159e2-2.884500097018271e3)]
or, more conveniently (with a bit of manual editing):
vfun = @(t,Y) [Y(2);Y(2)+(sqrt(3.0).*Y(2).^2.*1.92299994911867e2)./(Y(1).*(6.759429983029036e2./Y(1)+1.0./Y(1).^2.*1.58397981106159e2-2.884500097018271e3))-(sqrt(3.0).*Y(1).*Y(2).^2.*1.92299994911867e2)./(6.759429983029036e2./Y(1)+1.0./Y(1).^2.*1.58397981106159e2-2.884500097018271e3)];

6 Comments

Ahmad Almasri
Ahmad Almasri on 6 Jan 2019
Edited: Ahmad Almasri on 6 Jan 2019
Thank you very much
But I need the function P(x) from equation (v) when v equal to zero
I don't see it in this solution
My pleasure.
It is automatically in the solution. Set your initial conditions to: [0; 0].
I'm sorry
but please can you give me the final answer of P(x) if P(0)=2 and P(1)=1
No apologies necessary!
Your differential equaiton is nonlinear, and only a few nonlinear differential equations have analytic solutions. (Yours is not one of them.)
You did not say that this was a boundary-value problem before.
Try this:
vfun = @(t,Y) [Y(2);Y(2)+sqrt(3.0).*Y(2).^2.*1.562241717104278e-2-((sqrt(3.0).*2.022457456864508e33-sqrt(3.0).*Y(1).*1.399056394183326e35).*Y(2).^2.*8.408108779363497e-19)./(Y(1).^2.*-1.982213373120368e18+Y(1).*4.645044914673847e17+1.088502637765406e17)+sqrt(3.0).*Y(1).*Y(2).^2.*6.666666266042039e-2];
twobc = @(ya,yb) [ ya(1) - 2; yb(1) - 1 ];
solinit = bvpinit(linspace(0,1,9),[-1 0]);
sol = bvp4c(vfun,twobc,solinit);
figure
plot(sol.x, sol.y)
grid
legend('$$P(x)$$', '$\frac{dP(x)}{dx}$', 'Location','W', 'Interpreter','latex')
This creates a numerical solution that the plot call then plots.
Thank you very much
As always, my pleasure.

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!