You are on page 1of 26

Mechanical Expressions Tutorials

These tutorials are provided to help you get started using Mechanical
Expressions. They refer to the ideas discussed in Solving Geometry Problems
Using Mechanical Expressions, which we therefore recommend that you read
first.

Contents
Tutorial 1: Define and solve a problem. ................................................................ 2
Explore the user interface. ................................................................................ 2
Define a problem. .............................................................................................. 5
Calculate output. ............................................................................................... 7
Resolve a constraint conflict. ............................................................................. 7
Make your own expression. ............................................................................. 10
Tutorial 2: Statics ................................................................................................ 12
Tutorial 3: Dynamics ........................................................................................... 15
Tutorial 4: Loci and Transformations................................................................... 21
Draw a locus.................................................................................................... 21
Lock a variable. ............................................................................................... 24
Animate a variable........................................................................................... 24
Calculate parametric and implicit equations. ................................................... 25
Make the locus reflection. ................................................................................ 25
Compare locus and reflection equations. ........................................................ 26
Explore on your own. ....................................................................................... 26

Documentation Conventions
You see:

It means:

Space

Press the Space key.

Return

the Return or Enter key

Enter

Type the value or click to make the object, then press Return.

Control-Z

Press Control and Z at the same time.

File > New

Execute the New command from the File menu.

page 1

Mechanical Expressions Tutorials

Tutorial 1: Define and solve a problem.


In this tutorial, you will:
explore the tools,
define a simple problem,
calculate the output,
resolve a constraint conflict, and
add and calculate an expression.
As you work, bear in mind that theres no need to draw correctly the first time
Mechanical Expressions will correct the drawing as you work, based on the
constraints you add.
You dont have to worry about making mistakes of other kinds, either. Multiple
levels of Edit > Undo (Control-Z) and Edit > Redo (Control-Y) let you go back
and forth through a sequence of steps, so feel free to explore as you go.

Explore the user interface.


1. Start Mechanical Expressions, if you havent already.
2. File > New
A new blank page opens, occupying the left and
center of the window.
To the right, from top down, are the palettes that
define the process of working geometry problems:
draw objects
constrain geometry
create constructions,
add annotations, and
calculate output.

page 2

Mechanical Expressions Tutorials

Additional palettes provid ways to:


add forces, masses, and other mechanical
objects
measure motion and acceleration
insert symbols and
control variable values.
Enlarge or maximize your window if some of the
palettes are obscured.

3. You can hide a palette individually by clicking the


X at the upper right corner of the palette box. In this way, you can close
palettes that you wont be using. These tutorials wont be using the Symbols
palette, so you may close it now, if you wish. To display a hidden toolbox,
select View > Tool Panels. The submenu lists the toolboxes and the Main
Toolbar (the icon strip at the top of the window). Boxes shown are preceded
by a check; those without a check are hidden.

You can customize the user interface in various ways. The options available in
the View menu control zooming, scaling, axes etc. and the items in Edit >
Preferences, address other visual, text and mathematical properties.
Under the Math tab, for example, you can set the threshold for Intermediate
Variable Complexity, which under some circumstances can significantly affect the
actual expression thats calculated. A low threshold tells the application to
substitute only simple intermediate variables, so you'll see more of them. A
progressively higher threshold results in the substitution of progressively larger
and more complex intermediate variables, so you'll see fewer but more complex
ones.

page 3

Mechanical Expressions Tutorials

4. In the Draw palette, choose the line segment tool.

5. Starting near the bottom left of the drawing, click and hold the mouse button
down as you draw a line segment going upward and to the right. Mechanical
Expressions places the first point where the cursor is when you first press the
mouse button, and the second point where you release it. It then labels the
first point A and the second point B.

A
page 4

Mechanical Expressions Tutorials

6. With the line segment tool still selected, move the mouse around the drawing
area, passing over one or both of these points. Mechanical Expressions
tracks the location of the drawing cursor, snapping it to an existing geometry
object when the cursor gets close enough.
7. Try creating other kinds of geometry objects with some of the other drawing
tools. When youre ready to go on, undo them all except the line AB.

Define a problem.
To start, well use the first line segment and add three more to create something
like this:

1. Again using the line segment tool, snap the cursor to point B and draw three
more line segments; BC, AC, and then BD. (Remember, theres no need to
draw precisely.)
To ensure that point D lies along the line AC, move the cursor near enough to
AC that the line becomes selected, and D will snap to it automatically.

