obliczenia_naukowe/l1/6.jl

29 lines
541 B
Julia
Executable file

#!/usr/bin/env julia
# Jacek Poziemski 272389
"""
f(x::Float64)::Float64
Calculate `sqrt(x^2 + 1) - 1`.
# Arguments
- `x::Float64`: function argument
"""
f(x::Float64)::Float64 = sqrt(x^2 + one(Float64)) - one(Float64)
"""
g(x::Float64)::Float64
Calculate `x^2 / (sqrt(x^2 + 1) + 1)`.
# Arguments
- `x::Float64`: function argument
"""
g(x::Float64)::Float64 = x^2 / (sqrt(x^2 + one(Float64)) + one(Float64))
for i::Int in 1:20
x::Float64 = 8.0^(-i)
println("f(8^-$i) = $(f(x))")
println("g(8^-$i) = $(g(x))")
end