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

Discussion Overview

The discussion centers on how to plot or graph velocity as a function of time using VPython, with participants expressing confusion over the available documentation and methods for achieving this task.

Discussion Character

  • Technical explanation, Conceptual clarification, Debate/contested

Main Points Raised

  • One participant requests guidance on plotting velocity in VPython, noting that existing documentation primarily addresses position plotting.
  • Another participant questions the initial query, suggesting that if position can be plotted, velocity should also be plottable, and proposes using matplotlib for 2D graphs if needed.
  • A different participant explains that to plot velocity, one must compute it from the position data, either through differentiation of an algebraic expression or by calculating numerical derivatives from position data arrays.
  • One participant expresses an assumption that velocity values at various times are already known, indicating a potential misunderstanding or different approach to the problem.

Areas of Agreement / Disagreement

Participants do not appear to reach a consensus on the best method for plotting velocity in VPython, with differing views on the assumptions regarding available data and the necessity of computation.

Contextual Notes

There are limitations regarding the assumptions about the availability of velocity data and the methods for computing it, which may depend on the specific context of the user's application 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