Skip to content

Expression types

TypeDescriptionInput Example
Integerinteger numbers42
Rationalrational numbers13/17
Complexcomplex numbers2+I*1/3
Realdouble values0.5
Complex Realcomplex double values0.5-I*0.25
Evaluation Precedencecontrol precedence with (...)(a+b)*c
Listscomma separated list of elements which are surrounded by { ... }{a, b, c, d}
Vectorsvectors are like list, but cannot contain sub-lists { ... }{1, 2, 3, 4}
Matricesa matrix contains the rows as sub-lists{{1, 2}, {3, 4}}
Sparse Arrayssparse arrays are defined through their element positionsSparseArray({{1, 1} -> 1, {2, 2} -> 2, {3, 3} -> 3, {1, 3} -> 4})
Associationscomma separated list of rules which are surrounded by <| ... |> and create a dictionary or map<|a->x, b->y, ...|>
Predefined Functionspredefined function names start with an upper case character and the arguments are enclosed by ( ... )Sin(0), PrimeQ(13)
Predefined Constantspredefined constant names start with an upper case characterDegree, E, Pi, False, True, ...
User-defined variablesidentifiers which you would like to assign a value start with a $ character in the server environment$a=42
User-defined variablesin the Symja console app user-defined variables can be defined without a preceding $ charactera=42
User-defined rulesidentifiers which you would like to assign a rule start with a $ character in the server environment$f(x_,y_):={x,y}
User-defined rulesin the Symja console app user-defined rules can be defined without a preceding $ characterf(x_,y_):={x,y}
Pattern Symbolspatterns end with an appended _ character and could have a constraint$f(x_Integer):={x}
Stringscharacter strings are enclosed by double quote characters"Hello World"
Pure Functionspure functions can be expressed with the & operator(#^3)&[x] gives x^3
Slotsa # character followed by an optional integer number# or #2
Slot Sequencesa # character followed by an optional integer number## or ##2
Parts of an expressionexpr[[index]]{a, b, c, d}[[2]] gives b