blob: 52217048262bac3e7e828ca16e80daac1f5ac512 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA - F.D
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
function Tn=chepol(n,var)
//Chebychev polynomial
// n :Polynomial order
// var :Polynomial variable (character string)
// Tn :Polynomial in var
//
//!
if n==0 then
Tn=poly(1,var,"coeff"),
elseif n==1 then
Tn=poly(0,var);
else
T0=poly(1,var,"coeff");
T1=poly(0,var)
for k=2:n
Tn=2*poly(0,var)*T1-T0
[T1,T0]=(Tn,T1);
end
end
endfunction
|