2. Change to the selection tool and select line AB by clicking the mouse
anywhere along its length.
3. With one object selected, some of the tools in the Constrain Input palette are
enabled. Click the Distance/Length constraint. (Tooltips give the name of
each tool. You can use this to see what options are available.)

page 5

Mechanical Expressions Tutorials

The constraint appears, along with the default variable name of a, selected
and ready to change. Press Return to accept it.
4. Select line BC and repeat the previous two steps to constrain its length to b.
5. Youve now added two variables to your drawing. Go to the Variables palette
to see their names and values.
The values displayed in the Variables palette
are the current values, as taken from the
default coordinate system. Notice that these
values will change as you vary the lengths of
the sides. Vice versa, if you select a variable
and change its value in the Variables palette,
the geometry will change accordingly.
6. Select the variable a in the Variables list and,
in the input field below, enter the nearest
round number.
7. Select both lines AB and BC. (You can select
more than one object at a time by making the
first selection, then holding down Shift as you
make subsequent selections.)
8. With two objects selected, youll see a
different set of constraint tools enabled. Click the Perpendicular constraint to
constrain the angle to 90. ABC is now a right triangle.
Notice that point C moved, not point A, though either could have moved to
satisfy the constraint. Mechanical Expressions moves the more recently
added object when it can.
9. Theres one last constraint to add. Select both lines BD and AC, and
constrain their angle to be perpendicular as well.

B
b
a

D
page 6

Mechanical Expressions Tutorials

10.

Calculate output.
Suppose you want to know the length of the line BD:
1. Select BD.
2. The Calculate palette offers output as both numeric Real and expressions
Symbolic. Click on Symbolic if its not already in front, then click the
Distance /Length calculation.
An expression appears, showing the requested length in terms of the two
variables, a and b. Its selected, allowing you to move it wherever you wish.

a
ab

a +b

The double arrow => that appears to the left of the expression indicates that the
expression is an output that the application has calculated.

Resolve a constraint conflict.


With the lengths of two sides and the included angle already constrained, the
triangle is already fully defined; any new constraint you add will conflict with the
existing ones. While this may be obvious, you may later encounter conflicts that
are less obvious. This task takes you through the steps necessary to resolve
such conflicts.
1. Select the line AC and add a length constraint. Youll see this dialog:

page 7

Mechanical Expressions Tutorials

2. The dialog offers you three choices:


Cancel out of the operation, leaving the drawing as it was.
Leave the other constraints in place and calculate the requested distance
from them. This replaces the requested length constraint with a length
measurement instead.
Relax one of the existing constraints so you can add the new one. You
can then choose which to relax.
3. Click the second radio button, Calculate the distance from the other
constraints, and dismiss the dialog. Youll see the expression appear with the
arrow (=>) that indicates its an output. It may also be given a name. This will
be the case if the Show Name (in the Display Properties dialog box) is set
to True.

page 8

Mechanical Expressions Tutorials

4. Edit > Undo


5. Try to add the new constraint again. This time, click the third radio button,
Relax other constraints so the distance is independent. As soon as you click
it, the conflicting constraints light up in red and the new one in yellow:

6. Click the angle at B. Its highlight changes to indicate its selected; the
conflicting constraint highlights vanish, and the new one now is outlined in
green.

page 9

Mechanical Expressions Tutorials

7. Click OK. Now the figure includes the length constraint c, while the
perpendicular angle constraint at B is gone.

a+b+c (a+b-c)(a-b+c)(-a+b+c)
2c

D
c

8. Edit > Undo again. Were going to need that perpendicular angle later. Leave
the drawing as it was, without length constraint c.

Make your own expression.


Mechanical Expressions can calculate output as expressions, but you can also
define and add your own expressions to a drawing.
1. Select the two points A and D.
2. Calculate the distance between them as a symbolic output.
3. Select the expression youve just output.
4. Right click and then select Output Properties > Show Name > Yes
To the left of the arrow, the name zn appears. (Because you may have
created one or more of these already while exploring, we cant predict the
exact number in the subscript.) This is the symbol the application assigns by
default as the name of the expression. You can change this label to
something more meaningful by double-clicking the name and retyping.
5. Select the two points D and C, and repeat the previous three steps to get a
second expression, this one named zn+1. (Subscripts increase by one each
time the symbol they apply to is reused.)
Using these names or whatever names you chose, make an expression using
these distances. For example, you can calculate the ratio of the two lengths.
6. In the Draw palette, choose the Expression tool
page 10

