How can velocity be plotted in Vpython?

  • Context: Python 
  • Thread starter Thread starter e2m2a
  • Start date Start date
  • Tags Tags
    Plotting Velocity
Click For Summary
SUMMARY

This discussion focuses on plotting velocity as a function of time in VPython, a 3D graphics library for Python. Users noted that while VPython documentation primarily covers position plotting, velocity can be derived from position data. To plot velocity, one must compute the derivative of the position function with respect to time or calculate numerical derivatives from position data arrays. The conversation emphasizes the need for users to perform these calculations manually, as VPython does not automate this process.

PREREQUISITES
  • Understanding of VPython for 3D plotting
  • Basic knowledge of calculus, specifically derivatives
  • Familiarity with numerical methods for derivative calculation
  • Experience with Python programming
NEXT STEPS
  • Learn how to compute numerical derivatives in Python
  • Explore VPython documentation for advanced plotting techniques
  • Investigate the use of Matplotlib for 2D graphing
  • Study calculus concepts related to derivatives and their applications in programming
USEFUL FOR

This discussion is beneficial for Python developers, educators in physics, and anyone interested in visualizing motion through velocity plotting in VPython.

e2m2a
Messages
354
Reaction score
13
TL;DR
Can't find any documentation on how to plot/graph velocity as a function of time in vpython.
Can someone tell me how to plot/graph velocity in vpython? All the documentation I see just deals with plotting the position of the object, nothing on plotting the velocity.
 
Technology news on Phys.org
e2m2a said:
Summary:: Can't find any documentation on how to plot/graph velocity as a function of time in vpython.

Can someone tell me how to plot/graph velocity in vpython? All the documentation I see just deals with plotting the position of the object, nothing on plotting the velocity.
I don't understand your quandary. If you are able to plot position vs. time, why can't you also plot velocity vs. time? I'm not familiar with vpython, but it seems to be concerned mostly with 3D plots. If all you need is a 2D graph, you might consider using matplotlib with Python.
 
Given the position as a function of time, you need to somehow compute the velocity as a function of time.
If you have an algebraic expression, then you have to take a derivative with respect to t, then plot that resulting function.
If you have a position data in an array, then you have to effectively the compute numerical derivatives akin to \Delta x/\Delta t. (You may be used to other software that does that "automatically"... but that's because that software is doing that behind the scenes. Here in VPython, you have to do it yourself [or find a routine that does it].
 
robphy said:
Given the position as a function of time, you need to somehow compute the velocity as a function of time.
My assumption was that the velocities at the various times were known.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
Replies
2
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K