Using Brackets, Newlines and other

Navigation:  Language Reference > Introduction >

Using Brackets, Newlines and other

Previous pageReturn to chapter overviewNext page

You can use brackets and newlines in various ways to create order in your equations.

Parenthesis ()

Parentheses may be used to indicate grouping as in ordinary mathematical notation, e.g.:

 

u = sin(time*f*2*3.1415 + (a + b)/c );

 

If a lot of parenthesis are used, it may be hard to see the grouping. You can always put your mouse pointer next to a parenthesis and have the group highlighted.

BracketsBrackets

Square Brackets []

Square Brackets are used to indicated matrix sizes and matrix elements:

 

parameters

 integer p[6,6] = [1,0,0,0,0,0;0,2,0,0,0,0;0,0,2,0,0,0;0,0,0,5,0,0;0,1,0,0,5,0;0,1,0,0,0,6];

variables

 real v[3];

equations

 v = p[4:6,6];

Newlines

Newlines, tabs and white spaces can be used to make your equations more readable. E.g for the parameter example from above we could also write:

 

parameters

 integer p[6,6]; = [

                         1,0,0,0,0,0;

                         0,2,0,0,0,0;

                         0,0,2,0,0,0;

                         0,0,0,5,0,0;

                         0,1,0,0,5,0;

                         0,1,0,0,0,6

                         ];