How to Plot x[t] Versus y[t] in Mathematica?

Click For Summary
SUMMARY

The discussion focuses on plotting two functions, x[t] and y[t], derived from solving coupled equations in Mathematica. The correct method to plot these functions is using the ParametricPlot function with the syntax ParametricPlot[{x[t], y[t]} /. sol, {t, 0, 10}]. The user was initially confused due to an extra layer of curly braces around the functions, which prevented proper plotting. Utilizing the Trace[] function is recommended for debugging and understanding the issue.

PREREQUISITES
  • Familiarity with Mathematica syntax and functions
  • Understanding of ParametricPlot in Mathematica
  • Basic knowledge of solving coupled equations
  • Experience with function manipulation in Mathematica
NEXT STEPS
  • Explore the use of Trace[] in Mathematica for debugging
  • Learn more about ParametricPlot options and customization
  • Investigate coupled differential equations and their numerical solutions
  • Study advanced plotting techniques in Mathematica for better visualization
USEFUL FOR

Mathematica users, mathematicians, and engineers who are solving coupled equations and need to visualize their results effectively.

yashar
Messages
31
Reaction score
0
hi
i solve numerically two coupled equation and obtain two function x[t] and y[t].

how i plot x[t] versus y[t] so that horizontal axis to be x[t] and vertical axis to be y[t].

here is the notebook of mathematica
http://www.mediafire.com/?g4sa3zi630vi8nl

thanks
 
Last edited by a moderator:
Physics news on Phys.org
Compare
{x[t] /. sol, y[t] /. sol}
with
{x[t], y[t]} /. sol
and see that what you are doing has an extra layer of {} around your functions that ParametricPlot objects to.

So
ParametricPlot[{x[t], y[t]} /. sol, {t, 0, 10}]
should work for you.

It might be educational to track down exactly what happened and why it didn't work.
Trace[] could help you do that.
 

Similar threads

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