<?xml version="1.0" encoding="utf-8" standalone="no"?><?xml-stylesheet href="/mathmlc2p.xsl" type="text/xsl"?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>chebyshev_rb</title>
</head>
<body>
<tt>
#<br/>
# jruby examples for jas.<br/>
# $Id: chebyshev.rb 4879 2014-08-23 20:27:43Z kredel $<br/>
#<br/>
<br/>
require &quot;jas&quot;<br/>
<br/>
# chebyshev polynomial example<br/>
# T(0) = 1<br/>
# T(1) = x<br/>
# T(n) = 2 * x * T(n-1) - T(n-2)<br/>
<br/>
#r = Ring.new( &quot;Z(x) L&quot; );<br/>
r = PolyRing.new( ZZ(), &quot;(x)&quot;, PolyRing.lex );<br/>
puts &quot;Ring: &quot; + str(r);<br/>
puts;<br/>
<br/>
# sage like: with generators for the polynomial ring<br/>
#is automatic: one,x = r.gens();<br/>
<br/>
x2 = 2 * x;<br/>
<br/>
N = 10;<br/>
T = [one,x];<br/>
for n in 2..N<br/>
    t = x2 * T[n-1] - T[n-2];<br/>
    T[n] = t;<br/>
end<br/>
<br/>
for n in 0..N<br/>
  puts &quot;T[#{n}] = #{T[n]}&quot;;<br/>
end<br/>
<br/>
puts;<br/>
<br/>
#sys.exit();<br/>
</tt>
</body>
</html>
