Mathematica Solutions for First Order Differential Equation

Mathematica has Solve and Reduce that are great at taking equations and solving them for one or more of the variables present, but it isn't so good at taking equations and rearranging them. It can be done, but it is messy. I'll show you how I would do it. Others may have a better way. I won't use your explicit solution because it is hard to type. I'll use the one Mathematica found. I also won't use your initial condition because it makes Mathematica return an implicit solution with arbitrary constant. I'll use a different initial condition. I'll solve for the arbitrary constant in the implicit solution that Mathematica found. Then I'll use the solution for
  • #1
pat666
709
0
Mathematica Disagrees with ME!

Homework Statement


(2xy-5)dx+(x^2+y^2)dy=0 y(3)=1


Homework Equations





The Attempt at a Solution


Ive solved this by hand and now where required to get Mathematica to solve to.
My solution: [tex] -17/3=x^2y-5x+y^3/3 [/tex]
I've attached what mathematica has done. Now the question
Am I wrong ?
Is my code wrong?
Is mathematica wrong?

Thanks

P.S I rearranged to this form to sick in mathematica:
dy/dx=(-2xy+5)/(x^2+y^2)
 

Attachments

  • mathematica.png
    mathematica.png
    38.5 KB · Views: 472
Physics news on Phys.org
  • #2


Your thumbnail is too small for me to be able to read. In any case, your work is correct. You can verify it by doing two things:
1) Checking that the initial condition is satisfied; i.e., that when x = 3 and y = 1, then x2y - 5x + y3/3 = -17/3 is a true statement.
2) Differentiating the equation x2y - 5x + y3/3 = -17/3 implicitly to arrive at the differential equation dy/dx = (5 - 2xy)/(x2 + y2).

Checking a solution to a differential equation is something you should do as a matter of course. You've already done all the hard work. It's only a little more work to verify that your work is correct.
 
  • #3


good to know that I did it right by hand, do you know the correct mathematica code so that it will do it.

Thanks
 
  • #5


That mathematica output looks correct. The cubic in y has been factored, what kind of output were you expecting?
 
  • #6


one the same as mine---- is that not possible here?
 
  • #7


pat666 said:

Homework Statement


(2xy-5)dx+(x^2+y^2)dy=0 y(3)=1


Homework Equations





The Attempt at a Solution


Ive solved this by hand and now where required to get Mathematica to solve to.
My solution: [tex] -17/3=x^2y-5x+y^3/3 [/tex]
I've attached what mathematica has done. Now the question
Am I wrong ?
Is my code wrong?
Is mathematica wrong?

Thanks

P.S I rearranged to this form to sick in mathematica:
dy/dx=(-2xy+5)/(x^2+y^2)

Mathematica did a little more work than you did.

What you have is a third order equation of y.
Mathematica solved it to be of the form y = f(x).
I haven't checked it, but it looks about right: 1 real solution and 2 imaginary ones.
Presumably you can rewrite the first solution to match your solution.

I'm not a Mathematica specialist, but I suspect it is not equipped to output the kind of solution you gave.
 
  • #9


pat666: your solution from sec. 3 of the OP does not satisfy the initial condition y(3)=1
 
  • #10


pat666: Delete previous post. The initial condition is satisfied.
 
  • #11


At least with the version of Mathematica I'm using, I believe it returns exactly the same result with or without the initial condition y(3)=1, containing an arbitrary constant denoted by C[1] by Mathematica. That is odd. If I'm not mistaken then usually with a first order differential equation and a single initial condition it is sufficient to eliminate the arbitrary constants. And I've never seen another differential equation behave like this when given to DSolve, but I obviously haven't seen everything DSolve can do. As others have pointed out, you found an implicit solution for y(x) where Mathematica factored the cubic to find three explicit solutions. Two of those when I attempt to solve for C[1] using your initial condition have no solution. The third does does satisfy your differential equation and your initial condition, so it isn't clear why Mathematica didn't return only that solution with arbitrary constant solved for. If I experiment with changing your initial condition I can provoke error messages in some cases and get it to return a single solution with no arbitrary constant in some others. I don't know what it is about your example that makes it do this. And I have no answer for your final question, how to turn an explicit solution into the implicit form that you found by hand.
 

FAQ: Mathematica Solutions for First Order Differential Equation

What is Mathematica and why does it disagree with me?

Mathematica is a computational software program used for mathematical, scientific, and engineering calculations. It uses algorithms and mathematical functions to solve complex equations and analyze data. If Mathematica disagrees with you, it means that the calculations or data you have inputted may be incorrect or there may be a mistake in your code.

Why is it important to understand why Mathematica disagrees with me?

It is important to understand why Mathematica disagrees with you because it helps to identify and correct any errors in your calculations or code. This ensures accurate and reliable results, which is crucial in scientific research and analysis.

What are some common reasons for Mathematica to disagree with me?

Some common reasons for Mathematica to disagree with you include incorrect formatting or syntax errors in your code, incorrect input of variables or data, and using incorrect mathematical functions or algorithms for your specific problem.

How can I troubleshoot and resolve issues when Mathematica disagrees with me?

To troubleshoot and resolve issues when Mathematica disagrees with you, you can carefully check your code for errors, double check your input data and variables, and consult the documentation or online forums for tips and solutions. You can also reach out to experienced Mathematica users or contact Wolfram Technical Support for assistance.

Can Mathematica's disagreement with me be a learning opportunity?

Yes, Mathematica's disagreement with you can be a valuable learning opportunity. By identifying and understanding the reasons for the disagreement, you can improve your coding skills and gain a deeper understanding of the mathematical concepts and functions used in Mathematica. This can help you to avoid similar issues in the future and become a more proficient user of the software.

Similar threads

Back
Top