Mercurial > hg > octave-lyh
diff scripts/polynomial/polyval.m @ 7411:83a8781b529d
[project @ 2008-01-22 21:52:25 by jwe]
author | jwe |
---|---|
date | Tue, 22 Jan 2008 21:52:26 +0000 |
parents | a1dbe9d80eee |
children | 2df882e69f13 |
line wrap: on
line diff
--- a/scripts/polynomial/polyval.m +++ b/scripts/polynomial/polyval.m @@ -61,3 +61,16 @@ endfor endfunction + +%!assert(polyval ([1, 1, 1], 2) == 7); + +%!assert(all (all (polyval ([1, 1, 1], [0; 1; 2]) == [1; 3; 7]))); + +%!assert(isempty (polyval ([1, 1, 1], []))); + +%!assert(all (all (polyval ([1, 1, 1], [-1, 0; 1, 2]) == [1, 1; 3, 7]))); + +%!error polyval ([1, 2; 3, 4], [-1, 0; 1, 2]); + +%!assert(isempty (polyval ([], [-1, 0; 1, 2]))); +