Mechanical Expressions Tutorials

7. Click in the drawing where you want to put the expression. The expression
appears as a 0, selected for overwriting. To replace the zero, enter:
z[n]/z[n+1]
(Square brackets indicate subscripts. Or use whatever names you created.)
8. The expression is calculated and displayed.

z1

z2

ab
2

a +b

D
2

z1

a
2

a +b

z2

page 11

b
2

a +b

Mechanical Expressions Tutorials

Tutorial 2: Statics
The first tutorial could be done in Geometry Expressions; this one uses new
features from Mechanical Expressions. For a first example, we will create a
classic plank-and-string problem:

The line AC represents a massless plank fixed to a wall at A and with a weight at
C, supported by a string fixed to point B, also on the wall, and D, at the midpoint
of AC. To create this:
1. Enable the axes: the Axes/Grid icon,
Axes, will enable them.

, on the main toolbar, or View >

2. Place A at the origin and B along the y-axis. Place C near the x-axis but
not on it, and D along AC.
At this point, your diagram should look roughly like this:

page 12

Mechanical Expressions Tutorials

3. Constrain the length AC to be L using the Distance/Length constraint


then constrain the length AD to be L/2 the same way.

4. Constrain B using the coordinate constraint


. Select B, then click the
coordinate constraint tool and replace the supplied coordinates (x0, y0)
with (0, 3*L/8). Notice that we must not leave out the multiplication
symbol, since Mx can take variables of any length. Also constrain A to
(0,0); this will allow us to measure the force there later.
Note: Why do we constrain these differently? Mechanical Expressions treats
constrained and unconstrained objects differently. Forces and torques may be
applied to any object, but constrained objects are assumed to have zero net
force, with the constraint itself making up the slack. Thus, forces, masses,
and torques can only be usefully applied to unconstrained objects, and may
only be measured on constrained objects. If we constrained C or D to lie on
the x-axis, no force would be conveyed.
5. Click point C, and then click the Mass tool on the Mechanics Input
palette. The default value is m. (Select Edit > Mechanics Environment
to check your System units.)
6. Constrain BD to have length 5*L/8 The legs are 3*L/8 and L/2=4*L/8, so
this sticks AC onto the x-axis without attaching it. (Thanks, Pythagoras!)
7. The last step is to calculate the forces. Select the length constraint (not
the line) of BD, and click the Reaction Force button
. Then select the
coordinate constraint (not the point) for A, and do the same thing there,
and repeat for the constraint at B. Your diagram should now look like this,
displaying the reaction forces in pink:

page 13

Mechanical Expressions Tutorials

8. This isnt the only way Mechanical Expressions can measure this system.
Its also possible to ask for the force on a point, if that point is treated as a
pin supporting an object. Edit > Undo the three reaction forces you added
to clean up the screen, then try it out. Select the object (line segment) and
the point, then click the Pin Reaction button:
. Try this for the forces
AC exert on A; it will give the generic name z3 to these forces, but you
should change the name to AAC. Then try it for point D; calculate both DBD
and DAC. You should observe Newtons Third Law in action here.

page 14

Mechanical Expressions Tutorials

Tutorial 3: Dynamics
Force and Torque
We havent used the torque or acceleration abilities of Mechanical
Expressions yet. Lets work through an example that does: Two
identical hanging bars, with the top bar attached to a fixed pin at
A and the bars connected by a pin at B. When a force of P lbs is
applied at C, the bottom of the lower bar, what is the angular
acceleration on each bar?
0. To set up this problem correctly, we need to use pounds
rather than kg. Open Edit > Mechanics Environment and
change Current > System from SI (m/kg/sec) to FPS
(ft/lb/sec).
1. Plant point A along the x-axis, and make line segments AB
and BC below it, unconstrained.
2. To model the bars, we will need to give each a fixed
length, mass and moment of inertia. The moment formula
for a uniform bar is I=L2w/12.
3. Constrain the length of each bar to be L. Then select
each bar and Construct the midpoint.
4. At each midpoint, add a mass labeled w, representing the
weight of the bar.
5. Select the bar itself and click the Moment icon
. To
properly reflect the distribution of the mass, each bar
should have moment L2 * w/12.
With this done, the diagram should appear like the example at
left. But there are more restrictions needed, and output to
calculate.
6. We want to have the system start at rest, which means
that both bars will hang straight down. We can do this by
constraining the angles; Mechanical Expressions
diagrams dont normally evolve over time, so we are
constraining only the initial conditions. Constrain the
angle between AB and the axis to be /2, and the angle
ABC to be .
7. Now, we add the pushing force incident at C, Applied
Force. Set this to be a purely horizontal force,

