Specifications

178
Right-click the files and save them in a directory of your choice. Then start AnyBody and load the main file,
demo.include.any.
Next up is Lesson 3: Mathematical Expressions
.
Lesson 3: Mathematical Expressions
One of the definite advantages of a modeling language like AnyScript is that mathematical expressions
become a natural element in model construction. By means of mathematical expressions in models you can
make the model parametric, enable scaling in various ways, and create dependencies between elements.
In AnyScript you can in principle write a mathematical expression involving variables and references to other
objects and to time anywhere in an object definition where you would otherwise use a number.
Furthermore, AnyScript handles scalar numbers, vectors, matrices, and in fact tensors of arbitrary
dimensions.
Unlike most programming languages, definition sequence does not have any significance in an AnyScript
model. This means that variables can refer to other variables that are created further down in the model like
this:
AnyVar b = a;
AnyVar a = 10;
Instead of the sequence of definition, AnyScript variables depend on the sequence of evaluation. Some
expressions are can be evaluated when the model is loaded, while others have to wait for certain operations
to complete. For instance, a muscle force is not known until an InverseDynamicAnalysis operation is
performed. The systems keeps track of when everything is evaluated and will complain if you try to use a
variable prematurely.
For instance, kinematic analysis is the first step of an inverse dynamic analysis, so you can make an
external force or a muscle strength depend on a position. This is because forces and muscles strengths are
not used until after the kinematic analysis when the positions have been evaluated. However, you cannot
make a position depend on a muscle force because muscle forces are always computed after positions.
Much of the capability of the mathematical expressions is demonstrated in the example
Demo.MathExpressions.any
.
Building block tutorial
Developing accurate models of the human body is an enormous task, and it is not something each user can
do from scratch. We all have to rely on models other people have made, and if we keep improving and