Supported mathematical functions, operators and constants

Mathematical functions:

Function name Alternate name Parameters Description Notes
if &mdash; <code>(test,a,b)</code> If-else function. If the test returns true, the result is a, else it returns b. Example:
B1 out 0 V={if(v(1)>5, v(1)**2, 0)}
sin sine <code>( x )</code Sine function. &mdash;
asin arcsin <code>( x )</code Arc-sine function. &mdash;
sinh &mdash; <code>( x )</code Hyperbolic sine function. &mdash;
asinh arcsinh <code>( x )</code Arc-hyperbolic sine function. &mdash;
cos &mdash; <code>( x )</code Cosine function. &mdash;
acos arccos <code>( x )</code Arc-cosine function. &mdash;
cosh &mdash; <code>( x )</code Hyperbolic cosine function. &mdash;
acosh arccosh <code>( x )</code Arc-hyperbolic cosine function. &mdash;
tan &mdash; <code>( x )</code Tangent function. &mdash;
tanh &mdash; <code>( x )</code Hyperbolic tangent function. &mdash;
atan arctan <code>( x )</code Arc-tangent function. &mdash;
atanh arctanh <code>( x )</code Arc-hyperbolic tangent function. &mdash;
atan2 &mdash; <code>( x, y )</code. Atan 2 function. Same as: <br>atan (x/y)
exp &mdash; <code>( x )</code Calculates the exponential e<sup>x</sup>. &mdash;
expl &mdash; <code>( x )</code Calculates the exponential with a maximum value. Same as: <br> min (exp (x), y)
ln &mdash; <code>( x )</code The natural logarithm function. &mdash;
log10 &mdash; <code>( x )</code The base-10 logarithm function. &mdash;
log &mdash; <code>( x )</code The generic logarithm function.
This function is included for legacy compatibility and its use is not recommended.
Normally this is the same as ln(x) except in 'B' arbitrary sources where it is log10(x). This behavior is also changed by the .SYNTAX statements.
sqrt &mdash; <code>( x )</code Square root function. &mdash;
abs &mdash; <code>( x )</code Absolute value function. &mdash;
sgn &mdash; <code>( x )</code Sign or signum function. if (x < 0)
sgn(x) == -1
if (x > 0)
sgn(x) == 1
if (x == 0)
sgn(x) == 0
max &mdash; <code>( x, y )</code. Returns the maximum of x and y. &mdash;
min &mdash; <code>( x, y )</code. Returns the minimum of x and y. &mdash;
uramp &mdash; <code>( x )</code Ramp function, clips the value against a minimum of 0. if (x < 0)
uramp(x) == 0
if (x >= 0)
uramp = x
u stp, step <code>( x )</code Step function. if (x < 0)
u(x) == 0
if (x > 0)
u(x) == 1
if (x == 0)
u(x) == 0.5
table &mdash; <code>(expr, x1,y1, &lt;x2,y2 &lt;...&gt;&gt;)</code> Piecewise linear function. Specified x-values must be increasing in value from left to right.
Inputs below x1 result in an output equal to y1. Inputs above xn (the largest specified x-value), result in an output equal to yn. In other words, table function acts as a limiter in those regions.
Using this function in a Value-type Arbitrary source is functionally equivalent to using the Table-type source.
The following line:
E1 out 0 value={Table(v(in), -60m,-4,0,0,140m,43.3)}
is functionally equivalent to the following line:
E1 out 0 TABLE {v(in)} (-60m,-4,0,0,140m,43.3)
limit &mdash; <code>( x, a, b ) </code> Clips the input value x to the range (A,B). &mdash;
pwr &mdash; <code>( x, y )</code. The pwr function. Same as:
abs(x)^y
pwrs &mdash; <code>( x, y )</code. The pwrs function. if (x < 0)
pwrs(x) == -(x**y)
if (x >= 0)
pwrs(x) == (x**y)
ddt &mdash; <code>( x )</code. Time derivative. ddt(v(1)*v(CapVoltagenode))
sdt &mdash; <code>( x )</code. Time integral. 1meg*sdt(I(Vsense)+8)
V &mdash; <code>(node)</code> Voltage of a node. Can only be used in non-linear controlled source expressions.
V &mdash; <code>(node1, node2)</code> Voltage difference of two nodes. Can only be used in non-linear controlled source expressions.
Same as:
V(node1)-V(node2)
Example:
E1 out 0
value={V(1,2)*15}
I &mdash; <code>(voltage source) or (inductor)</code> Current through a voltage source or an inductor. Can only be used in non-linear controlled source expressions.
Example:
E1 out 0
value={I(Vsense)**2
+ I(E99)}<br>Vsense and E99 are the SPICE netlist names of the devices. They are case insensitive.
positive &mdash; <code>( x )</code Ensure positive function. if (x < d)
positive(x) = d
else
positive(x) = x
where d is 1.0p
negative &mdash; <code>( x )</code Ensure negative function. if (x > -d)
negative(x) = -d
else
negative(x) = x
where d is 1.0p
nonpos &mdash; <code>( x )</code Ensure not-positive function. if (x > 0)
nonpos(x) = 0
else
nonpos(x) = x
nonneg &mdash; <code>( x )</code Ensure not-negative function. if (x < 0)
nonneg(x) = 0
else
nonneg(x) = x
nonzero &mdash; <code>( x )</code Ensure non-zero function. if (x < d) & (x >= 0)
nonzero(x) = d
if (x > -d) & (x <= 0)
nonzero(x) = -d
else
nonzero(x) = x
where d is 1.0p
zero &mdash; <code>( x )</code Evaluates x but always returns a value of 0.0. &mdash;
one &mdash; <code>( x )</code Evaluates x but always returns a value of 1.0. &mdash;
schedule &mdash; <code>(x1,y1, &lt;x2,y2&lt;…&gt;&gt;) </code> Schedule function. Gives a value of yN for when time between xN and xN+1. Time is simulation time.

