Why is Mathematica struggling to solve this ODE with a known analytic solution?

  • Mathematica
  • Thread starter member 428835
  • Start date
  • Tags
    Mathematica
In summary, the conversation discusses a differential equation in Mathematica that cannot be solved, despite knowing that an analytic solution exists. The equation is rewritten in a different form and solutions are obtained using NDSolve and Wolfram Alpha, but with different initial conditions. It is suggested that the key to solving the equation is to rewrite it in a way that Mathematica recognizes.
  • #1
member 428835
Hi PF!

I am wondering if any of you can explain why Mathematica won't solve this ODE? I know an analytic solution exists (it's quadratic). Any help is greatly appreciated! $f0[x]$ is the name of the function.

Code:
a = -1/5;
DSolve[{-((2 a f0[x])/(1 + a)) + x f0'[x] + 
    2 (f0'[x])^2 + f0[x] f0''[x] == 0, 
  f0[1] == 0, f0'[1] == -1/2}, f0[x], x]
 
Physics news on Phys.org
  • #2
Some hints to improve your post.
Give us the exact differential equation in LaTeX. having to "translate" hardly readable mathematica code doesn't help getting answers.
You say you know an analytic solution exists, do you know the form as well?

More on topic, have you tried NDSolve to see if mathematica can work with the DE and gives a reasonable result?
 
  • #3
$$f f''+2f'^2+x f'+\frac{1}{2}f = 0$$ where ##f## is a function of ##x## subject to ##f(1)=0## and ##f'(1)=-1/2##. The analytic solution is ##f=(1-x^2)/2##.

I have tried NDSolve and it works great, provided I perturb the boundary condition as ##f(1)=0.00001##.

Any ideas why it can't figure out the solution?
 
  • #4
So I've been looking at this for a bit.

First I would get rid of the factor of ##f## from the second derivative term.
From that I would be led to believe you could consider ##g = f^\prime/\sqrt{f}## as a new variable.

##g^\prime = \frac{f^{\prime\prime}}{\sqrt{f}} - \frac{f^\prime}{f}##
Then ##f^{\prime\prime} = \left(g^\prime+\frac{f^\prime}{f}\right)\sqrt{f}##
So we can rewrite your DE as

##\sqrt{f}\left(g^\prime + g\right) + 2 \left(g^\prime\right)^2+xg+\frac{1}{2} = 0##

That's where I got stuck, maybe this gives you some ideas.
I think the key is rewriting the equation such that mathematica recognizes it.
Also wolfram alpha gave me a solution (for different initial values) although no analytical expression.
Since wolfram alpha uses mathematica in the back this is promising.
 
  • Like
Likes member 428835
  • #5
Are u sure the solution of that differential equation is really [itex] f=(1-x^2)/2[/itex]? I didn't get it because the initial condition of this solution is not same as you mentioned and actually it is [itex] f'(1)=-1[/itex].

I think the factor [itex]1/2[/itex] is missing. However, still I can't get the solution same as you. That's interesting.
 

FAQ: Why is Mathematica struggling to solve this ODE with a known analytic solution?

Why is Mathematica not solving my equation?

There could be several reasons why Mathematica is not solving your equation. Some possible reasons include: incorrect syntax, missing or conflicting assumptions, insufficient precision, or a bug in the software. It's important to carefully check your input and make sure all assumptions are explicitly stated before seeking further help.

How can I improve the performance of Mathematica's solving function?

There are several ways to improve the performance of Mathematica's solving function. One option is to use the Assumptions option to specify any known constraints or assumptions about the variables in your equation. You can also try using the Simplify or FullSimplify functions to simplify your equation before solving. Additionally, increasing the PrecisionGoal or AccuracyGoal options can often lead to more accurate and efficient solutions.

Is there a limit to the complexity of equations that Mathematica can solve?

Yes, there are limits to the complexity of equations that Mathematica can solve. The software relies on a combination of algorithms and heuristics to find solutions, so extremely complex equations may require more time or memory to solve. In some cases, Mathematica may not be able to find a closed-form solution and will return the equation in its current form instead.

Can Mathematica solve differential equations?

Yes, Mathematica has powerful functions for solving both symbolic and numerical differential equations. The DSolve function can be used for solving symbolic differential equations, while the NDSolve function is used for numerical solutions. It's important to carefully specify the initial conditions and any other relevant parameters when using these functions.

What should I do if Mathematica cannot solve my equation?

If Mathematica is unable to solve your equation, there are a few steps you can take. First, make sure your input is correct and all assumptions are explicitly stated. If the equation is too complex, try simplifying it before solving. You can also try using different solving functions or adjusting the options for the solving function. If all else fails, you may need to seek help from a mathematician or try a different software tool.

Similar threads

Replies
1
Views
2K
Replies
19
Views
1K
Replies
3
Views
2K
Replies
1
Views
1K
Replies
1
Views
1K
Replies
5
Views
3K
Replies
2
Views
2K
Replies
12
Views
4K
Replies
4
Views
2K
Back
Top