Here’s some C++ functions which evaluate Chebyshev polynomials:
Chebyshev Polynomials of the first kind:
T0(x):
template <class T> T T0(const T& x);
T1(x):
template <class T> T T1(const T& x);
T2(x):
template <class T> T T2(const T& x);
Tn(x):
template <class T> T Tn(unsigned int n, const T& x);
Chebyshev Polynomials of the second kind:
U0(x):
template <class T> T U0(const T& x);
U1(x):
template <class T> T U1(const T& x);
U2(x):
template <class T> T U2(const T& x);
Un(x):
template <class T> T Un(unsigned int n, const T& x);
These are inline functions defined in the header file, chebyshev.h:
Here’s a sample program:
UPDATE: 2014-10-01:>
This project can now be found on GitHub:
– Chebyshev-polynomials
– HTTPS Clone URL: https://github.com/jachappell/Chebyshev-polynomials.git
– Download ZIP
i just need a C++ polynomial function only input and output streams
I don’t understand your program, however, i have a question for you. “How do you use a struct data type to create a function that evaluates polynomial addition, subtraction and synthetic division?” I would appreciate any help from you. Thanx.
I dont get your program,i have a problem with using struct data to create,input,display,adding,subtracting,dividing ,multiplying,deleting a polynomial of exponents in an array.Please I highly need your help.That will be my pleasure if i get your assistance
This is the same speed as using the trigononmetric definition:
T_n(x) = cos( n*acos(x) ) ONLY FOR -1 <= x <= 1
Tested on Win 7/C++
see http://en.wikipedia.org/wiki/Chebyshev_polynomials#Explicit_expressions