obliczenia_naukowe/l1/6.jl
2024-10-27 21:56:24 +01:00

33 lines
544 B
Julia
Executable file

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