Signing the points were 2 functions are equal

Hello, there!
I’m working with some numerical calculations, plotting 2 diferent functions as follows:

using Plots

h=0
K=1.5
g(y) = y
j(y) = tanh(K*y+h)

plot(g,xlim=(-1.5,1.5),label=("g(y)=y"),xlabel=("y"),ylabel=("g(y),j(y)"))
plot!(j,label=("j(y)=tanh(Ky+h)"))

Thats working fine, and the result is this plot:
gj
Now, I would like to mark the points where both functions intersect. How can I do that?

You are looking for the roots of

f(y) = g(y) - j(y)

See eg

https://github.com/JuliaMath/Roots.jl/

2 Likes

Got it! Thanks!