Ayers 'Differential Equations Problem 4

10 views (last 30 days)
Joseph Palumbo
Joseph Palumbo on 18 May 2024
Commented: Joseph Palumbo on 24 May 2024
Could you help me do this in MatLab , I have figured it out with paper and pencil, Ayer's Schaums Outline Problem 4 , I've tried putting the differential into dsolve but cannot prove the primitive or find the solution Ayers gets.
4. Show that (y-C)^2=Cx is the primitive of the differential equation 4x (dy/dx)^2+2x dy/dx-y = 0 and find the equations of the integral curves through the points 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)^2 = 0
When x=1,y=2: (2-C)^2 = C and C = 1,4
The equations of the integral curves through (1,2) are (y-1)^2 = x and (y-4)^2 = 4x
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% My own commentary
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The primitive is given as (y-C)^2=Cx
derivative of (y-C)^2 = -2C+2y = 2(y-C), derivative of Cx = C*1 =C
He puts the derivative of the unknown function which is dy/dx, as a factor in the primitive
derivative of (y-C)^2 * dy/dx = derivative of Cx thus: 2(y-C) * dy/dx = C
Now solve for dy/dx : divide each side by 2(y-C) which cancels 2(y-C) on the right :
dy/dx = C/2(y-C) then (dy/dx)^2 = C^2/(2(y-C))^2 = C^2/(4( y-C)^2)
Now plug the coordinates x=1 y=2 into (y-C)^2 = Cx : (2-C)^2 = C*1 which is
(2-C)^2 = C , (2-C)(2-C)=C : 4-2C-2C+C^2 = C : 4-4C+C^2=C :
C^2-4C+4 =C : -4C and 4 to the right C^2=C+4C-4 : C to the left
C^2-C=4C-4, 4C to the left C^2-4C-C=-4 collect common terms left C^2-5C = -4
which is quadratic, complete the square :
C^2-5C+2.5^2 = -4+2.5^2
(C-2.5)^2 = -4+6.25
(C-2.5)^2 = 2.25 , square root each side
C-2.5 = + - SquareRoot(2.25)
C = +1.5+2.5 or -1.5+2.5
C = 4 or 1
The Differential equation was given as : 4x * C^2/4(y-C)^2 + 2x * C/2(y-C) -y = 0
combine 4x and 2x with respective numerators (4x*C^2)/(4(y-C)^2) + (2x*C)/2(y-C) - y = 0
cancel 4 and 2 1st and 2nd fractions left side xC^2/(y-C)^2 + xC/(y-C) - y = 0
common denominator (y-C)^2
C^2x/(y-C)^2 + Cx(y-C)/(y-C)^2 - y(y-C)^2/(y-C)^2 = 0
Combine numerators (C^2x+Cx(y-C)-y(y-C)^2)/(y-C)^2 = 0
The Cx(y-C) term in numerator can be factored Cxy-CxC
(C^2x+Cxy-CxC-y(y-C)^2)/(y-C)^2 = (C^2x+Cxy-C^2x-y(y-C)^2)/(y-C)^2 = 0 cancel C^2x
(Cxy-y(y-C)^2)/((y-C)^2) factor Cxy and y(y-C)^2 = (y(Cx-(y-C)^2)/(y-C)^2

Answers (2)

Athanasios Paraskevopoulos
syms x y(x) C
% Define the differential equation
dy_dx = diff(y, x);
ode = 4*x*dy_dx^2 + 2*x*dy_dx - y == 0;
% Solve the differential equation
sol = dsolve(ode);
% Display the general solution
disp('General Solution:');
General Solution:
disp(sol);
% 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 first solution:');
Verifying the primitive for first solution:
simplify(subs(eq_primitive, y, sol_y1))
ans(x) = 
disp('Verifying the primitive for second solution:');
Verifying the primitive for second solution:
simplify(subs(eq_primitive, y, sol_y2))
ans(x) = 
% 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:');
Values of C:
disp(C1);
% Integral curves equations
disp('Integral curves equations:');
Integral curves equations:
for i = 1:length(C1)
eq_curve = (y - C1(i))^2 == C1(i)*x;
disp(eq_curve);
end
  4 Comments
Joseph Palumbo
Joseph Palumbo on 22 May 2024
I see you ran it on 2024(a) but mine is R2022(b) could this be the problem?
Joseph Palumbo
Joseph Palumbo on 22 May 2024
For some reason my earlier reply was not recorded:
I do not get 4C-2Sqrt(C1*x),4C+2Sqrt(C1*x),-x/4 and 0 for the general solution, rather I get 0 and 1/2+x/4, consequently I get
C == x|C == 0 for primitive of the 1st solution and (2 - 4*C + x)^2 == 16*C*x for primitive of 2nd solution
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
Everything else seems to be correct Thanks alot for helping me

Sign in to comment.


Joseph Palumbo
Joseph Palumbo on 24 May 2024
I think this might be it, hope I just didn't understand what given by others to help me, but possibly the problem is just an exercise in Mathematics not a real application problem, anyway I believe this is it:
clearvars
syms x y C
disp('The primitive was given as (y-C)^2=Cx')
disp("Justified by laws of Mahtematics to differentiate ")
disp("each term of the primitive and place the unknown differential dy/dx")
disp("to be solved for in as a factor thus diff((y-C)^2)*dy/dx=diff(Cx)")
disp("and solve algebraically")
% differentiate Cx answer to primitive
disp("diff(Cx)=")
D1=diff(C*x)
% differentiate (y-C)^2 of the primitive
disp("diff(y-C)^2)=")
D2=diff((y-C)^2)
disp("Now placing unknown dy/dx as a factor and solving for dy/dx")
% Solve the differential equation
D=D1/D2;
% display the general solution
disp("General Solution:");
D
% Prove the primitive
disp("If dy/dx = diff(Cx)/diff((y-C)^2) then the primitive which was (y-C)^2")
%disp("=Integrate(C/C/2(y-C)")
%D=int(2*(y-C),[y C])
% making the denominator negative changes signs thus -2C+2y which factors
% to 2(y-C) thus matching Ayres and the book : dy/dx=C/2(y-C)
% making the denominator negative changes signs thus -2C+2y which factors
% to 2(y-C) thus matching Ayres and the book : dy/dx=C/2(y-C)")
disp("if result is negative either numerator or denominator can be negative" )
disp("but not both making the denominator negative changes signs");
disp("to 2(y-C) thus matching Ayres and the book : dy/dx=C/2(y-C)")
% same being true here where -(C-y)^2 is actually (y-C)^2
disp("same being true here, where -(C-y)^2 is actually (y-C)^2")
D=D1/D2
Dcopy=D;
D=C/(2*(y-C)^2)
% Prove the primitive
disp("If dy/dx = diff(Cx)/diff((y-C)^2) then the primitive which was (y-C)^2")
disp("=Integrate(C/C/2(y-C)^2")
D=int(D1/Dcopy,[y C])
disp("Again negative changes signs within parenthesis thus -(C-y)^2=(y-C)^2")
prmitive=(y-C)^2
% 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

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!