page 15

Mechanical Expressions Tutorials

8. Finally, we can measure the angular acceleration of each bar. Select an


angle constraint and output the Resultant Acceleration
. Note the
value, then select the other constraint and do the same. Notice that the
first acceleration you measured changes; this is because a constraint
whose resultant acceleration is measured is no longer assumed to have
zero net force, and changing the second angle from static to dynamic
changes the forces at play in the rest of the diagram. This gives a final
diagram, seen below left.
9. It is also possible to measure the acceleration on the bars themselves. For
this, use the Velocity/Acceleration measurement

page 16

, which works on all

Mechanical Expressions Tutorials

objects, constrained or not. This is seen below right.

page 17

Mechanical Expressions Tutorials

Models in Motion
So far, our models have been at rest, with forces disturbing them from it. It is also
possible, however, to have a model which is in motion, or even undergoing
constant acceleration. As an example, consider this kinetics problem:
A cart is rolling freely along a flat surface. A bar is fixed at one end
to a pivot on the bed on this cart, and its other end is fixed to a
spring. The other end of the spring is fixed to a slider on a rigid
upright bar (also fixed to the cart) so that the spring remains
horizontal. Assuming that when the cart is at rest the pivoting bar is
upright, what is the resting angle of the bar when the cart is
accelerated by a m/s2?
This apparatus would
look roughly like this,
being accelerated to
the right. This is simple
to model.
1. Put the line
segment AB
along the x-axis,
and draw AC
upward from A.
2. Place D on line
segment AB and
draw DE
upward.
3. Constrain AC to
be perpendicular
to AB.
4. Select C and E, then select Spring from the Mechanics Input
palette. You should disable the actuator and the damper. This
leaves a spring with spring constant k and natural length L.

page 18

Mechanical Expressions Tutorials

5. Select AD and
constrain its length
to be L. This
ensures that when
the cart is at rest,
DEs rest position
is vertical. The
diagram up to this
point is shown at
right.
6. Next, constrain DE
to have length d.
7. Select DE again
and construct a
midpoint. Add a
mass m at that
point. (For easier
modification, you
may wish to
increase the size of
this mass using the
right-click menu or
Edit>Properties)
8. Select DE once
more and add a
Moment of inertia.
Enter its value as
d^2*m/12, the
formula for the
moment of a bar
about its midpoint.
It should now
appear as at right.
9. The final steps are
to set the cart and
the bar in motion.
Select DE and AB
and constrain their
angle to be .
10. Select C and
constrain its
coordinates to
(x,d*sin()). The ycoordinate here
page 19

Mechanical Expressions Tutorials

guarantees that the spring will always remain horizontal, as


specified in the problem statement.
11. Select this coordinate constraint and add velocity/acceleration input
. Enter 0 for the velocities (or any other value; these are not
important) and for the y-direction acceleration, and a for the
acceleration in the x direction.
12. Select the angle constraint and find the resultant acceleration. The
bar is now free to move, and the final diagram should match the
diagram below.

Finding equilibrium states is then a simple matter of setting z0 to 0


and using it to relate the acceleration of the cart a, the spring
constant k, and the resting angle .

page 20

Mechanical Expressions Tutorials

Tutorial 4: Loci and Transformations.


This tutorial lets you exercise some of the advanced geometry features of
Mechanical Expressions. In this tutorial, you will:
create a locus,
lock a variables value to see the effect it has on the drawing,
animate the drawing by setting start and stop values for a variable,
calculate two kinds of equations for the locus,
make its reflection, and
compare the equations for the locus and its reflection.

Draw a locus.
Were now going to re-create the old exercise of drawing an ellipse using a
pencil, two pins, and a piece of string.
1. Turn on the axes by clicking on the grid tool in the toolbar.

2. Make two line segments, AB and BC. Points A and C are the pins, while B
represents the pencil.
4
B
3

1
A
-5

C
-4

-3

3. Select point A.

-2

-1

1
-1

4. Click the Constrain > Coordinate icon.


