# Solve/find_root for miscellaneous special function elliptic_kc?

I am looking to use solve() or find_root() with a function defined using elliptic_kc (sage.functions.special.EllipticKC), however Sage produces an error. The context of this is for use in a coplanar waveguide impedance calculation.

Example:

sage: find_root(elliptic_kc(x)==2, x, 0, 0.5)

[...]

'TypeError: unable to simplify to float approximation'.

and

sage: solve(2.0==elliptic_kc(x), x, to_poly_solve=True)

[...]

TypeError: 'sage.symbolic.expression.Expression' object is not subscriptable

Is there a convenient way to perform a solve/numerical root for these special functions?

Oh huh, I found a solution using scipy.optimize.root_scalar. It's not the cleanest, but I suppose it works.

To display code blocks, indent them by four spaces.