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
xy x-y
xy x*y
xy x/y (or y\x)
xy x÷y
remainder of x÷y x%y
xy x^y
|x| abs(x)
lnx log(x)
logab log(a,b)
ex exp(x)
π pi
sinx sin(x)
sin1x asin(x)
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)