obliczenia_naukowe/l2/2.jl

26 lines
405 B
Julia
Raw Normal View History

2024-11-08 12:04:48 +01:00
#!/usr/bin/env julia
# Jacek Poziemski 272389
import Pkg
Pkg.add("Plots")
using Plots
2024-11-08 17:06:50 +01:00
2024-11-11 00:40:18 +01:00
"""
f(x::Float64)::Float64
Calculate `e^x * ln(1 + e^-x)`.
# Arguments
- `x::Float64`: argument of the function
"""
function f(x::Float64)::Float64
return exp(x) * log(one(Float64) + exp(-x))
end
2024-11-08 17:06:50 +01:00
x = range(-10, 40, length=1000)
y = map(x -> f(x), x)
plot(x, y, label = "f(x)")
png("2-julia-plots.png")