Python How can velocity be plotted in Vpython?

  • Thread starter Thread starter e2m2a
  • Start date Start date
  • Tags Tags
    Plotting Velocity
AI Thread 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 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.
 
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.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
3
Views
2K
Replies
9
Views
3K
Replies
2
Views
4K
Replies
14
Views
2K
Replies
11
Views
2K
Replies
7
Views
3K
Replies
3
Views
2K
Back
Top