As my work on prime_pi and nth_prime is drawing to a close, William
Stein and I have discussed the possibility of me making a graphical
physics program to be included in Sage, the free open source math
program.
An example of the desired functionality is to either with a few lines
of code from within a Sage worksheet, or by clicking buttons in a
graphical user interface (GUI) create a physics problem with
components such as ramps, blocks, balls, pulleys, and springs, and
processes such as motion (translational or rotational), collisions
(elastic, inelastic, completely inelastic), and forces (friction,
gravity, normal forces, driving forces, etc).
I am expecting the VIGRE grant from the National Science Foundation
(NSF) to support my work, so I will be able to devote a lot of time to
this project.
I would like to obtain any and all suggestions for what features,
functionality etc. could be included in this program. Please don't be
afraid to contribute an idea. No suggestion is too large or too
small.
A few of the possible ideas that I have come up with so far:
Allowing time to be solved for-e.g. exactly how long does it take for
an event to occur, such as for velocity to reach 0.
Using multi-precision arithmetic and error analysis to solve a problem
to a specified accuracy-e.g. what is the velocity of an object at a
certain time to the 100th decimal (for problems that don't include too
much chaos).
Creating a human readable physics problem specification language that
allows the locations and properties of each component to be specified
(perhaps similar to standard circuit specification languages).
Allow matrices, systems of DEs, tables of values, etc that describe
the physics problem to be accessed with Sage commands.
Symbolic solving for problems that lend themselves to symbolic
solving.
Plotting variables such as velocity, kinetic energy etc. with respect
to time.
Plotting more complicated functions such as the amount of time a block
takes to slide to the bottom of a ramp with respect to the ramp's
angle.
Make architecture easily extensible so new components can be made by
the user
Three dimensional graphics and problems (after 2D is finished)
On Tue, Sep 22, 2009 at 11:14 AM, kstueve <kevin.stu...@gmail.com> wrote: > An example of the desired functionality is to either with a few lines > of code from within a Sage worksheet, or by clicking buttons in a > graphical user interface (GUI) create a physics problem with > components such as ramps, blocks, balls, pulleys, and springs, and > processes such as motion (translational or rotational), collisions > (elastic, inelastic, completely inelastic), and forces (friction, > gravity, normal forces, driving forces, etc).
It originated at Carnegie Mellon as a program to teach undergraduate physics such that with very little code (and critically, no 3d programming or OpenGL knowledge), one could
create a physics problem with
> components such as ramps, blocks, balls, pulleys, and springs, and > processes such as motion (translational or rotational), collisions > (elastic, inelastic, completely inelastic), and forces (friction, > gravity, normal forces, driving forces, etc).
:)
Even if it doesn't fit precisely your needs, it's probably good inspiration and has been around for ~ 9 years. I've used it (the old version) for small demos and it's really nice.
On Tue, Sep 22, 2009 at 12:27 PM, Fernando Perez <fperez....@gmail.com> wrote:
> On Tue, Sep 22, 2009 at 11:14 AM, kstueve <kevin.stu...@gmail.com> wrote: >> An example of the desired functionality is to either with a few lines >> of code from within a Sage worksheet, or by clicking buttons in a >> graphical user interface (GUI) create a physics problem with >> components such as ramps, blocks, balls, pulleys, and springs, and >> processes such as motion (translational or rotational), collisions >> (elastic, inelastic, completely inelastic), and forces (friction, >> gravity, normal forces, driving forces, etc).
> It originated at Carnegie Mellon as a program to teach undergraduate > physics such that with very little code (and critically, no 3d > programming or OpenGL knowledge), one could
> create a physics problem with >> components such as ramps, blocks, balls, pulleys, and springs, and >> processes such as motion (translational or rotational), collisions >> (elastic, inelastic, completely inelastic), and forces (friction, >> gravity, normal forces, driving forces, etc).
> :)
> Even if it doesn't fit precisely your needs, it's probably good > inspiration and has been around for ~ 9 years. I've used it (the old > version) for small demos and it's really nice.
Thanks for pointing that out. So far, I've noticed Kevin is very good at taking existing things and plugging them together.
Maybe he could provide an AJAX-style web-based interface to some vpython functionality?
William Stein wrote: > Maybe he could provide an AJAX-style web-based interface to some > vpython functionality?
Since we also already have momentum for incorporating mayavi, we should also point out the mayavi tvtk "visual" module, whose api is modeled after vpython:
On Tue, Sep 22, 2009 at 11:14 AM, kstueve <kevin.stu...@gmail.com> wrote:
> As my work on prime_pi and nth_prime is drawing to a close, William > Stein and I have discussed the possibility of me making a graphical > physics program to be included in Sage, the free open source math > program.
> An example of the desired functionality is to either with a few lines > of code from within a Sage worksheet, or by clicking buttons in a > graphical user interface (GUI) create a physics problem with > components such as ramps, blocks, balls, pulleys, and springs, and > processes such as motion (translational or rotational), collisions > (elastic, inelastic, completely inelastic), and forces (friction, > gravity, normal forces, driving forces, etc).
> I am expecting the VIGRE grant from the National Science Foundation > (NSF) to support my work, so I will be able to devote a lot of time to > this project.
> I would like to obtain any and all suggestions for what features, > functionality etc. could be included in this program. Please don't be > afraid to contribute an idea. No suggestion is too large or too > small.
> A few of the possible ideas that I have come up with so far:
> Allowing time to be solved for-e.g. exactly how long does it take for > an event to occur, such as for velocity to reach 0.
> Using multi-precision arithmetic and error analysis to solve a problem > to a specified accuracy-e.g. what is the velocity of an object at a > certain time to the 100th decimal (for problems that don't include too > much chaos).
> Creating a human readable physics problem specification language that > allows the locations and properties of each component to be specified > (perhaps similar to standard circuit specification languages).
> Allow matrices, systems of DEs, tables of values, etc that describe > the physics problem to be accessed with Sage commands.
> Symbolic solving for problems that lend themselves to symbolic > solving.
I spent a while thinking that I was going to be a mechanical engineer,
and took a few of the ME intro courses. Engineering statics and
dynamics can be phrased entirely in terms of linear algebra, though
the courses I took didn't present them as such. Materials analysis is
highly computational in nature and could be interesting. When I took
these courses, I'd spend about 1-2 hours a week programming my TI
calculator to do my homework, and about 5 minutes actually doing my
homework (for the record, my professors were aware of, and pleased as
punch with this approach).
When I took the physics prerequisites for these courses, the problems
we had to do were 1-2 variable toys. The engineering homework
frequently had a number of rigid bodies in motion relative to one
another -- and involved solving systems of linear equations in 6-10
variables. If I were you, I'd look through Hibbeler's texts for
"typical" problems that it should be easy to input and solve. In
fact, you can borrow my copy some time, if you like.
On Tue, Sep 22, 2009 at 11:14 AM, kstueve <kevin.stu...@gmail.com> wrote:
> As my work on prime_pi and nth_prime is drawing to a close, William
> Stein and I have discussed the possibility of me making a graphical
> physics program to be included in Sage, the free open source math
> program.
> An example of the desired functionality is to either with a few lines
> of code from within a Sage worksheet, or by clicking buttons in a
> graphical user interface (GUI) create a physics problem with
> components such as ramps, blocks, balls, pulleys, and springs, and
> processes such as motion (translational or rotational), collisions
> (elastic, inelastic, completely inelastic), and forces (friction,
> gravity, normal forces, driving forces, etc).
> I am expecting the VIGRE grant from the National Science Foundation
> (NSF) to support my work, so I will be able to devote a lot of time to
> this project.
> I would like to obtain any and all suggestions for what features,
> functionality etc. could be included in this program. Please don't be
> afraid to contribute an idea. No suggestion is too large or too
> small.
> A few of the possible ideas that I have come up with so far:
> Allowing time to be solved for-e.g. exactly how long does it take for
> an event to occur, such as for velocity to reach 0.
> Using multi-precision arithmetic and error analysis to solve a problem
> to a specified accuracy-e.g. what is the velocity of an object at a
> certain time to the 100th decimal (for problems that don't include too
> much chaos).
> Creating a human readable physics problem specification language that
> allows the locations and properties of each component to be specified
> (perhaps similar to standard circuit specification languages).
> Allow matrices, systems of DEs, tables of values, etc that describe
> the physics problem to be accessed with Sage commands.
> Symbolic solving for problems that lend themselves to symbolic
> solving.
> Plotting variables such as velocity, kinetic energy etc. with respect
> to time.
> Plotting more complicated functions such as the amount of time a block
> takes to slide to the bottom of a ramp with respect to the ramp's
> angle.
> Make architecture easily extensible so new components can be made by
> the user
> Three dimensional graphics and problems (after 2D is finished)
<jason-s...@creativetrax.com> wrote: > Since we also already have momentum for incorporating mayavi, we should > also point out the mayavi tvtk "visual" module, whose api is modeled > after vpython:
> I've used vpython too, and I thought it was really nice and simple.
Prabhu may comment with more information, but in the meantime, it's worth keeping in mind that 'tvisual' has significantly lower performance than visual, and in this case I'm not sure it can be fixed. The issue is that the traits event handling machinery proves to be too much overhead when you're trying to render a 3d scene at interactive framerates, and the geometry is already being computed by a python loop. Since tvtk is based on traits, all the traits machinery is still active and in this case may be a bit too much.
If memory serves me right, Prabhu wasn't super optimistic about being able to match vpython performance with tvisual, but I could (and would love to) be misremembering, or perhaps it's just a matter of putting manpower into it and not a fundamental limitation.
I just mention it so you are aware that out of the box, tvisual's performance is just not enough to be usable like vpython is (and I only tested it on fairly simple examples).
In case you'd like to run a simple comparison (and perhaps things have improved), I'm attaching a simple example of parabolic motion written both for vpython (old version) and tvtk/visual. Caveat: I haven't run this code in years, so I'm not sure it runs with today's vpython or tvtk.
>> I've used vpython too, and I thought it was really nice and simple.
> Prabhu may comment with more information, but in the meantime, it's > worth keeping in mind that 'tvisual' has significantly lower > performance than visual, and in this case I'm not sure it can be > fixed. The issue is that the traits event handling machinery proves > to be too much overhead when you're trying to render a 3d scene at > interactive framerates, and the geometry is already being computed by > a python loop. Since tvtk is based on traits, all the traits machinery > is still active and in this case may be a bit too much.
Thanks Fernando. The speed issue is still true but I wouldn't blame traits since that isn't the source of the bottleneck. I think there are a little too many events and too many renders. I have not had the time to profile it carefully.
> If memory serves me right, Prabhu wasn't super optimistic about being > able to match vpython performance with tvisual, but I could (and would > love to) be misremembering, or perhaps it's just a matter of putting > manpower into it and not a fundamental limitation.
I am not sure at all, since I haven't had the chance to look closely enough but it is possible that there are too many events flying around calling too much Python code.
> In case you'd like to run a simple comparison (and perhaps things have > improved), I'm attaching a simple example of parabolic motion written > both for vpython (old version) and tvtk/visual. Caveat: I haven't run > this code in years, so I'm not sure it runs with today's vpython or > tvtk.
It does and visually there is no difference but there is an order of magnitude speed difference between the two in terms of CPU time.
Fernando Perez wrote: > On Tue, Sep 22, 2009 at 11:14 AM, kstueve <kevin.stu...@gmail.com> wrote: >> An example of the desired functionality is to either with a few lines >> of code from within a Sage worksheet, or by clicking buttons in a >> graphical user interface (GUI) create a physics problem with >> components such as ramps, blocks, balls, pulleys, and springs, and >> processes such as motion (translational or rotational), collisions >> (elastic, inelastic, completely inelastic), and forces (friction, >> gravity, normal forces, driving forces, etc).
> It originated at Carnegie Mellon as a program to teach undergraduate > physics such that with very little code (and critically, no 3d > programming or OpenGL knowledge), one could
> create a physics problem with >> components such as ramps, blocks, balls, pulleys, and springs, and >> processes such as motion (translational or rotational), collisions >> (elastic, inelastic, completely inelastic), and forces (friction, >> gravity, normal forces, driving forces, etc).
> :)
> Even if it doesn't fit precisely your needs, it's probably good > inspiration and has been around for ~ 9 years. I've used it (the old > version) for small demos and it's really nice.
On Wed, Sep 23, 2009 at 4:41 AM, Prabhu Ramachandran
<pra...@aero.iitb.ac.in> wrote: > Thanks Fernando. The speed issue is still true but I wouldn't blame > traits since that isn't the source of the bottleneck. I think there are > a little too many events and too many renders. I have not had the time > to profile it carefully.
Thanks for the clarifications, Prabhu. I remembered the performance drop, but wasn't sure what all of the reasons were under the hood and I was worried I could misrepresent the issue.
It would really be great to have vpython-like performance with the clean tvtk api! Here's to hoping it's possible :)
Have any of you heard of Erik Neumann? He published some excellent
Java physics demos at http://www.myphysicslab.com/ He is in Seatle,
and has attended UW.
I have been looking into vector graphics with javascript. It appears
that circles, lines, and other curves are made out of lots of div
elements (to represent pixels and groups of pixels), most likely using
a third party library, such as jsDraw2D (see
http://ajax.phpmagazine.net/2009/04/jsdraw2d_javascript_graphics_l.html).
I don't want to add confusion, but I hope you can also think about the
similarity between mechanical and electrical problems. After all, it's
always matter of solving differential equations, having voltage,
current, and so on, instead of mechanical quantities.
The good thing, from this perspective, is that you could take some
inspiration from the hundreds of SPICE tools, which already provide a
GUI to define electrical problems. If you transpose the analogous of a
netlist into something mechanical, you maybe already have a good
starting point, which also gives you compatibility to electrical
problem (which I would like :P).
Just to give a rough idea, you could read:
http://www.analog-europe.com/207200675 (this is just after some google search, but there are thousands of
references about circuit solvers).
The good thing, in my opinion, is that there is already a standard
notation for netlists. Maybe you could introduce the mechanical
equivalent of those :)
Regards
Maurizio
On 23 Ott, 22:05, kstueve <kevin.stu...@gmail.com> wrote:
> Have any of you heard of Erik Neumann? He published some excellent
> Java physics demos athttp://www.myphysicslab.com/ He is in Seatle,
> and has attended UW.
> I have been looking into vector graphics with javascript. It appears
> that circles, lines, and other curves are made out of lots of div
> elements (to represent pixels and groups of pixels), most likely using
> a third party library, such as jsDraw2D (seehttp://ajax.phpmagazine.net/2009/04/jsdraw2d_javascript_graphics_l.html).
On Sep 22, 6:25 pm, Tom Boothby <tomas.boot...@gmail.com> wrote:
> I spent a while thinking that I was going to be a mechanical engineer,
> and took a few of the ME intro courses. Engineering statics and
> dynamics can be phrased entirely in terms of linear algebra, though
> the courses I took didn't present them as such.
I've never had any ME courses and I'm also not very knowledgeable in
dynamical systems or physics, but I thought it was untrue that
linearization of the phase space is adequate to describe the dynamics
if the phase space isn't structurally stable:
http://en.wikipedia.org/wiki/Hartman-Grobman_theorem
Define a coordinate system and naming convention such that "a"
corresponds to body "a", "b" corresponds to body "b", prime refers to
final values, a lack of a prime refers to an initial value, "x" refers
to the axis perpendicular to the plane of collision, and "y" refers to
the axis parallel to the plane of collision. Define A and B to be the
contact points of bodies a and b.
For the initial value problem, there are 6 unknowns (the final x and y
velocities and final angular velocities of each body), and there
should be 6 equations.
Because there is friction, energy is not necessarily conserved.
Let me propose the 6 equations:
1) coefficient of restitution equation: c = (vbx' - vax') / (vax -
vbx)
2) conservation of x momentum (on linked page)
3) conservation of y momentum (on linked page)
4) conservation of angular momentum about the center of mass (on
linked page)
Now integrate with respect to time the friction equation Ff = mu * Fn
(force of friction equals coefficient of friction times the normal
force) and applying the result to either point A or B.
Impulse due to friction (y-axis) = mu * x-axis impulse
Impulse due to friction (y-axis) = mu * delta x momentum
If the y components of the velocities of points A and B are equal, the
impulse due to friction on either point is automatically 0 (providing
the last two equations). Otherwise, there is going to be an impulse
due to friction on both points.
mass * delta y velocity = mu * mass * delta x velocity
delta y velocity = mu * delta x velocity (whatever mass represents
here it cancels out)
5) Frictional impulse of body a: change in y component of linear
velocity of point A = mu * change in x component of linear velocity of
point A
6) Frictional impulse of body b: change in y component of linear
velocity of point B = mu * change in x component of linear velocity of
point B
Are these equations correct?"
I then replied to my own thread with "After reading more of the site,
I realize that equation 1 must refer to the converging and diverging
velocities of points A and B, not the center of mass of body a or b."
On Sep 22, 10:14 am, kstueve <kevin.stu...@gmail.com> wrote:
> As my work on prime_pi and nth_prime is drawing to a close, William
> Stein and I have discussed the possibility of me making a graphical
> physics program to be included in Sage, the free open source math
> program.
> An example of the desired functionality is to either with a few lines
> of code from within a Sage worksheet, or by clicking buttons in a
> graphical user interface (GUI) create a physics problem with
> components such as ramps, blocks, balls, pulleys, and springs, and
> processes such as motion (translational or rotational), collisions
> (elastic, inelastic, completely inelastic), and forces (friction,
> gravity, normal forces, driving forces, etc).
> I am expecting the VIGRE grant from the National Science Foundation
> (NSF) to support my work, so I will be able to devote a lot of time to
> this project.
> I would like to obtain any and all suggestions for what features,
> functionality etc. could be included in this program. Please don't be
> afraid to contribute an idea. No suggestion is too large or too
> small.
> A few of the possible ideas that I have come up with so far:
> Allowing time to be solved for-e.g. exactly how long does it take for
> an event to occur, such as for velocity to reach 0.
> Using multi-precision arithmetic and error analysis to solve a problem
> to a specified accuracy-e.g. what is the velocity of an object at a
> certain time to the 100th decimal (for problems that don't include too
> much chaos).
> Creating a human readable physics problem specification language that
> allows the locations and properties of each component to be specified
> (perhaps similar to standard circuit specification languages).
> Allow matrices, systems of DEs, tables of values, etc that describe
> the physics problem to be accessed with Sage commands.
> Symbolic solving for problems that lend themselves to symbolic
> solving.
> Plotting variables such as velocity, kinetic energy etc. with respect
> to time.
> Plotting more complicated functions such as the amount of time a block
> takes to slide to the bottom of a ramp with respect to the ramp's
> angle.
> Make architecture easily extensible so new components can be made by
> the user
> Three dimensional graphics and problems (after 2D is finished)
Thanks. I just bought Hibbeler's "Engineering Mechanics: Statics" and
"Engineering Mechanics: Dynamics" on Amazon. I saved 99% (and spent
$1.57 + 2 * 3.99) because I bought old editions.
Kevin Stueve
On Sep 22, 2:25 pm, Tom Boothby <tomas.boot...@gmail.com> wrote:
> I spent a while thinking that I was going to be a mechanical engineer,
> and took a few of the ME intro courses. Engineering statics and
> dynamics can be phrased entirely in terms of linear algebra, though
> the courses I took didn't present them as such. Materials analysis is
> highly computational in nature and could be interesting. When I took
> these courses, I'd spend about 1-2 hours a week programming my TI
> calculator to do my homework, and about 5 minutes actually doing my
> homework (for the record, my professors were aware of, and pleased as
> punch with this approach).
> When I took the physics prerequisites for these courses, the problems
> we had to do were 1-2 variable toys. The engineering homework
> frequently had a number of rigid bodies in motion relative to one
> another -- and involved solving systems of linear equations in 6-10
> variables. If I were you, I'd look through Hibbeler's texts for
> "typical" problems that it should be easy to input and solve. In
> fact, you can borrow my copy some time, if you like.
> On Tue, Sep 22, 2009 at 11:14 AM, kstueve <kevin.stu...@gmail.com> wrote:
> > As my work on prime_pi and nth_prime is drawing to a close, William
> > Stein and I have discussed the possibility of me making a graphical
> > physics program to be included in Sage, the free open source math
> > program.
> > An example of the desired functionality is to either with a few lines
> > of code from within a Sage worksheet, or by clicking buttons in a
> > graphical user interface (GUI) create a physics problem with
> > components such as ramps, blocks, balls, pulleys, and springs, and
> > processes such as motion (translational or rotational), collisions
> > (elastic, inelastic, completely inelastic), and forces (friction,
> > gravity, normal forces, driving forces, etc).
> > I am expecting the VIGRE grant from the National Science Foundation
> > (NSF) to support my work, so I will be able to devote a lot of time to
> > this project.
> > I would like to obtain any and all suggestions for what features,
> > functionality etc. could be included in this program. Please don't be
> > afraid to contribute an idea. No suggestion is too large or too
> > small.
> > A few of the possible ideas that I have come up with so far:
> > Allowing time to be solved for-e.g. exactly how long does it take for
> > an event to occur, such as for velocity to reach 0.
> > Using multi-precision arithmetic and error analysis to solve a problem
> > to a specified accuracy-e.g. what is the velocity of an object at a
> > certain time to the 100th decimal (for problems that don't include too
> > much chaos).
> > Creating a human readable physics problem specification language that
> > allows the locations and properties of each component to be specified
> > (perhaps similar to standard circuit specification languages).
> > Allow matrices, systems of DEs, tables of values, etc that describe
> > the physics problem to be accessed with Sage commands.
> > Symbolic solving for problems that lend themselves to symbolic
> > solving.
> > Plotting variables such as velocity, kinetic energy etc. with respect
> > to time.
> > Plotting more complicated functions such as the amount of time a block
> > takes to slide to the bottom of a ramp with respect to the ramp's
> > angle.
> > Make architecture easily extensible so new components can be made by
> > the user
> > Three dimensional graphics and problems (after 2D is finished)
To sage-dev
Can someone please explain to me what traits are in the context of
tvisual? The wiki page for it (http://www.enthought.com/traits from
the page https://svn.enthought.com/enthought/wiki/TVTKIntroduction) is
a dead link.
A google search of either vpython.org or svn.enthought.com produces
many results for visual, but none for tvisual. I am guessing that
tvisual is part of TVTK and visual part of VPython.
Jason Grout said "Since we also already have momentum for
incorporating mayavi.." Can someone please give me details. Is Jason
saying that Sage-dev is in the process of making mayavi part of Sage,
so it would be easy to use parts of mayavi?
What are the benefits of using tvtk over vpython? Vpython is faster.
How does Tvtk has a cleaner API?
Does pydy handle collisions and contact forces? I have read papers
that say that calculating contact forces for a large number of
simultaneously contacting rigid bodies is an NP-hard problem that
involves quadratic programming. There is lots of interdependency.
You can have a normal force and friction force at each contact point.
But you have to make sure that normal forces only push, not pull, and
you have to make sure that kinetic friction opposes motion (or pending
motion), and static friction is less than mu * Fn. During a collision
you have to have an infinite force for an instant to keep the objects
from colliding. If you take the time integral of force, you get
impulse, which is a change in momentum (mass times velocity), so what
you are basically saying is that you have an instantaneous transfer of
momentum. If you have an ellipse roll, the normal force will increase
sharply to a maximum at the location of least curvature. If you have
a "rounded square" defined by a certain equation, the normal force
will reach infinity at the location of zero curvature. However, the
area under the curve is finite, meaning that an instantaneous impulse
is not occurring. You just need a very good numerical integrator.
Including kinetic friction can lead to situations where an
instantaneous impulse is needed to prevent inter-penetration at times
other than a collision. Additionally, in some cases there are
multiple allowed solutions for where the objects go.
I have considered using the penalty method for handling collisions,
which involves allowing inter-penetration and a virtual spring force
that appears during inter-penetration. However very large spring
constants must be used, leading to stiff equations. One benefit of
penalty methods is that the multiple solutions in impulse methods go
away-which solution you end up with depends on whether the objects
that are touching are inter-penetrating or just touching.
I am also considering handling only collisions between two objects at
a time (with rotation and friction), since most problems I want PPS
(PythonPhysicsSimulation) to handle would be covered. One problem
that might be left out is two gliders on a track colliding, but for
this problem, you could lock the gliders to the track and consider the
gliders hitting as collision of two bodies, not three. I think that
if you are careful, you could properly handle the gliders on a track
colliding with only two-object collision handling.
What I want to make is a program that does for freshman physics
(springs, ramps, collisions, rotation, pulleys, strings, etc) what my
circuit program at circuitengine.com does for freshman circuits (and
hopefully more). You click a button and make a spring, ramp, block,
pulley etc. You right click an object and adjust its properties. You
hit start. You can make graphs. You can ask it to tell you how long
it takes for something to happen (e.g. height of object A is 10m), and
it uses some sort of decrease and conquer (binary search in the worst
case, but better can be done if we make an estimate of when the event
happens) to find the exact time that that happens.
Could anyone recommend any programs that have this sort of
functionality for me to look at?
Does anyone have any thoughts on using OpenModelica?
Another question:
Time permitting, I would like to be able to solve symbolic physics
problems. Instead of just giving initial conditions and solving for
later values, it would be nice to say (symbolically) "it takes t
seconds for the ball to reach the basket, at what angle was it
thrown". How might you go about this? I think that this could be
done using a theorem prover of sorts that searches the space of
theorems that can be proven from a small set of axioms and givens and
a set of manipulation rules. Of course this is an NP-complete problem
that is intractable in general (think Fermat's last theorem), but most
problems given to freshman physics students are only a few steps long,
meaning that the tree of possible proofs is relatively small and can
be exhaustively searched.
Does Sage have the ability to symbolically simplify "sin^2(theta)+cos^2
(theta)" to "1"?
For numeric problems such as "at what angle must the ball be thrown to
reach the basket in 2 seconds?", it might be possible to use some sort
of binary search to find the correct value.
> On Wed, Sep 23, 2009 at 4:41 AM, Prabhu Ramachandran
> <pra...@aero.iitb.ac.in> wrote:
> > Thanks Fernando. The speed issue is still true but I wouldn't blame
> > traits since that isn't the source of the bottleneck. I think there are
> > a little too many events and too many renders. I have not had the time
> > to profile it carefully.
> Thanks for the clarifications, Prabhu. I remembered the performance
> drop, but wasn't sure what all of the reasons were under the hood and
> I was worried I could misrepresent the issue.
> It would really be great to have vpython-like performance with the
> clean tvtk api! Here's to hoping it's possible :)
On Fri, Nov 13, 2009 at 5:09 PM, kstueve <kevin.stu...@gmail.com> wrote:
> To sage-dev
> Can someone please explain to me what traits are in the context of
> tvisual? The wiki page for it (http://www.enthought.com/traits from
> the page https://svn.enthought.com/enthought/wiki/TVTKIntroduction) is
> a dead link.
> A google search of either vpython.org or svn.enthought.com produces
> many results for visual, but none for tvisual. I am guessing that
> tvisual is part of TVTK and visual part of VPython.
> Jason Grout said "Since we also already have momentum for
> incorporating mayavi.." Can someone please give me details. Is Jason
> saying that Sage-dev is in the process of making mayavi part of Sage,
> so it would be easy to use parts of mayavi?
No. To the best of my knowledge nobody is working on including
mayavai + vtk in Sage. VTK is quite difficult to build, to put it
mildly.
> What are the benefits of using tvtk over vpython? Vpython is faster.
> How does Tvtk has a cleaner API?
Note that tvtk and vpython don't work via a web browser. Part of the
challenge of Sage -- and the opportunity -- is making capabilities
available via a webpage. For that, the only options are javascript
(=AJAX) or Java.
> Does anyone have any thoughts on using OpenModelica?
It's license is GPL-incompatible. However, I've been told they are in
the process of changing their license to be GPL-compatible. I hope
this happens.
> Another question:
> Time permitting, I would like to be able to solve symbolic physics
> problems. Instead of just giving initial conditions and solving for
> later values, it would be nice to say (symbolically) "it takes t
> seconds for the ball to reach the basket, at what angle was it
> thrown". How might you go about this? I think that this could be
> done using a theorem prover of sorts that searches the space of
> theorems that can be proven from a small set of axioms and givens and
> a set of manipulation rules. Of course this is an NP-complete problem
> that is intractable in general (think Fermat's last theorem),
Fermat's last theorem has nothing to do with NP complete problems, as
far as I know. What connection were you thinking of? I'm curious.
I'm also confused as to what doing physics symbolically has to do with
theorem provers.
> but most
> problems given to freshman physics students are only a few steps long,
> meaning that the tree of possible proofs is relatively small and can
> be exhaustively searched.
> Does Sage have the ability to symbolically simplify "sin^2(theta)+cos^2
> (theta)" to "1"?
> For numeric problems such as "at what angle must the ball be thrown to
> reach the basket in 2 seconds?", it might be possible to use some sort
> of binary search to find the correct value.
> On Sep 23, 3:31 pm, Fernando Perez <fperez....@gmail.com> wrote:
>> On Wed, Sep 23, 2009 at 4:41 AM, Prabhu Ramachandran
>> <pra...@aero.iitb.ac.in> wrote:
>> > Thanks Fernando. The speed issue is still true but I wouldn't blame
>> > traits since that isn't the source of the bottleneck. I think there are
>> > a little too many events and too many renders. I have not had the time
>> > to profile it carefully.
>> Thanks for the clarifications, Prabhu. I remembered the performance
>> drop, but wasn't sure what all of the reasons were under the hood and
>> I was worried I could misrepresent the issue.
>> It would really be great to have vpython-like performance with the
>> clean tvtk api! Here's to hoping it's possible :)
>> Cheers,
>> f
-- William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org
> On Fri, Nov 13, 2009 at 5:09 PM, kstueve <kevin.stu...@gmail.com> wrote:
> > To sage-dev
> > Can someone please explain to me what traits are in the context of
> > tvisual? The wiki page for it (http://www.enthought.com/traitsfrom > > the pagehttps://svn.enthought.com/enthought/wiki/TVTKIntroduction) is
> > a dead link.
> > A google search of either vpython.org or svn.enthought.com produces
> > many results for visual, but none for tvisual. I am guessing that
> > tvisual is part of TVTK and visual part of VPython.
> > Jason Grout said "Since we also already have momentum for
> > incorporating mayavi.." Can someone please give me details. Is Jason
> > saying that Sage-dev is in the process of making mayavi part of Sage,
> > so it would be easy to use parts of mayavi?
> No. To the best of my knowledge nobody is working on including
> mayavai + vtk in Sage. VTK is quite difficult to build, to put it
> mildly.
> > What are the benefits of using tvtk over vpython? Vpython is faster.
> > How does Tvtk has a cleaner API?
> Note that tvtk and vpython don't work via a web browser. Part of the
> challenge of Sage -- and the opportunity -- is making capabilities
> available via a webpage. For that, the only options are javascript
> (=AJAX) or Java.
> > Does anyone have any thoughts on using OpenModelica?
> It's license is GPL-incompatible. However, I've been told they are in
> the process of changing their license to be GPL-compatible. I hope
> this happens.
> > Another question:
> > Time permitting, I would like to be able to solve symbolic physics
> > problems. Instead of just giving initial conditions and solving for
> > later values, it would be nice to say (symbolically) "it takes t
> > seconds for the ball to reach the basket, at what angle was it
> > thrown". How might you go about this? I think that this could be
> > done using a theorem prover of sorts that searches the space of
> > theorems that can be proven from a small set of axioms and givens and
> > a set of manipulation rules. Of course this is an NP-complete problem
> > that is intractable in general (think Fermat's last theorem),
> Fermat's last theorem has nothing to do with NP complete problems, as
> far as I know. What connection were you thinking of? I'm curious.
Automated theorem proving is NP-complete (because the boolean
satisfiability problem (which is NP-complete) reduces to finding a
proof of satisfiability (and a proof of satisfiability will exist with
length a fixed polynomial of the size of the original boolean
satisfiability problem) and proofs can be verified in time polynomial
of the length of the proof). I gave Fermat's last theorem as an
example of the difficulty of finding the correct 300 page permutation
of symbols that represents a correct proof of a statement. Perhaps it
sounded as if I was discussing trying many potential integer solutions
to x^n+y^n=z^n, which is not what I meant.
Asking a computer to find a 300 page proof of a statement like
Fermat's last theorem by search is a bad idea. I think asking a
computer to find a 5 line solution to a simple symbolic physics
problem (the sort you find in freshman physics) might be a good idea.
I am curious about how trig_simplify works. "return self.parent()
(self._maxima_().trigexpand().trigsimp())"
It doesn't seem to use search. Does anyone know if there are any
components of Sage that use search by an automated theorem prover?
http://en.wikipedia.org/wiki/Automated_theorem_proving#Decidability_o...
> I'm also confused as to what doing physics symbolically has to do with
> theorem provers.
Theorem proving can be attacked by doing a search of all theorems that
follow from the axioms (although it will take time exponential in the
length of the theorem). Many physics problems are presented
effectively as a set of equations. Solving a set of equations
symbolically (that is designed to be solved symbolically by a student
in several steps) can be attacked by doing a search of the equations
that follow from the original equations for one that gives the value
in question. The analogy to theorem proving is strong-you might be
searching for an equation/theorem of the form "x = _____"
As an example of the sort of problem for which I think search might be
useful (problem 83 on page 81 from Tipler Physics for Scientists for
Engineers):
"At 1/2 of it's maximum height, the speed of a projectile is 3/4 of
its initial speed. What was its launch angle?"
This is a symbolic problem that cannot be solved by plugging values
into a projectile motion equation from an equation sheet.
Is there a better way to approach such problems from a programming
point of view? I guess for this problem, you could just employ some
sort of numerical educated guess and check/Newton's method/binary
search algorithm, but such a solution does not show work or steps and
it would be easy to find a similar problem that is entirely symbolic.
Correct me if I'm wrong, but I believe that the only way to solve a
problem like this is to write down what you know and manipulate it
until you arrive at a solution (which is a search problem).
> > but most
> > problems given to freshman physics students are only a few steps long,
> > meaning that the tree of possible proofs is relatively small and can
> > be exhaustively searched.
> > Does Sage have the ability to symbolically simplify "sin^2(theta)+cos^2
> > (theta)" to "1"?
> > For numeric problems such as "at what angle must the ball be thrown to
> > reach the basket in 2 seconds?", it might be possible to use some sort
> > of binary search to find the correct value.
> > On Sep 23, 3:31 pm, Fernando Perez <fperez....@gmail.com> wrote:
> >> On Wed, Sep 23, 2009 at 4:41 AM, Prabhu Ramachandran
> >> <pra...@aero.iitb.ac.in> wrote:
> >> > Thanks Fernando. The speed issue is still true but I wouldn't blame
> >> > traits since that isn't the source of the bottleneck. I think there are
> >> > a little too many events and too many renders. I have not had the time
> >> > to profile it carefully.
> >> Thanks for the clarifications, Prabhu. I remembered the performance
> >> drop, but wasn't sure what all of the reasons were under the hood and
> >> I was worried I could misrepresent the issue.
> >> It would really be great to have vpython-like performance with the
> >> clean tvtk api! Here's to hoping it's possible :)
> >> Cheers,
> >> f
> --
> William Stein
> Associate Professor of Mathematics
> University of Washingtonhttp://wstein.org
I need my program to have a graphical interface when run either
locally or on a remote server. My options are either JavaScript and
Java for the GUI front-end that communicates with the main Python
program.
Does anyone have any thoughts on using one over the other? Although
Java
has the drawback that it isn't as widespread and seamless as
JavaScript, it does have powerful graphics capabilities. Do you think
Java would produce smoother animation?
I would appreciate it if anyone has any links to JavaScript libraries
(or general suggestions on making a JavaScript GUI front-end that
communicates with a Python program) that might be helpful.
> To sage-dev
> Can someone please explain to me what traits are in the context of
> tvisual? The wiki page for it (http://www.enthought.com/traitsfrom > the pagehttps://svn.enthought.com/enthought/wiki/TVTKIntroduction) is
> a dead link.
> A google search of either vpython.org or svn.enthought.com produces
> many results for visual, but none for tvisual. I am guessing that
> tvisual is part of TVTK and visual part of VPython.
> Jason Grout said "Since we also already have momentum for
> incorporating mayavi.." Can someone please give me details. Is Jason
> saying that Sage-dev is in the process of making mayavi part of Sage,
> so it would be easy to use parts of mayavi?
> What are the benefits of using tvtk over vpython? Vpython is faster.
> How does Tvtk has a cleaner API?
> Does pydy handle collisions and contact forces? I have read papers
> that say that calculating contact forces for a large number of
> simultaneously contacting rigid bodies is an NP-hard problem that
> involves quadratic programming. There is lots of interdependency.
> You can have a normal force and friction force at each contact point.
> But you have to make sure that normal forces only push, not pull, and
> you have to make sure that kinetic friction opposes motion (or pending
> motion), and static friction is less than mu * Fn. During a collision
> you have to have an infinite force for an instant to keep the objects
> from colliding. If you take the time integral of force, you get
> impulse, which is a change in momentum (mass times velocity), so what
> you are basically saying is that you have an instantaneous transfer of
> momentum. If you have an ellipse roll, the normal force will increase
> sharply to a maximum at the location of least curvature. If you have
> a "rounded square" defined by a certain equation, the normal force
> will reach infinity at the location of zero curvature. However, the
> area under the curve is finite, meaning that an instantaneous impulse
> is not occurring. You just need a very good numerical integrator.
> Including kinetic friction can lead to situations where an
> instantaneous impulse is needed to prevent inter-penetration at times
> other than a collision. Additionally, in some cases there are
> multiple allowed solutions for where the objects go.
> I have considered using the penalty method for handling collisions,
> which involves allowing inter-penetration and a virtual spring force
> that appears during inter-penetration. However very large spring
> constants must be used, leading to stiff equations. One benefit of
> penalty methods is that the multiple solutions in impulse methods go
> away-which solution you end up with depends on whether the objects
> that are touching are inter-penetrating or just touching.
> I am also considering handling only collisions between two objects at
> a time (with rotation and friction), since most problems I want PPS
> (PythonPhysicsSimulation) to handle would be covered. One problem
> that might be left out is two gliders on a track colliding, but for
> this problem, you could lock the gliders to the track and consider the
> gliders hitting as collision of two bodies, not three. I think that
> if you are careful, you could properly handle the gliders on a track
> colliding with only two-object collision handling.
> What I want to make is a program that does for freshman physics
> (springs, ramps, collisions, rotation, pulleys, strings, etc) what my
> circuit program at circuitengine.com does for freshman circuits (and
> hopefully more). You click a button and make a spring, ramp, block,
> pulley etc. You right click an object and adjust its properties. You
> hit start. You can make graphs. You can ask it to tell you how long
> it takes for something to happen (e.g. height of object A is 10m), and
> it uses some sort of decrease and conquer (binary search in the worst
> case, but better can be done if we make an estimate of when the event
> happens) to find the exact time that that happens.
> Could anyone recommend any programs that have this sort of
> functionality for me to look at?
> Does anyone have any thoughts on using OpenModelica?
> Another question:
> Time permitting, I would like to be able to solve symbolic physics
> problems. Instead of just giving initial conditions and solving for
> later values, it would be nice to say (symbolically) "it takes t
> seconds for the ball to reach the basket, at what angle was it
> thrown". How might you go about this? I think that this could be
> done using a theorem prover of sorts that searches the space of
> theorems that can be proven from a small set of axioms and givens and
> a set of manipulation rules. Of course this is an NP-complete problem
> that is intractable in general (think Fermat's last theorem), but most
> problems given to freshman physics students are only a few steps long,
> meaning that the tree of possible proofs is relatively small and can
> be exhaustively searched.
> Does Sage have the ability to symbolically simplify "sin^2(theta)+cos^2
> (theta)" to "1"?
> For numeric problems such as "at what angle must the ball be thrown to
> reach the basket in 2 seconds?", it might be possible to use some sort
> of binary search to find the correct value.
> On Sep 23, 3:31 pm, Fernando Perez <fperez....@gmail.com> wrote:
> > On Wed, Sep 23, 2009 at 4:41 AM, Prabhu Ramachandran
> > <pra...@aero.iitb.ac.in> wrote:
> > > Thanks Fernando. The speed issue is still true but I wouldn't blame
> > > traits since that isn't the source of the bottleneck. I think there are
> > > a little too many events and too many renders. I have not had the time
> > > to profile it carefully.
> > Thanks for the clarifications, Prabhu. I remembered the performance
> > drop, but wasn't sure what all of the reasons were under the hood and
> > I was worried I could misrepresent the issue.
> > It would really be great to have vpython-like performance with the
> > clean tvtk api! Here's to hoping it's possible :)
> I would appreciate it if anyone has any links to JavaScript libraries > (or general suggestions on making a JavaScript GUI front-end that > communicates with a Python program) that might be helpful.
When I developed a Java applet, I had to spend great amounts of time
researching the idiosyncrasies of different browsers on how to embed a
Java applet with parameters. Since first being exposed to Java, the
<applet> tag had been deprecated, adding difficulty.
Then I learned that some operating systems don't have the latest
version of the Java Virtual Machine, and that some mice do not have a
right button.
If using JS (and related libraries) on all platforms may require extra
plugins, would Java make more sense, or do I just need to find ways to
use JS effectively?
Does anyone have any general suggestions on how I might want to
develop a GUI with animation and mouse interaction with JS?
Kevin Stueve
On Nov 15, 3:58 pm, Pat LeSmithe <qed...@gmail.com> wrote:
> > I would appreciate it if anyone has any links to JavaScript libraries
> > (or general suggestions on making a JavaScript GUI front-end that
> > communicates with a Python program) that might be helpful.
> If using JS (and related libraries) on all platforms may require extra > plugins, would Java make more sense, or do I just need to find ways to > use JS effectively?
> Does anyone have any general suggestions on how I might want to > develop a GUI with animation and mouse interaction with JS?
It may be best to start with an existing package. How about GeoGebra
? Moreover, the best solution may involve both Java (e.g., for rendering, interaction) and JavaScript (e.g., for control, communication, updates). I think Jmol and GeoGebra are both JS-able.
Pat, thanks for the links and suggestions. They were helpful.
GeoGebra and Jmol are written in Java. Jmol and GeoGebra can use
JavaScript to simplify embedding in a web-page. Is this what you mean
by JS-"able"?
On Nov 15, 8:45 pm, Pat LeSmithe <qed...@gmail.com> wrote:
> > If using JS (and related libraries) on all platforms may require extra
> > plugins, would Java make more sense, or do I just need to find ways to
> > use JS effectively?
> > Does anyone have any general suggestions on how I might want to
> > develop a GUI with animation and mouse interaction with JS?
> It may be best to start with an existing package. How about GeoGebra
> ? Moreover, the best solution may involve both Java (e.g., for
> rendering, interaction) and JavaScript (e.g., for control,
> communication, updates). I think Jmol and GeoGebra are both JS-able.
> GeoGebra and Jmol are written in Java. Jmol and GeoGebra can use > JavaScript to simplify embedding in a web-page. Is this what you mean > by JS-"able"?
Yes. Although Sage, for now, does not make extensive use of either project's JS API, we could use them, e.g., to update the applets dynamically, with results computed on the notebook server.
How can you edit a plot in real time programatically? I have found
Ptplot useful in the past. It allows points to be added to a plot,
zooming, etc. Is there functionality like this in Sage? Would Ptplot
make a good addition to Sage? I would like some way to graph
quantities as they are changing (and being calculated), such as the
position or velocity of a body.
http://ptolemy.berkeley.edu/java/ptplot5.7/ptolemy/plot/doc/index.htm Kevin Stueve
On Nov 15, 10:03 pm, Pat LeSmithe <qed...@gmail.com> wrote:
> > GeoGebra and Jmol are written in Java. Jmol and GeoGebra can use
> > JavaScript to simplify embedding in a web-page. Is this what you mean
> > by JS-"able"?
> Yes. Although Sage, for now, does not make extensive use of either
> project's JS API, we could use them, e.g., to update the applets
> dynamically, with results computed on the notebook server.