• API
• FAQ
• Tools
• Trends
• Archive
daily pastebin goal
57%
SHARE
TWEET

# Untitled

a guest Aug 13th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. T0(x) = 1
2. T1(x) = x
3. Tn+1(x) = 2*x*Tn(x) - Tn-1(x)
4.
5. T0(x) = 1
6. T1(x) = x
7. T2(x) = 2x^2 - 1
8. T3(x) = 4x^3 - 3 x
9. T4(x) = 8x^4 - 8x^2 + 1
10. T5(x) = 16x^5 - 20x^3 + 5x
11. T10(x) = 512x^10 - 1280x^8 + 1120x^6 - 400x^4 + 50x^2 - 1
12.
13. #~ChebyshevT~x&
14.
15. ChebyshevT
16.
17. polchebyshev
18.
19. f(n)=if(n<2,x^n,2*x*f(n-1)-f(n-2))
20.
21. 1a2,qi{0X\$+2f*@.-}*;`
22.
23. {1a2,@{0X\$+2f*@.-}*;}
24.
25. lFTi:"0yhEbFFh-]x
26.
27. l        % Push 1
28. FT       % Push [0 1]. These are the first two polynomials
29. i:"      % Input n. Do the following n times
30.   0      %   Push 0
31.   y      %   Duplicate most recent polynomial
32.   h      %   Concatenate: prepends 0 to that polynomial
33.   E      %   Multiply coefficients by 2
34.   b      %   Bubble up. This moves second-most recent polynomial to top
35.   FF     %   Push [0 0]
36.   h      %   Concatenate: appends [0 0] to that polynomial
37.   -      %   Subtract coefficients
38. ]        % End
39. x        % Delete. Implicitly display
40.
41. Cr1µ’ßḤ0;_’’\$ß\$µỊ?
42.
43. RḤ’÷Ḥ-*ḞÆṛæ«’µ1Ṡ?
44.
45. Cr1µ’ßḤ0;_’’\$ß\$µỊ?  Input: integer n
46.                 Ị   Insignificant - abs(n) <= 1
47.                     If true, n = 0 or n = 1
49. C                       Complement, 1-x
50.  r1                     Range to 1
51.                     Else
53.     ’                   Decrement
54.      ß                  Call itself recursively
55.       Ḥ                 Double
56.        0;               Prepend 0
57.          _              Subtract with
59.           ’’                Decrement twice
61.              ß              Call itself recursively
62.
63. f=->n{x=Polynomial.new 0,1;n<2?[1,x][n]:2*x*f[n-1]-f[n-2]}
64.
65. (0>.<:)2&*1:p.@;9:o._1^+:%~1+2*i.
66.
67. (0&,1:)`(-&2((-,&0 0)~2*0&,)&\$:<:)@.(>&1)
68.
69. f(n,x)==(n<2=>x^n;2*x*f(n-1,x)-f(n-2,x))
70.
71. (9) -> for i in [0,1,2,3,4,5,10] repeat output ["f(y)",i,"=", f(i,y)]
72.    ["f(y)",0,"=",1]
73.    ["f(y)",1,"=",y]
74.                    2
75.    ["f(y)",2,"=",2y  - 1]
76.                    3
77.    ["f(y)",3,"=",4y  - 3y]
78.                    4     2
79.    ["f(y)",4,"=",8y  - 8y  + 1]
80.                     5      3
81.    ["f(y)",5,"=",16y  - 20y  + 5y]
82.                       10        8        6       4      2
83.    ["f(y)",10,"=",512y   - 1280y  + 1120y  - 400y  + 50y  - 1]
84.                                                                Type: Void
85.
86. (9) -> o:=rule cos(n*%y)==f(n,cos(%y))
87.    (9)  cos(%y n) == 'f(n,cos(%y))
88.                     Type: RewriteRule(Integer,Integer,Expression Integer)
89.                                                               Time: 0 sec
90. (10) -> b:=o cos(20*x)
91.    (10)
92.                  20                18                16                14
93.      524288cos(x)   - 2621440cos(x)   + 5570560cos(x)   - 6553600cos(x)
94.    +
95.                   12                10               8              6
96.      4659200cos(x)   - 2050048cos(x)   + 549120cos(x)  - 84480cos(x)
97.    +
98.                4            2
99.      6600cos(x)  - 200cos(x)  + 1
100.                                                  Type: Expression Integer
101.                        Time: 0.48 (EV) + 0.02 (OT) + 0.10 (GC) = 0.60 sec
102.
103. f=n=>n?n>1?[0,...f(n-1)].map((e,i)=>e+e-(f(n-2)[i]||0)):[0,1]:[1]
104.
105. n=>[...Array(n+1)].map(g=(m=n,i)=>i<0|i>m?0:m<2?i^m^1:g(m-1,i-1)*2-g(m-2,i))
106.
107. f=(n,a=[1],b=[0,1])=>n?f(n-1,b,[0,...b].map((e,i)=>e+e-(a[i]||0))):a
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top