Optimizing DE Solutions with Mathematica: Plotting x[t] vs. t"

  • Mathematica
  • Thread starter Nusc
  • Start date
  • Tags
    Mathematica
In summary, the conversation discusses using the DSolve and NDSolve functions to solve a differential equation with a symbolic variable \[Alpha]. The user encounters an error message and is advised to use NDSolve with a numerical value for \[Alpha]. The output is an InterpolatingFunction which can be plotted using the Plot function.
  • #1
Nusc
760
2
DSolve[{x'[t] == (\[Alpha] - (x[t] - 1)^2) x[t], x[0] == 0.004}, x[t],
t]


I get the following message:
Solve::tdep: The equations appear to involve the variables to be solved for in an essentially non-algebraic way. >>

DSolve::bvnul: For some branches of the general solution, the given boundary conditions lead to an empty solution. >>


What do I do?

I need to plot the solution.
 
Physics news on Phys.org
  • #2
If you just need the plot, you can try solving it numerically.

NDSolve[{x'[t] == (\[Alpha] - (x[t] - 1)^2) x[t], x[0] == 0.004}, x[t], {t, 0, 10}]

(note how you need to specify an interval)
 
  • #3
I get the following:

NDSolve::ndnum: Encountered non-numerical value for a derivative at t == 0.`. >>
 
  • #4
Ah right, my mistake.
You can only solve it numerically if the entire expression is numerical. It chokes on \[Alpha] being symbolic, if you plug in a value for \[Alpha] it does work, e.g.

Code:
Block[ { \[Alpha] = 1 },
  NDSolve[{x'[t] == (\[Alpha] - (x[t] - 1)^2) x[t], x[0] == 0.004}, x[t], {t, 0, 10}]
]

Will that do for you, or do you need an exact solution?
 
  • #5
I receive the following:

{{x[t] -> \!\(\*
TagBox[
RowBox[{"InterpolatingFunction", "[",
RowBox[{
RowBox[{"{",
RowBox[{"{",
RowBox[{"0.`", ",", "10.`"}], "}"}], "}"}], ",", "\<\"<>\"\>"}], "]"}],
False,
Editable->False]\)[t]}}

I can set the value for alpha but I don't obtain a numerical solution. Then I have to plot the solution.
 
  • #6
Code:
s = NDSolve[{x'[t] == (4 - (x[t] - 1)^2) x[t], x[0] == 0.004}, 
  x[t], {t, 0, 10}]
Plot[Evaluate[x[t] /. s], {t, 0, 10}, PlotRange -> All]


notice you have to put in something for alpha, like previously stated. i did 4.
 

1. What is the purpose of optimizing differential equation (DE) solutions with Mathematica?

The purpose of optimizing DE solutions with Mathematica is to find the most accurate and efficient solution to a given differential equation. This can be useful for a variety of scientific and engineering applications where precise and speedy solutions are required.

2. How does Mathematica help in optimizing DE solutions?

Mathematica has built-in functions and algorithms specifically designed for solving and optimizing DEs. It also allows for easy visualization and manipulation of the solutions, making it a powerful tool for optimizing DE solutions.

3. Can Mathematica handle complex DE solutions?

Yes, Mathematica has the capability to handle both simple and complex DE solutions. It can handle a wide range of DEs, including those with multiple variables, initial conditions, and boundary conditions.

4. How does plotting x[t] vs. t help in optimizing DE solutions?

Plotting x[t] vs. t allows for a visual representation of the solution, which can help in identifying any errors or inaccuracies. It also helps in comparing different solutions and determining the most optimal one.

5. Is Mathematica the only software that can optimize DE solutions?

No, there are other software programs that can also optimize DE solutions. However, Mathematica is widely used and well-known for its capabilities in solving and optimizing DEs, making it a popular choice among scientists and engineers.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
Back
Top