-2
page 21
-3

Mechanical Expressions Tutorials

5. In the data entry box type (with or without the parentheses):


(-a,0)
6. Select point C and constrain its coordinates to be at (a,0).
4
B
3

1
A
-5 (-a,0) -4

C
-3

-2

-1

4 (a,0) 5

7. Check the value of a in the Variables -1


palette.
-2

-3

-4

-5

8. Reselect A and drag it to the right a short distance. As you drag, notice:
A is now constrained to lie along the X axis; moving it up or down has no
effect.
When you move A, C also moves.
When you move A, the value of the associated variable a changes in the
Variables list.
9. Select the line AB and constrain its length to be distance t.
10. Select the line BC and constrain its length to be Lt. L now represents the
length of the string.

page 22

Mechanical Expressions Tutorials

4
B
3
t
L-t

1
A

-5 (-a,0) -4

-3

-2

-1

4 (a,0) 5

11. Notice that the two new variables have-1appeared in the Variables list.
-2

-3

-4

12. Select point B.

-5

13. In the Construct palette, select Locus to construct a locus through B.

14. In the resulting dialog, choose t as the Parametric Variable, and enter start
and end values of 025, guesses that will probably produce a complete curve.
The locus appears half of an ellipse, above the X axis.
4
B
3
t
L-t

1
A
-6

-5 (-a,0) -4

C
-3

-2

-1

1
-1

page 23
-2

-3

4 (a,0) 5

Mechanical Expressions Tutorials

15. Now drag B up and down, the equivalent of changing the length of the string,
and seeing how the ellipse changes. You can also drag A or C to change the
position of the pins.

Lock a variable.
When you draw an ellipse this way using real pins, pencil, and string, the length
of the string cant change. To emulate this real-world behavior, we can lock the
value of the variable L.
1. In the Variables list, select L and click the lock icon below the list. A plus sign
(+) appears next to the locked variable in the Locked column.

2. Select points A or C and drag them. With the length of the string constant, B
traces the same locus no matter which point you drag.

Animate a variable.
You can also animate the drawing. To do so, we can set start and stop values for
the variable t.
1. In the Variables list, select t.
2. The first input field below the video playback interface specifies the start
value. Enter 1.5.
3. The middle field specifies the duration of the animation. Accept the default
value of 4. The input field to its right specifies the stop value. Enter 12.

4. To animate the drawing, click Play button (

page 24

).

Mechanical Expressions Tutorials

NOTE: The start and stop values that yield an interesting animation depend to
some extent on where youve located objects in your drawing. Experiment to find
values that make an interesting animation. Values that do not allow Gx to create
a construction sequence will cause objects to disappear briefly, (e.g. if your start
and stop values cause the string to break or the pins to pop out!) Theyll reappear
when values make sense again, or when the animation stops.

Calculate parametric and implicit equations.


1. Select the curve. In the Calculate palette, chose Parametric equation. The
resulting expressions are the formulas for x and y as a function of t. Move the
expression wherever you wish on the drawing.
2. Select the curve again, and this time request the Implicit equation. The
resulting expression gives the forumla for the curve in terms of x and y.

Make the locus reflection.


1. Select the curve.
2. In the Construct palette, choose Reflection. The status bar now shows a
message prompting you to choose the axis about which to reflect the curve.

3. Click the X axis.


X=

Y=

L(-L+2t)
4a
L-2t+2 a L-2 a L+2 a -L+2t+2 a

4a

B
3
t
L-t

1
A
-7

-6

-5 (-a,0) -4

C
-3

-2

-1

-1

-2

-3
-L4+4L2Y 2+4L2a2+X2 4L2-16a2 =0

B'
-4

page 25

4 (a,0) 5

Mechanical Expressions Tutorials

B is also reflected, its reflection appearing on the lower curve as B .


4. Select B and drag it; B follows. But, though you can select B, you cant drag
it; its locked to reflect the location of B.

Compare locus and reflection equations.


1. Select the reflected curve and request its parametric equation (from the
Calculate palette).
2. Compare them side-by-side and youll see that theyre identical, except for the
minus sign in front of the expression.
3. If you repeat the experiment for the implicit equation, youll see they are
identical.

Explore on your own.


Congratulations on completing the introductory tutorials. We hope youll be
comfortable exploring on your own now. If you wish, further interesting examples
can be found on our website, www.mechanicalexpressions.com.

page 26

You might also like