Chebyshev icon indicating copy to clipboard operation
Chebyshev copied to clipboard

Approximation gives wrong results.

Open martinpflaum opened this issue 1 year ago • 1 comments

Hello, i like your programm it works very good for a lot of cases. But it is not working at all with Abs from sympy. Any idea on how to fix this? Below is my simple test. The function that should be approximated is Abs(x). It has an analytical solution with the polynom -x since the domain is from -1 to 0. The approximation is sadly not correct as far as i can see.

#%%
import re
from sympy import exp, ln, sin, cos
from sympy.abc import x
from sympy import Max,Abs

from chebyshev.approximation import get_best_approximation

func = Abs(x)

table_of_contents = []

approximation = get_best_approximation(func, (-1,0), 7, 20)
approximation.plot_approximation(show=True)

# %%

regards, Martin

martinpflaum avatar Feb 26 '24 19:02 martinpflaum

what smoothness requirements are on the function f for this method to work?

martinpflaum avatar Feb 26 '24 19:02 martinpflaum