How to find the intercept of two functions?

You can use Roots.jl package.

using Roots
const attack_max2 = 0.90
const attack_min2 = 0.52
const β_V2 = 2.0
const b0V2 = 16.0 

demand(x) = 1.0/((1.0/(attack_max2 + attack_min2))*x^β_V2/(b0V2^β_V2+x^β_V2)+1/attack_max2)
boom(x) = (attack_max2 - attack_min2)*x^β_V2/(b0V2^β_V2+x^β_V2)+attack_min2

delta(x) = demand(x) - boom(x)

find_zero(delta, (0.1, 200.0), Bisection())
# 14.851477511590069

Or you can use Newton method

using ForwardDiff
D(f) = x -> ForwardDiff.derivative(f, float(x))
find_zero((delta,D(delta)), 10, Roots.Newton())
# 14.851477511590062

More details can be found in package itself.

5 Likes