Differential Equation Ayers Chapter 2 problem 4

1 次查看(过去 30 天)
Here is my code:
% Verify that (y-C)^2=Cx is the primitive
eq_primitive=(y-C)^2==C*x;
% Substitute the general solution into the primitive equation
sol_y1=sol(1);
sol_y2=sol(2);
disp("Verifying the primitive for the first solution:");
simplify(subs(eq_primitive,y,sol_y1))
disp("Verifying the primitive for the second solution:");
simplify(subs(eq_primitive,y,sol_y2))
% C=xvC=0 output is really C == x|C == 0, I do not know what this means
% perhaps element wise 'or'
% Find the equations of the integral curves through the points x=1 y=2
x_val=1;
y_val=2;
C1=solve(subs((y-C)^2,{x,y},{x_val,y_val})==C*x_val,C);
disp("Values of C");
disp(C1);
% Integral Curves Equations
disp("Integral curves equations:");
for i=1:length(C1)
eq_curve=(y-C1(i))^2==C1(i)*x;
disp(eq_curve);
end
Here is my output
diff(y(x), x)
General Solution:
[sym(0); sym(1/2) + x/4]
Verifying the primitive for the first solution:
C == x|C == 0
Verifying the primitive for the second solution:
(2 - 4*C + x)^2 == 16*C*x
Values of C
[sym(1); sym(4)]
Integral curves equations:
(y(x) - 1)^2 == x
(y(x) - 4)^2 == 4*x
  2 个评论
Joseph Palumbo
Joseph Palumbo 2024-5-22
How do I solve the general solution, prove the primitive
Joseph Palumbo
Joseph Palumbo 2024-5-22
The problem was from Ayers Differential equations Schaums Outline Chap. 2 problem 4
Show that (y-C)^2=Cx is the primitive of the differential equation 4x*(dx/dy)^2 + 2xdy/dx – y=0
And find the equations of the integral curves through the point (x=1 y=2)
Here 2(y-C)dy/dx = C and dy/dx=C/(2(y-C)
Then 4xC^2/4(y-C)^2 + 2xC/(2(y-C)) – y = C^2x+Cx(y-C)-y(y-C)^2/(y-C)^2= y(Cx-(y-C)^2)/(y-C)62=0
When x=1,y=2 : (2-C)^2=C and C=1,4
The equations of the integral curves through (x=1,y=2) are (y-1)^2=x and (y-4)^2=4x
Graciously helped me with the last parts of it, but the general solution I cannot get the same thing as he does and proving the primitive I do not get the same as he does, he used R2024(A) I’m using R2022(b),
But I do not understand the answers he gets, I showed the code and the output I get.
I want to thank everybody for even reading this and trying to help---- Joseph Palumbo

请先登录,再进行评论。

回答(1 个)

Arnav
Arnav 2024-9-11
You outlined 2 tasks in the comments:
  • Showing that is the primitive of the differential equation
This can be done in the following steps:
syms x y C;
x = solve((y - C)^2 == C*x, x);
dy_dx = 1 / diff(x,y);
diff_eq = 4*x*(dy_dx)^2 + 2*x*dy_dx - y;
LHS = simplify(diff_eq) %Verify that LHS simplifies to 0 i.e. RHS
LHS = 
0
It can be verified that the LHS simplifies to 0. Hence, the given curve is the primitive of the differential equation.
  • Finding particular solutions that pass through the point .
This is handled in the code you provided. In particular, the solve statement:
C_values = solve(subs((y - C)^2, {x, y}, {x_val, y_val}) == C*x_val, C);
is calculating the values of C that satisfies the equation after the values of x and y are substituted into the primitive curve.
To learn more about how solve function works, you may refer here:

类别

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

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by