Activity 1

prepared by Ken Levasseur

Mathematica Versions of the code

dist[a1_, b1_, a2_, b2_] := ((a1 - a2)^2 + (b1 - b2)^2)^(1/2)

dist[-3, 2, 5, 1]

65^(1/2)

Solve[dist[x, y, -3, 2] == dist[x, y, 5, 1], y]

Solve :: ifun :  Inverse functions are being used by  Solve , so some solutions may not be found.

{{y -> 1/2 (16 x - 13)}}

Solve[dist[x, y, -3, 2] + dist[x, y, 5, 1] == 9, y]

{{y -> 1/20 (-2 x - 9 (-x^2 + 2 x + 19)^(1/2) + 32)}, {y -> 1/20 (-2 x + 9 (-x^2 + 2 x + 19)^(1/2) + 32)}}

•Comments/Extensions

Here is how to plot an output from Solve.   First shut off the message that comes up when a complex solution occurs in the plotting.

Off[Plot :: plnr]

Solutions are lists of rules and there are two solutions to this equation.

solution = Solve[dist[x, y, -3, 2] + dist[x, y, 5, 1] == 9, y]

{{y -> 1/20 (-2 x - 9 (-x^2 + 2 x + 19)^(1/2) + 32)}, {y -> 1/20 (-2 x + 9 (-x^2 + 2 x + 19)^(1/2) + 32)}}

The plot range, -5 <= x <= 8 took some adjusting.   The AspectRatio option forces a uniform scale on the plot.  Otherwise the plot is distorted.

Plot[Evaluate[y /. solution], {x, -5, 8}, Epilog -> {Point[{-3, 2}], Point[{5, 1}]}, AspectRatio -> Automatic, PlotPoints -> 200]

[Graphics:HTMLFiles/a01_14.gif]

-Graphics -


Converted by Mathematica  (April 17, 2003)