# Plot the general and a particular solution for this differential equation

In a previous question, I had obtained a differential equation from:

Starts with this implicit equation:

(x - a)^2 + y^2 == 1(1) ( circles on x -axis ) $$(x-a)^2+y^2=1$$

Is the set of equations of the given circles. This set contains one parameter namely a. So, it is the solution set of a differential equation of the first order.

NOTE: see my previous question for additional details how the differential equation is derived

This differential equation : DSolve[y[x]^2*Derivative[1][y][x]^2 == 1 - y[x]^2, {y[x]}, {x}]

Is a general solution : how to plot the general solution and a particular solution for say in the origin (0,0) ? (type ODE ?: first order))

EDIT The integralcurves

• The general solution is a family of solutions. How do you want to plot these? Only particular solutions can be plotted. Apr 29 at 10:40
• (x - a)^2 + y^2 == 1 is a implicit equation, and for some values of parameter a i can plot these circles Now it is a ODE with parameter C to plot, Apr 29 at 10:53

Draw the slope field for the general solution. There are two solutions. Pick one

ClearAll[y,x];
ode = y[x]^2*y'[x]^2 == 1 - y[x]^2;
sol = Solve[ode, y'[x]]


Lets try the second one

fld = VectorPlot[{1, Sqrt[1 - y^2]/y}, {x, -3, 3}, {y, -2, 2},
VectorColorFunction -> None, VectorStyle -> Gray]


Add a particular solution by specifying a solution curve that passes through a point. Try {1,1}

fld = VectorPlot[{1, Sqrt[1 - y^2]/y}, {x, -3, 3}, {y, -2, 2},
VectorColorFunction -> None, VectorStyle -> Gray,
StreamPoints -> {1, 1}]


You can try different particular solutions by changing the stream point location. See help for many more options.

Picking a point that the solution curve passes through is like picking a value for your a parameter. You are basically saying you want to look at some particular solution curve.

See drawing-lines-on-differential-equation-slope-field for more examples.

• Nasser, thanks. you use y', while i have used y. Its a family of circles with centre on x-axis. The other y' gives another part of the circle Apr 29 at 11:00
• @janhardo I am using VectorPlot which uses the form $y'=f(x,y)$ to plot the solution curves. It has nothing to do with your implicit solution. Apr 29 at 11:04
• Another idea is to use the general solutions with C : a example : Table[y[t] /. %[[1]] /. C[1] -> n, {n, -500, 500, 50}] Apr 29 at 11:07
• Nasser: quote "It has nothing to do with your implicit solution." ? I ended up with a differential equation.. Apr 29 at 11:10
• @janhardo Yes, you can always do it manually like this. But the whole point is that VectorField will plot the solution curves for you without having to solve the ODE at all. You can not just plot the general solution as it has unknowns. VectorField shows family of solution curves. You use StreamPoints to basically highlight one of these solution curves, which correspond to one particular solution curve. Apr 29 at 11:10

Manipulate parameters to get overview

eq = (x - a)^2 + y^2 == 1;

deq = D[eq /. y -> y[x], x]

eq /. y -> y[x] /. x -> a

(*   y[a]^2 == 1   *)

ysol[a_] = y /. DSolve[{deq, y[a]^2 == 1}, y, x]

(*   {Function[{x}, -Sqrt[1 - a^2 + 2 a x - x^2]],
Function[{x}, Sqrt[1 - a^2 + 2 a x - x^2]]}   *)

Manipulate[
Plot[Evaluate[Through[ysol[a][x]]], {x, -3, 3}, PlotRange -> 3,
AspectRatio -> 1], {{a, -2}, -3, 3, Appearance -> "Labeled"}]


• Akku14,thanks for this dynamic plot. I added a picture at the question, and it are all circles. In your example it is a circle with center (-2,0) and radius 1 for a circle It looks a ellipse now ;) Apr 29 at 19:01
• Add AspectRatio -> 1  to Plot to get equal scaling for x and y achses. Changed it now. Apr 29 at 19:07
• It is an ingenious plot you have made and so again adapted by you, nicely done I'm not doing it after you :). Challencing too is to plot these integralcurves ( circles) in a directionfield ( don't know how to do this yet ) Apr 29 at 19:39
The text passage contains a mathematical question related to plotting the general and particular solutions of a differential equation. It also includes a discussion and an example of how to plot the particular solution using Mathematica code.
single_question_with_answer
Given a text passage, determine:
    1. If it contains a mathematical question (including word problems or calculations)
    2. If an answer to that mathematical question is provided in the text

First, describe the content structure you found in 1-2 sentences.

