Application: Bouncing Ball - Maple Help

Online Help

All Products    Maple    MapleSim


Ball Bouncing on Hilly Terrain

The following application demonstrates how event modeling in the dsolve command can be used to model a ball bouncing on a hilly terrain.

restart;

withplots:

Define the Surface

We define the surface, surf, in the line below.  It is possible to modify this equation to show different "terrains".

surf sinx+0.2cos4x+ sin4x0.2 x+3:

plotsurf,x=0..10,scaling=constrained

Derive the Hilly Surface

The velocity vector of a ball:

VVectorx.t,y.t:

 

The surface normal:

NLinearAlgebra:−NormalizeVectorxsurf,1,2,conjugate=falseassuming positive:

NevalN,x=xt

N:=cosxt+0.2sin4xt+sin4xt4+4cos4xt+0.21+cosxt+0.2sin4xt+sin4xt4+4cos4xt+0.2211+cosxt+0.2sin4xt+sin4xt4+4cos4xt+0.22

(2.1)

 

The velocity vector after reflection across the surface normal:

V_reflect1+C__R V.NN+V:

V_reflect:=simplifyV_reflect,symbolic:

 

Restitution coefficient:

C__R  0.99:

Using C__R < 1 represents an inelastic collision between the ball and the surface, whereas using C__R &equals;1 represents an elastic collision.

Differential Equations and Initial Conditions

Gravity acts in the -y direction:

deqsy..t=9.81,x..t=0&colon;

icsDx0=0,Dy0=0,x0=2,y0=4.5&colon;

Solve and Animate the Differential Equations

 soldsolvedeqs&comma;ics&comma;xt&comma;yt&comma;numeric&comma;                                    events&equals;yt=evalsurf&comma;x=xt&comma;temp=x.t&comma;x.t= V_reflect1&comma;y.t= subsx.t=temp&comma;V_reflect2&comma;                                   range&equals;0..10&comma;                                  output&equals;listprocedure&colon;

Animate the Ball Bouncing on the Terrain

xanimsubssol&comma;xt&colon;yanimsubssol&comma;yt&colon;

p1plotsurf&comma;x=0..10&comma;color=black&comma;filled&equals;true&comma; transparency&equals;0.5&colon;p2animatepointplot&comma;xanimt&comma;yanimt&comma;symbol=solidcircle&comma;symbolsize=15&comma;color=black&comma;t=0..10&comma;frames=150&colon;

displayp1&comma;p2&comma;view=0..10&comma;0..5&comma;scaling=constrained