How do you plot nonhomogeous equations in Mathematica?

  • Context: Mathematica 
  • Thread starter Thread starter yitriana
  • Start date Start date
  • Tags Tags
    Mathematica Plot
Click For Summary
SUMMARY

The discussion focuses on plotting nonhomogeneous equations using Mathematica. The correct implementation involves using the NDSolve function to solve the differential equation y'[x] == y[x] Cos[x + y[x]] with the initial condition y[0] == 1. The solution is then plotted over the interval {x, 0, 30} using the Plot function. The provided code snippet successfully demonstrates this process.

PREREQUISITES
  • Familiarity with Mathematica programming language
  • Understanding of differential equations and initial value problems
  • Knowledge of the NDSolve function in Mathematica
  • Experience with plotting functions in Mathematica
NEXT STEPS
  • Explore advanced features of NDSolve in Mathematica
  • Learn about different types of differential equations in Mathematica
  • Investigate the use of Manipulate for dynamic plotting in Mathematica
  • Study the implications of nonhomogeneous equations in mathematical modeling
USEFUL FOR

Mathematics students, researchers in applied mathematics, and anyone interested in solving and visualizing differential equations using Mathematica.

yitriana
Messages
35
Reaction score
0
NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1}, y, {x, 0, 30}]

i attempted this, but it didn't work.
 
Physics news on Phys.org
Try this:

Code:
sol1 = NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1}, y, {x, 0, 30}];
Plot[y[x] /. sol1, {x, 0, 30}]
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
8
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K