Solve ODEs in Mathematica w/ (2xy-5)dx+(x^2+y^2)dy=0 and y(3)=1

In summary, the conversation involves a student seeking help with solving an equation using Mathematica. They have already solved it by hand but need assistance with using the software to get a solution. They discuss rearranging the equation and adding initial conditions to the DSolve command. The student also mentions using vectorplot to plot the specific solution.
  • #1
pat666
709
0

Homework Statement



I have solved this by hand but we are also required to get Mathematica to spit out a solution and I need some help.

[tex] (2xy-5)dx+(x^2+y^2)dy=0 , y(3)=1 [/tex]

Homework Equations





The Attempt at a Solution


I know the command is DSolve but I don't know how to put in dx or dy. Also I know that Mathematica may not be able to solve this analytically and in that case we use direction fields but I also need some help with that.

Hope someone here knows Mathematica!

Thanks
 
Physics news on Phys.org
  • #2
I guess you could rearrange to get

[tex]\frac{5 - 2xy(x)}{x^2+y(x)^2} = \frac{dy}{dx} = y'(x),[/tex]​

and see if Mathematica accepts that as a valid ODE.
 
  • #3
Hey, It gave me about 5 unique solutions, do you know how to put in initial conditions?

Thanks
 
  • #4
To add initial conditions you use a list in {} with things like y[3]==1 or y'[0]==1:

DSolve[{y'[x] == -(2 x y[x] - 5)/(x^2 + y[x]^2), y[3] == 1}, y, x]

Note: The Math&Science Software section usually has most of the software syntax questions.
 
  • #5
Hey Bill, thanks for the reply. I put that in Mathematica and it doesn't do anything??
 
  • #6
This without initial conditions
DSolve[{y'[x] == -(2 x y[x] - 5)/(x^2 + y[x]^2)}, y, x]
gives me 3 solutions with being an C[1] an arbitrary constant.
This with your initial condition
DSolve[{y'[x] == -(2 x y[x] - 5)/(x^2 + y[x]^2), y[3] == 1}, y, x]
seems to stun it.
Perhaps you could take each solution and solve for C[1] given your initial condition.
Can you figure out how to do that?
 
  • #7
I can just rewrite 1 and solve I gues, I'm playing with "vectorplot" at the moment to see if I can plot the specific solution.
 

FAQ: Solve ODEs in Mathematica w/ (2xy-5)dx+(x^2+y^2)dy=0 and y(3)=1

How do I input the given ODE into Mathematica?

To input the given ODE into Mathematica, use the command "DSolve[{(2x*y-5)dx+(x^2+y^2)dy==0, y(3)==1}, y, x]". This will return the general solution in terms of the constant C.

How do I find the particular solution for the given initial condition?

To find the particular solution for the given initial condition, use the command "DSolve[{(2x*y-5)dx+(x^2+y^2)dy==0, y(3)==1}, y, x] /. C -> 1". This will substitute the value of C in the general solution and give you the particular solution.

How can I plot the solution curve for the given ODE?

To plot the solution curve for the given ODE, first obtain the particular solution using the above command. Then, use the command "Plot[y[x] /. sol, {x, x1, x2}]", where x1 and x2 are the desired range for x values. This will give you a plot of y versus x.

Can I change the initial condition and plot the corresponding solution curve?

Yes, you can change the initial condition by substituting a different value for y(3) in the given ODE. Then, use the same commands as mentioned above to find the particular solution and plot the corresponding solution curve.

Is there a way to solve the given ODE using numerical methods in Mathematica?

Yes, you can use the command "NDSolve[{(2x*y-5)dx+(x^2+y^2)dy==0, y(3)==1}, y, {x, x1, x2}]" to solve the ODE using numerical methods in Mathematica. Here, x1 and x2 are the desired range for x values. This will give you a numerical approximation of the solution curve.

Back
Top