guest

DYsolve: basic guide

horizontal line

to calculate mathematical expression:

enter mathematical expression in command line and press "Enter":

example1

you can use following symbols:

+, -, *, /

add, subtract, multiple, divide

^

raise to the power

.

floating point delimiter

=

equal (initialize entity)

>

greater

>=

greater or equal

<

less

<=

less or equal

==

is equal (equality check)

!=

not equal

!

not (negotiation)

adding comments:

to add a single line comment to a worksheet wrap text in quotes:

example1-1

working with entities:

Place cursor on the worksheet at a desired place. Next created entity will be placed there.

To move entity to another place (on mobile versions) first select entity by clicking on it, then tap in the desired place and hold your finger little bit (long tap). Click on the entity one more time to deselect it.

To delete entity first select it, then press "delete" button on the toolbar (button with "recycle bin" icon). You can select multiple entities.

example1-2

To delete all created entities and clear your worksheet go to "Database content" activity and press "reset" button.

example1-3

There is no "undo" operation available in DYsolve. To correct wrong entity simply redefine it. Use "UP" and "DOWN" buttons on toolbar to list your previous inputs:

example1-5

to save work session:

go to "Input/output" activity, type name of your document and press "WRITE" button. Session will be saved in text document in DYsolve application folder. Next time you can open session by pressing "READ" button. "Overwrite" flag is active by default, which means that existing database will be errased before reading new file. If you choose "Append" option, entities from a new file will be added (or replaced in case of name conflict) to existing database.

example1-4

to create a variable:

create new variable by typing it's identificator (name) and assigning a value:

example2

initializing expression (on right side) can refer to variables (or other entities) created before:

example3

You can refer non-existing entities as well and define them later. In other words, you can create not fully defined variables and functions. However, such entities cannot be calculated, until they are fully defined. Vectors and matrices should be fully defined at the moment of creation.

if we consider, that a and b are cathetus of a rectangular triangle, then it's hypotenuse can be obtained as:

example4

changing value of a, variables b and c will also change, because they are depending on a.

to change the variable simply redefine it:

example5

You can also add a dimmension to the variable as a postscript expression. Use comment sign "//" to separate main expression from the postscript expression:

example5-1

Note: there is no dimmension support in DYsolve, postscript expression is treated as a comment only. However, it is parsed as a math expression and thus appears in formatted style.

some variables are available by default (predefined variables). These are:

PI

3.14159265359

e

2.71828182846

g

9.81 (acceleration of gravity)

however, you can redefine or delete them.

to create a function:

create new function by typing it's name, arguments (listed in parentheses) and assigning expression:

example6

you can use any number of arguments. After function was created, it can be used in calculations:

example7

it is possible to define piecewise continuous function by typing initializing expression and logical condition:

example8

if condition is true, function will return calculated specified expression. Function will return zero otherwise. For current example result will be -0.5, when x < -2PI, or 0, when x >= -2PI.

using the same function name and similar list of arguments enter:

example9

and then:

example10

when plotted this function will look like this:

example11

you can add any number of intervals to the function. In this case every new expression must be followed with logical condition. If you add expression without condition - it will overwrite all previously added expressions. Also avoid intersections between intervals, this can lead to unexpected results (for intersection areas results from conflicting expressions will be summed together).

variables can be defined by using logical expression in the same way.

to create a vector

create new vector by listing all it's elements in angle brackets:

example12

you can use a sequence of numbers using default step 1:

example13

or using specified step:

example15

all this approaches can be combined together:

example15-1

resultant vector will contain such elements:

0, 0.2, 0.4, 0.6, 0.8, 1, 2, 3, 4, 5, -4, 0.8

you can create new vectors by using existing vectors as inputs:

example14

vector is actually a one-dimensional array of elements. Used in mathematical expressions "as is" vector is treated as geometrical entity, i.e. it can be multiplied by a number, added to another equal length vector, or scalar multiplied by another equal length vector. However, vector has several other useful applications, e.g. it is being used to control loops, to create other vectors or matrices.

to refer single element of a vector use indexes:

example16example17

NOTE: indexing starts from 1 in new versions, released after Janyary 27, 2017! In older builds indexing starts from zero!

to create a matrix:

create matrix by listing all it's elements in figure brackets and separating rows with semicolon:

example18example19

as you can see, number of elements in rows can be different. In this case number of columns for a such matrix will be equal to the longest row's length. Missed element positions will be filled with zeros.

using matrices in calculations:

a11 = A[0, 0] - indexing matrix element.
A1 = A[1, ] - A1 will be matrix, created from matrix A 2nd row.
A2 = A[ , 2] - A2 will be matrix, created from matrix A 3-rd column.

matrix can be used in expressions without indexes. It can be multiplied by a number or by another matrix, transposed, inversed etc.

transpose matrix:

example20

inverse matrix:

example21

to plot results:

first create vectors to use them as input values. Then call "plot" command, using two arguments - input and output vectors:

example22

Call "plotAdd" command to add series to existing plot:

example23horizontal line