Plotting 2(or more) functions at once

Click For Summary
SUMMARY

This discussion focuses on plotting multiple functions simultaneously in Mathematica, specifically using the functions x^2 and x^3 over specified intervals. The solution involves creating individual plots for each function and then combining them using the Show function. The provided code snippets demonstrate the correct implementation: g1 = Plot[x^2, {x, 0, 1}]; g2 = Plot[x^3, {x, 1, 2}]; Show[g1, g2>. This method effectively visualizes the equations of motion for a bouncing ball.

PREREQUISITES
  • Familiarity with Mathematica syntax and functions
  • Understanding of plotting functions in Mathematica
  • Basic knowledge of mathematical functions and their graphical representations
  • Concept of piecewise functions and their applications
NEXT STEPS
  • Explore advanced plotting techniques in Mathematica, such as Plot3D
  • Learn about dynamic visualizations using Manipulate in Mathematica
  • Investigate the use of piecewise functions for more complex motion scenarios
  • Study the principles of physics related to projectile motion and bouncing balls
USEFUL FOR

This discussion is beneficial for Mathematica users, educators in mathematics and physics, and anyone interested in visualizing mathematical functions and physical phenomena through graphical representation.

karkas
Messages
131
Reaction score
1
Hey all, I want to ask a simple question that I can't seem to get answered myself. How is it possible to get Mathematica to plot 2 functions at once? As in, I want to have x^2 {x,0,1} and x^3 {x,1,2} in the same plot graph.

More specifically, what I'm trying to do is plot the y-t graph of a ball bouncing on the ground, and I'm thinking of doing so by combining the equations of motion for every discrete stage of the bouncing.

Any help is greatly appreciated.
 
Physics news on Phys.org
g1 = Plot[x^2, {x, 0, 1}];
g2 = Plot[x^3, {x, 1, 2}];
Show[g1, g2]

If it isn't clear whether it is working then substitute x^3-1 for a moment
 
Bill Simpson said:
g1 = Plot[x^2, {x, 0, 1}];
g2 = Plot[x^3, {x, 1, 2}];
Show[g1, g2]

If it isn't clear whether it is working then substitute x^3-1 for a moment

Thanks a huge ton. It was clear as hell, didn't think of that.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K