integration, assume, solve(analytic) and 'allvalues', solve dsolve(analytic), dsolve(numeric), Heaviside

First a simple integration.

Now a more complicated integration.

An element of charge dq located at (a,b) creates an element of potential dV at (x,y):

Then we'll get ready for an integration over a rod on the x-axis. xp will be the integration variable.

Now put in lambda = 10^-9 C/m for charge/length on the rod, and integrate. The rod is 3 meters long from the origin along the +x axis.

The plot3d graph can be manipulated by using the mouse (or arrow keys in DOS) , showing different views and different ways of presenting the data.

This is a derivation of the compton wavelength formula.
It illustrates eliminating variables, dealing with analytic solutions.

It uses 'assume' to improve the chances of the derivation succeeding.

The 'solve' analytic solution of the two momentum equations gives the famous 'Root of ...' output.

To deal with this, one must use 'allvalues' to make sense of the output. This gives a solution for momentum, and angle phi. We select the momentum solution, and eliminate phi, making sure to select the positive momentum solution.

Download comptn2.mws  [Use 'Save File' and then open it in Maple]

Now we show how to use dsolve, first with a simple mass-spring system.

This solution can be analytic.

Numeric solution is assigned to yn

Ask for help on odeplot command if we need it.

Here's another very simple use of dsolve.

Suppose a 10.5-kg object travelling at 5 m/s is subject to a retarding force of 0.2 N. Solve newton's second law for this simple case and plot it. If you plot it long enough it will turn around. Note the use of rational numbers, rather than decimals. Maple is much happier with rationals.

Now we illustrate the Heaviside (step) function. If you type in Heaviside(3.2); and Heaviside(-1/3);
you can see that it's 1 if its argument is positive, and 0 if it argument is negative.

First, we create a step function of x which is 1 when x is > a. Then we put the step at x=2 and plot it to make sure it's ok.

As an exercise, the user should now create a function using 'step' which is 1 between x=1 and x=5, and is zero outside that range. Plot it, of course, to see if it's ok.

Next, we want to take account of linear velocity damping in a mass spring. The damping force must be positive when v is negative, and the force must be negative when v is positive. A plot will confirm that we got it right.

We can now study the mass-spring system with damping.

Here is an example of both Heaviside functions and doing a dsolve for two variables. (So it really belongs among the 'fancy' worksheets.)

A moving mass m1 has a spring of unstretched length x0 attached to it. m1 has an initial velocity in the +x direction and travels until it encounters a stationary mass m2. The spring compresses during the collision until the masses separate, and we plot the motion of both masses as a function of time.

With this as a starter problem, students could be asked to work out the problem of two masses falling vertically, one above the other. [This is analogous to the small ball being dropped just above a large ball so that after they strike the ground, the small ball bounces high into the air.] One spring is attached to each mass, and one mass is directly above the other. The masses are released from rest at the same time, with some separation between them. The lower mass's spring strikes the ground and it rebounds, then encounters the spring of the upper mass. After the collisions the upper mass rebounds to some maximum height. The idea is to find the maximum rebound height of the upper mass, given masses and spring constants. The adjustable parameter is the distance between the masses when released from rest.

a) Given masses, spring constants, and unstretched spring lengths, and the initial height of the lower mass, reason out how the collision should occur so that the upper mass rebounds to a maximum height.

b) After the qualitative considerations are worked out, simulate the drop, and the motion of the two masses.

Exercises for the user.

1. Integrate (sin(x))^2 from 0 to 6*Pi or any other integer multiple of Pi/2. This should verify that the average of sin^2 x is 1/2 over these ranges.

2. A 2-kg ball is moving in the x-direction, subject only to a drag force (N) given by its velocity (m/s) squared divided by 10000. Use dsolve to find the motion of this ball, and then plot its position vs. time.

3. Use Heaviside functions to create a 'window' of height 1 between x=10 and x=20, being zero everywhere else.

4. Use Heaviside functions to create a sawtooth wave which starts at (0,0) and goes to (1,1) and then back down to (0,2).

End of Easy3