Hi all,
I have the formula for the first derivative for secant inverse:
D_{x} \sec^{-1} \ x = \frac{1}{|x| \sqrt{x^{2}-1}}
with |x| > 1
I can manually find the second derivative (the second is very complex). Then copy the equation manually, but it can’t be plotted. Thus, I comment the last 2 lines. How to plot the second derivative of \sec^{-1} \ x ?
using Plots, LaTeXStrings, SymPy, Plots.PlotMeasures
gr()
function pitick(start, stop, denom; mode=:text)
a = Int(cld(start, π/denom))
b = Int(fld(stop, π/denom))
tick = range(a*π/denom, b*π/denom; step=π/denom)
ticklabel = piticklabel.((a:b) .// denom, Val(mode))
tick, ticklabel
end
function piticklabel(x::Rational, ::Val{:text})
iszero(x) && return "0"
S = x < 0 ? "-" : ""
n, d = abs(numerator(x)), denominator(x)
N = n == 1 ? "" : repr(n)
d == 1 && return S * N * "π"
S * N * "π/" * repr(d)
end
function piticklabel(x::Rational, ::Val{:latex})
iszero(x) && return L"0"
S = x < 0 ? "-" : ""
n, d = abs(numerator(x)), denominator(x)
N = n == 1 ? "" : repr(n)
d == 1 && return L"%$S%$N\pi"
L"%$S\frac{%$N\pi}{%$d}"
end
a, b = 0, π
f(x) = sec.(x)
xs = range(a, b, length=150)
ys = f.(xs)
plot(ys, xs, color=:red, ytick=pitick(a, b, 2; mode=:latex),
xlims=(-3,3), ylims=(0, π), framestyle=:zerolines,
linestyle=:solid, linecolor=:red2,
legend=:topleft, label=L"\sec^{-1} \ x",
bottom_margin=3mm,
size=(800, 400), tickfontsize=10)# the inverse function
@syms x::(real,positive)
h(x) = 1/(abs(x)*sqrt(x^2-1))
xs1 = range(1, b, length=150)
ys1 = h.(xs1)
# diff(h(x),x)
plot!(xs1, ys1, label=L"D_{x} \sec^{-1} \ x = \frac{1}{|x| \sqrt{x^{2} - 1}}", framestyle=:zerolines)
#h2(x) = -x/((x^2 - 1)^(3/2)*abs(x)) - (re(x)*Derivative(re(x), x) + im(x)*Derivative(im(x), x))*sign(x)/(x*sqrt(x^2 - 1)*Abs(x)^2)
#plot!(h2, label=L"D^{2}_{x} \sec^{-1} \ x ", framestyle=:zerolines)