# Approximate implicit function on real line

**URL:** https://discourse.julialang.org/t/approximate-implicit-function-on-real-line/125421
**Category:** Numerics
**Tags:** question, approximation
**Created:** [January 31, 2025, 8:19am UTC](https://discourse.julialang.org/t/approximate-implicit-function-on-real-line/125421 "2025-01-31T08:19:23Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [January 31, 2025, 1:10pm UTC](https://discourse.julialang.org/t/approximate-implicit-function-on-real-line/125421/4 "2025-01-31T13:10:11Z")

</div>

> [@Tamas\_Papp](#):
>
> It is easy to find the solution numerically (eg with Newton’s method). But I need to evaluate it a gazillion times for a given set of a\_i, b\_i, so I want to speed up the calculation. Currently it is taking up 70% of my runtime 🙁 […]  
> I would solve for y(x) on some grid, approximate that, and from then on look up values from a quick approximation.

See also: [Approximate inverse of a definite integral - #3 by stevengj](https://discourse.julialang.org/t/approximate-inverse-of-a-definite-integral/83181/3)

For a smooth function, you can get exponential convergence on a finite interval by evaluating on a Chebyshev grid and then interpolating with a polynomial, ala ApproxFun.jl or FastChebInterp.jl (as in the above post).

But I guess you have already thought about Chebyshev polynomials?

> [@Tamas\_Papp](#):
>
> If I had lim x→±∞ y(x)=0 or some constant I would know how to approximate it with Chebyshev polynomials (appropriately transformed to R) But the asymptotes are giving me a hard time.

Just subtract off the asymptotes and approximate the what’s left? Oh, I see that you already thought of this:

> [@Tamas\_Papp](#):
>
> It would be great to have a nice (= cheap, smooth, …) function g(x) that fits the asymptotes, then I would approximate y(x) - g(x).

> [@Tamas\_Papp](#):
>
> The approximation should be AD friendly but that should not be difficult.

FastChebInterp.jl should be AD-friendly (it works with ForwardDiff, and it also hooks into ChainRules.jl to expose its own optimized derivatives to AD).

---

_[View the full topic](https://discourse.julialang.org/t/approximate-implicit-function-on-real-line/125421)._
