Why does poly() not evalp

7 views (last 30 days)
Billy
Billy on 14 Jun 2011
I have an example:
evalp( poly( sqrt( 1-x^2 ), [x] ), x=cos(0.5) )
This gives (sqrt(1-x^2)) as the response.
The expected result is only given by
evalp( poly( sqrt( 1-x^2 ), [x] ), x=cos(0.5) ) | x=cos(0.5)
And evalp works as expected with simple expression like
evalp( poly( x, [x] ), x = 1 )
Is this a bug?

Accepted Answer

Walter Roberson
Walter Roberson on 15 Jun 2011
sqrt( 1-x^2 ) is not a polynomial. evalp() is only for evaluating polynomials.
I am not familiar with the way you used "|" in your second expression. I looked through the Standard Library but I do not find any meaning defined for "|" . Could you give a reference on that?
  4 Comments
Billy
Billy on 15 Jun 2011
I'm using poly() to simulate the output of my P function I just wrote, which outputs a poly() (in turn because orthpoly::legendre outputs a poly).
Ultimately I'm trying to evaluate the legendre polynomials with cos(t) in the place of x in legendre(n,x).
Billy
Billy on 15 Jun 2011
The P function is here: http://www.mathworks.com/matlabcentral/answers/9485-how-do-i-specify-m-for-orthpoly-legendre

Sign in to comment.

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!