⇐ back

    Creating a variable

    to create a variable:

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

    ex2

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

    ex3

    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:

    ex4

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

    To change the variable simply redefine it:

    ex5

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

    ex5-1

    Note: there is no dimension 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:

    pi3.14159265359
    e2.71828182846
    g9.81 (acceleration of gravity)

    however, you can redefine or delete them.