How to do basic mathematical computations (in Julia)
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 (or y\x ) |
|
x÷y |
|
remainder of |
x%y |
x^y |
|
abs(x) |
|
log(x) |
|
log(a,b) |
|
exp(x) |
|
pi |
|
sin(x) |
|
asin(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)