solving two equations in two unknowns

loops and derivatives

We illustrate the solution of two equations in two unknowns

After the solution, maple doesn't know what x is. x has not been 'assigned'

Now maple knows x and y. (And they are no longer free to be variables.)
Assigning a solution is important if something is to be done with x and y later.

Next, we illustrate the use of a loop. Everything between the do and the od gets executed the specified number of times. Be sure to include the od at the end, or your whole maple session can get wrecked. This loop just adds the integers from 1 to 10. This can be packed on one line, but the choice of how much goes on one line is up to you.

Here is a more complicated use of loops; a total charge of 1 nC in N even chunks from -1 m to +1m along the x-axis. We will plot along the y-axis.

First, we need a function for the potential, with q in nC. This is the potential due to a charge q at (a,0,0) at point (x,y,z).

Oops, x and y are committed, so we free them up and go again.

Now we break 1 nC into 6 pieces and place from -1 to 1, roughly.

I often forget the grammar of the loop, so I get reminded by asking for help on the for statement. One of the examples in the help shows going by 2's as I did below. Note that the subs command plays an important role.

Now break the 1 nC into 12 pieces and spread them over the same range. Will V at the origin be bigger or smaller?

The two graphs should differ a little at y=0 and then rapidly come together at larger values of y, because we have the same total charge spread over the same total distance.

Now for some derivatives.

First, we define a function, find its first derivative and where it is zero, then check the result with a plot.

Then we find the laplacian of the V function, then simplify it to show it's zero. Note the two different but equivalent ways of asking for a second derivative.

Exercises for the user

1. A ball is thrown straight up. The ball's height as a function of time is given by y(t) = 6 + 50*t -16t^2.

2. The expression for the magnetic field on the axis of a circular loop, radius R, current I at a distance z from the center (along the axis) is

3. You are defending against incoming protons of KE 20,000 eV. You have a total charge of 500 nC to defend a 1-m wide region of space.

4. [loop and subs problem]

Find the potential at x=10 m from a group of 20 charges, each 5 nC, distributed uniformly from 0 to 1 m.

[Students, estimate the answer before doing calculations!] [Should look something like a point charge @ 1/2 m.]

End of easy2.mws