Code
cos(pi))^2 (
1.0
At the Julia homepage The Julia Programming Language the language is described as fast, dynamic, reproducible, composable, general, open-source.
Installation is possible for all common operating systems. Install the Juliaup installation manager, which will automatically install julia and help keep it up to date.
Here is an output of the juliaup status
command:
>>> juliaup status
Default Channel Version Update
-------------------------------------------------
* release 1.11.1+0.x64.linux.gnu
For more information type juliaup help
in a terminal.
The Julia REPL (Read-Eval-Print-Loop) is the command-line interface for Julia. It is started by typing julia
in a terminal. It has different modes, e.g. help mode, shell mode, package mode,
?
at the beginning of the line.]
at the beginning of the line.backspace
or Ctrl-C
.Here is an example of a simple calculation in the Julia REPL standard mode:
cos(pi))^2 (
1.0
.emacs
configuration: .emacs.See basic_math.jl.
In package mode you can add packages with the add
command. Here is an example of adding the Plots package:
(@v1.11) pkg> add Plots
Type help
in package mode to get information about all available commands.
The Plots package is a powerful plotting package. Here is an example of a simple plot:
using Plots
= plot(size=(500, 300), legend=true)
plt
plot!(plt, sin, -2π, 2π, label="sin(x)", color="red", title="Title", xlabel="x", ylabel="y",
=5Plots.mm, bottom_margin=10Plots.mm, grid="on")
left_margin
= -2:0.1:2
x = x.^2
y plot!(plt, x, y, label="x^2", color="blue")
See also other plotting packages like Makie.
Use the DataFrames package for data manipulation.
using DataFrames
= DataFrame(A = 1:4, B = ["M", "F", "F", "M"])
df :C] = [1, 2, 3, 4]
df[!, df
Row | A | B | C |
---|---|---|---|
Int64 | String | Int64 | |
1 | 1 | M | 1 |
2 | 2 | F | 2 |
3 | 3 | F | 3 |
4 | 4 | M | 4 |
Use the JuMP package for optimization problems. See optimization.jl.
See the Imprint of the FHV - Vorarlberg University of Applied Sciences