Python How can velocity be plotted in Vpython?

  • Thread starter Thread starter e2m2a
  • Start date Start date
  • Tags Tags
    Plotting Velocity
Click For Summary
To plot velocity in VPython, one must first understand that while the documentation primarily focuses on position, velocity can be derived from position data. If you can plot position versus time, you can also plot velocity by calculating it as the derivative of position with respect to time. This can be done either by using an algebraic expression for position and differentiating it or by computing numerical derivatives from position data stored in an array. Unlike some other software that may automate this process, VPython requires users to manually compute the velocity or find a routine to assist with this calculation.
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.
 
Anthropic announced that an inflection point has been reached where the LLM tools are good enough to help or hinder cybersecurity folks. In the most recent case in September 2025, state hackers used Claude in Agentic mode to break into 30+ high-profile companies, of which 17 or so were actually breached before Anthropic shut it down. They mentioned that Clause hallucinated and told the hackers it was more successful than it was...

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 3 ·
Replies
3
Views
2K