Mathematical operators:

Symbol Alternate Symbol Description Usage
+ Addition. A + B
- Subtraction. A - B
/ Division. A / B
* Multiplication. A * B
** ^ Exponentiation (power). A ** B or A ^ B
These take the absolute value of the base. This is consistent with PSpice®.
This can be interpreted differently in other simulators.
< Less than. A < B
<= Less than or equal to. A <= B
> Greater than. A > B
>= Greater than or equal to. A >= B
== Equal to. A == B
!= Not equal to. A != B
& Logical AND. A & B
| Logical OR. A | B
xor Logical XOR. A XOR B
?: Ternary if. This operator has two symbols and three operands. A ? B : C
This is the same as IF(A,B,C).

Built-in constants

Symbol Description Value
true Boolean true value. 1.0
false Boolean false value. 0.0
yes Alternate form of boolean true value. 1.0
no Alternate form of boolean false value. 0.0
pi The constant pi. 3.14159265358979323846
e The constant e. 2.71828182844590452353
c The speed of light. 2.99792458e8
kelvin Constant to convert between degrees Kelvin and Celsius, and vice versa. -273.0
echarge Electron charge. 1.602176487e-19
boltz Boltzmann's constant. 1.3806503e-23
planck Planck's constant. 6.62606896e-34
temp Current temperature of the simulation in degrees Celsius. The default is 27, but it can be changed from the simulation options.
time Current time of the simulation in seconds. Current time of the simulation in seconds (it is constant with respect to circuit variables).

    IMPORTANT! Unlike most mathematical languages, Multisim considers the unary minus to have higher precedence than exponentiation (power) operators ** and ^. This means that {-5**2} is +25 while {0-5**2} is -25. Although this is unintuitive, it is standard among SPICE simulators. Use brackets to ensure logical, readable expressions in this case.