Then provide your analysis in the following format:
TYPE: <one of the following values>
- NO_QUESTION
- SINGLE_QUESTION
- SINGLE_QUESTION_WITH_ANSWER
- MULTIPLE_QUESTIONS
- MULTIPLE_QUESTIONS_WITH_ANSWERS
system
# Plot the general and a particular solution for this differential equation

In a previous question, I had obtained a differential equation from:

Starts with this implicit equation:

(x - a)^2 + y^2 == 1(1) ( circles on x -axis ) $$(x-a)^2+y^2=1$$

Is the set of equations of the given circles. This set contains one parameter namely a. So, it is the solution set of a differential equation of the first order.

NOTE: see my previous question for additional details how the differential equation is derived

This differential equation : DSolve[y[x]^2*Derivative[1][y][x]^2 == 1 - y[x]^2, {y[x]}, {x}]

Is a general solution : how to plot the general solution and a particular solution for say in the origin (0,0) ? (type ODE ?: first order))

EDIT The integralcurves

• The general solution is a family of solutions. How do you want to plot these? Only particular solutions can be plotted. Apr 29 at 10:40
• (x - a)^2 + y^2 == 1 is a implicit equation, and for some values of parameter a i can plot these circles Now it is a ODE with parameter C to plot, Apr 29 at 10:53

Draw the slope field for the general solution. There are two solutions. Pick one

ClearAll[y,x];
ode = y[x]^2*y'[x]^2 == 1 - y[x]^2;
sol = Solve[ode, y'[x]]


Lets try the second one

fld = VectorPlot[{1, Sqrt[1 - y^2]/y}, {x, -3, 3}, {y, -2, 2},
VectorColorFunction -> None, VectorStyle -> Gray]


Add a particular solution by specifying a solution curve that passes through a point. Try {1,1}

fld = VectorPlot[{1, Sqrt[1 - y^2]/y}, {x, -3, 3}, {y, -2, 2},
VectorColorFunction -> None, VectorStyle -> Gray,
StreamPoints -> {1, 1}]


You can try different particular solutions by changing the stream point location. See help for many more options.

Picking a point that the solution curve passes through is like picking a value for your a parameter. You are basically saying you want to look at some particular solution curve.

See drawing-lines-on-differential-equation-slope-field for more examples.

• Nasser, thanks. you use y', while i have used y. Its a family of circles with centre on x-axis. The other y' gives another part of the circle Apr 29 at 11:00
• @janhardo I am using VectorPlot which uses the form $y'=f(x,y)$ to plot the solution curves. It has nothing to do with your implicit solution. Apr 29 at 11:04
• Another idea is to use the general solutions with C : a example : Table[y[t] /. %[[1]] /. C[1] -> n, {n, -500, 500, 50}] Apr 29 at 11:07
• Nasser: quote "It has nothing to do with your implicit solution." ? I ended up with a differential equation.. Apr 29 at 11:10
• @janhardo Yes, you can always do it manually like this. But the whole point is that VectorField will plot the solution curves for you without having to solve the ODE at all. You can not just plot the general solution as it has unknowns. VectorField shows family of solution curves. You use StreamPoints to basically highlight one of these solution curves, which correspond to one particular solution curve. Apr 29 at 11:10

Manipulate parameters to get overview

eq = (x - a)^2 + y^2 == 1;

deq = D[eq /. y -> y[x], x]

eq /. y -> y[x] /. x -> a

(*   y[a]^2 == 1   *)

ysol[a_] = y /. DSolve[{deq, y[a]^2 == 1}, y, x]

(*   {Function[{x}, -Sqrt[1 - a^2 + 2 a x - x^2]],
Function[{x}, Sqrt[1 - a^2 + 2 a x - x^2]]}   *)

Manipulate[
Plot[Evaluate[Through[ysol[a][x]]], {x, -3, 3}, PlotRange -> 3,
AspectRatio -> 1], {{a, -2}, -3, 3, Appearance -> "Labeled"}]


• Akku14,thanks for this dynamic plot. I added a picture at the question, and it are all circles. In your example it is a circle with center (-2,0) and radius 1 for a circle It looks a ellipse now ;) Apr 29 at 19:01
• Add AspectRatio -> 1  to Plot to get equal scaling for x and y achses. Changed it now. Apr 29 at 19:07
• It is an ingenious plot you have made and so again adapted by you, nicely done I'm not doing it after you :). Challencing too is to plot these integralcurves ( circles) in a directionfield ( don't know how to do this yet ) Apr 29 at 19:39
user
The text passage contains a mathematical question related to plotting the general and particular solutions of a differential equation. It also includes a discussion and an example of how to plot the particular solution using Mathematica code.

TYPE: SINGLE_QUESTION_WITH_ANSWER