Link Search Menu Expand Document (external link)

How to do basic mathematical computations (in Julia)

See all solutions.

Task

How do we write the most common mathematical operations in a given piece of software? For example, how do we write multiplication, or exponentiation, or logarithms, in Python vs. R vs. Excel, and so on?

Solution

Mathematical notation Julia code
$x+y$ x+y
$x-y$ x-y
$xy$ x*y
$\frac xy$ x/y (or y\x)
$\left\lfloor\frac xy\right\rfloor$ x÷y
remainder of $x\div y$ x%y
$x^y$ x^y
$\vert x\vert$ abs(x)
$\ln x$ log(x)
$\log_a b$ log(a,b)
$e^x$ exp(x)
$\pi$ pi
$\sin x$ sin(x)
$\sin^{-1} x$ asin(x)
$\sqrt x$ sqrt(x)

Other trigonometric functions are also available besides just sin including cos, tan, etc.

Content last modified on 24 July 2023.

See a problem? Tell us or edit the source.

Contributed by Nathan Carter (ncarter@bentley.edu)