Wiki
Clone wikisymja_android_library / Functions
Table of contents
Getting Started
Identifiers
An identifier is a user-choosen or built-in name for a variable, function or constant. Only the identifiers which consists of only one character are case sensitive. For all other identifiers the input parser doesn't distinguish between lower and upper case characters.
For example: the upper-case identifiers D,
E,
I,
N
are different from the identifiers d, e, i, n
, thereas the
functions like Factorial()
or
Integrate()
can alternatively be entered
as factorial()
or
integrate()
.
On output all built-in functions are starting with an upper case character
(Sin(),
Cos(),
Expand(),
Inverse()
, etc).
Built-in constants are also starting with an upper case letter
Degree,
E,
I,
Pi
, etc).
If you type SIN(x)
or sin(x)
, Symja assumes you always mean the same built-in
Sin(x)
function.
User-defined functions and variables typically start with a "$" character and are converted to lower case output
(i.e. the input $foo(x*y), $Foo(x*y), $FOO(x*y)
are all converted to $foo(x*y)
in the output).
Operators
Symja has an evaluation engine for mathematical expressions. The common arithmetic operations are:
+
addition-
subtraction*
scalar multiplication/
division^
exponentiation.
matrix multiplication
A semicolon operator ;
is used to separate multiple expressions. The following example shows two expressions
separated by the ";" operator, only the result for the second expression will be returned back after evaluation:
100!;32+8+2
gives 42
.
Strings
A string is a representation of text as a sequence of characters. Strings must be surrounded by double quotes. An example string:
"...Hello world..."
Expression types
Type | Description | Input Example |
Integer | integer numbers | 42 |
Rational | rational numbers | 13/17 |
Complex | complex numbers | 2+I*(1/3) |
Real | double values | 0.5 |
Complex Real | complex double values | 0.5-I*0.25 |
Evaluation Precedence | control precedence with (...) | (a+b)*c |
Lists | comma separated list of elements which are sourrounded by { ... } | {a, b, c, d} |
Vectors | vectors are like list, but cannot contain sublists { ... } | {1, 2, 3, 4} |
Matrices | a matrix contains the rows as sublists | { {1, 2}, {3, 4} } |
Predefined Functions | predefined function names start with an upper case character and the arguments are surrounded by ( ... ) | Sin(0), PrimeQ(13) |
Predefined Constants | predefined constant names start with an upper case character | Degree, E, Pi, False, True, ... |
Userdefined variables | identifiers which you would like to assign a value start with a '$ ' character | $a=42 |
Userdefined rules | identifiers which you would like to assign a rule start with a '$ ' character | $f(x_,y_):={x,y} |
Pattern Symbols | patterns end with a preceding '_ ' and could have a constraint | $f(x_IntegerQ):={x} |
Strings | character strings are enclosed by double quote characters | "Hello World" |
Slots | a # character followed by an optional number | # or #2 |
Pure Functions | pure functions can be expressed with the & operator | (#^3)&[x] gives x^3 |
Parts of an expression | expression[ [index] ] | {a, b, c, d}[ [2] ] gives b |
Examples
Find simplest form of:
24/60
Calculate the numerical value of:
N(24/60) or 24.0/60.0
Calculate sine in radians:
Sin(Pi/2)
Calculate sine in degrees:
Sin(30*Degree)
Simplify an expression:
a+a+4*b^2+3*b^2
FactorInteger(2^15-5)
D(Sin(x^3), x)
Integrate(x^2, x)
Factor(-1+x^16)
Factor a polynomial modulo an integer:
Factor(5+x^12, Modulus->7)
Expand((-1+x)*(1+x)*(1+x^2)*(1+x^4)*(1+x^8))
Inverse({{1,2},{3,4}})
Det({{1,2},{3,4}})
Solve a polynomial equation for x
:
Solve(a*x + b == 0, x)
Math functions
- Abs
- AddTo
- And
- Apart
- ArcCos
- ArcCot
- ArcCsc
- ArcSec
- ArcSin
- ArcTan
- Arg
- BernoulliB
- Binomial
- Boole
- BooleanMinimize
- Cancel
- CartesianProduct
- CatalanNumber
- Ceiling
- CharacteristicPolynomial
- ChessboardDistance
- Chop
- Coefficient
- CoefficientList
- Collect
- Complement
- Complex
- ComplexExpand
- ComposeList
- CompoundExpression
- Conjugate
- ConjugateTranspose
- ConstantArray
- ContinuedFraction
- CoprimeQ
- Cos
- Cosh
- Cot
- Coth
- Count
- Cross
- Csc
- Csch
- Curl
- D
- Decrement
- Default
- DeleteDuplicates
- Denominator
- Derivative
- Det
- DiagonalMatrix
- Diff
- Dimensions
- Discriminant
- Distribute
- Divergence
- DivideBy
- Dot
- DSolve
- Eigenvalues
- Eigenvectors
- Eliminate
- Equal
- Equivalent
- Erf
- EuclidianDistance
- EulerE
- EulerPhi
- EvalF
- EvenQ
- Exp
- Expand
- ExpandAll
- Exponent
- ExtendedGCD
- Extract
- Factor
- Factorial
- Factorial2
- FactorInteger
- FactorSquareFree
- FactorSquareFreeList
- FactorTerms
- Fibonacci
- FindRoot
- Fit
- Floor
- FractionalPart
- FrobeniusSolve
- FromCharacterCode
- FromContinuedFraction
- FromPolarCoordinates
- FullSimplify
- Function
- Gamma
- GCD
- GeometricMean
- Greater
- GreaterEqual
- GroebnerBasis
- HarmonicNumber
- HilbertMatrix
- Hold
- Horner
- IdentityMatrix
- Im
- Implies
- Increment
- Inner
- Int
- IntegerExponent
- IntegerPart
- IntegerPartitions
- IntegerQ
- Integrate
- InterpolatingFunction
- InterpolatingPolynomial
- Intersection
- Inverse
- InverseFunction
- JacobiMatrix
- JacobiSymbol
- Join
- KOrderlessPartitions
- KPartitions
- LCM
- Less
- LessEqual
- Level
- Limit
- LinearProgramming
- LinearSolve
- Log
- LowerCaseQ
- LUDecomposition
- ManhattanDistance
- Map
- MapAll
- MapThread
- MatchQ
- MatrixPower
- MatrixQ
- MatrixRank
- Max
- Mean
- Median
- Min
- Mod
- MoebiusMu
- MonomialList
- Most
- Multinomial
- Nand
- Negative
- NextPrime
- NFourierTransform
- NIntegrate
- NonCommutativeMultiply
- NonNegative
- Nor
- Norm
- Normalize
- Not
- NRoots
- NSolve
- NullSpace
- Numerator
- OddQ
- Or
- Order
- OrderedQ
- Out
- Outer
- Package
- PadLeft
- PadRight
- Part
- Partition
- Pattern
- Permutations
- Piecewise
- Plus
- Pochhammer
- PolynomialExtendedGCD
- PolynomialGCD
- PolynomialLCM
- PolynomialQ
- PolynomialQuotient
- PolynomialQuotientRemainder
- PolynomialRemainder
- Positive
- PossibleZeroQ
- Power
- PowerExpand
- PowerMod
- PreDecrement
- PreIncrement
- Prime
- PrimeQ
- PrimitiveRoots
- Product
- Quotient
- RandomInteger
- RandomReal
- Range
- Rational
- Rationalize
- Re
- Refine
- ReplaceAll
- ReplacePart
- ReplaceRepeated
- Resultant
- Reverse
- RootIntervals
- Roots
- Round
- RowReduce
- Rule
- RuleDelayed
- SameQ
- Scan
- Sec
- Sech
- Select
- Set
- SetAttributes
- SetDelayed
- Sign
- SignCmp
- Simplify
- Sin
- SingularValueDecomposition
- Sinh
- Solve
- Sort
- Sqrt
- SquaredEuclidianDistance
- SquareFreeQ
- StirlingS2
- Subsets
- SubtractFrom
- Sum
- SyntaxLength
- SyntaxQ
- Table
- Take
- Tan
- Tanh
- Taylor
- Thread
- Through
- Times
- TimesBy
- Timing
- ToCharacterCode
- Together
- ToPolarCoordinates
- ToString
- Total
- ToUnicode
- Tr
- Trace
- Transpose
- TrigExpand
- TrigReduce
- TrigToExp
- TrueQ
- Tuples
- Unequal
- Union
- UnitStep
- UnitVector
- UnsameQ
- UpperCaseQ
- UpSet
- UpSetDelayed
- ValueQ
- VandermondeMatrix
- Variables
- VectorAngle
- VectorQ
- Xor
System functions
- Append
- AppendTo
- Apply
- Array
- Attributes
- ArrayQ
- AtomQ
- Blank
- Block
- Break
- Cases
- Catch
- Clear
- ClearAll
- Condition
- Continue
- Definition
- Delete
- Depth
- Do
- Drop
- First
- FixedPoint
- Fold
- FoldList
- For
- FreeQ
- FullForm
- Head
- If
- Last
- LeafCount
- Length
- MemberQ
- Module
- N
- Nest
- NestList
- NestWhile
- NestWhileList
- NumberQ
- NumericQ
- Position
- Prepend
- PrependTo
- Reap
- Rest
- Return
- Riffle
- RotateLeft
- RotateRight
- Slot
- SlotSequence
- Sow
- Switch
- Throw
- Which
- While
String functions
Constants
Boolean values
Attributes
Headers
Other values
Numerical constants
Updated