This file is indexed.

/usr/share/yacas/examples/benchmark2.ys is in yacas 1.3.6-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Use("testers.ys");


DoNext(_string) <--
[
 NextTest("<font color=0000ff>" : string : "</font>");
 NewLine();
];

Echo({"<HTML><BODY BGCOLOR=\"ffffff\"><PRE><font size=4>"});

Echo({"An assorted selection of example calculations using Yacas"});

StartTests();

/*
*/

DoNext("Show that Integrate(-Pi,Pi) (Sin(n*x)*Cos(m*x)) is Pi*Delta(n,m)");

BenchShow(Simplify(Integrate(x,-Pi,Pi) (Sin(x)*Sin(2*x)) ));
BenchShow(Simplify(Integrate(x,-Pi,Pi) (Sin(2*x)*Sin(2*x)) ));
BenchShow(Simplify(Integrate(x,-Pi,Pi) (Sin(5*x)*Sin(5*x)) ));

BenchShow(Simplify(Integrate(x,-Pi,Pi) (Cos(x)*Cos(2*x)) ));
BenchShow(Simplify(Integrate(x,-Pi,Pi) (Cos(2*x)*Cos(2*x)) ));
BenchShow(Simplify(Integrate(x,-Pi,Pi) (Cos(5*x)*Cos(5*x)) ));

BenchShow(Simplify(Integrate(x,-Pi,Pi) (Sin(x)*Cos(2*x)) ));
BenchShow(Simplify(Integrate(x,-Pi,Pi) (Sin(2*x)*Cos(2*x)) ));
BenchShow(Simplify(Integrate(x,-Pi,Pi) (Sin(5*x)*Cos(5*x)) ));


DoNext("Get the first 5 coefficients of the Fourier series of x^2
on the domain -Pi to Pi. This should be (1/Pi)*Sum(n,0,4)a_n * Cos(n*x)");

BenchShow(Fourier(_n,_f) <-- (1/(Pi))*Integrate(x,-Pi,Pi)(f*Cos(n*x)) );
BenchShow(TableForm(Simplify(Table(Fourier(n,x^2),n,0,5,1))));

DoNext("Check that f:=x*Exp(-x/2) is a solution to the equation H(f)=E f
where E is a constant and H is D(x)D(x)f + f/x");

BenchCall(H(f):=(Deriv(x)Deriv(x)f) + f/x);
BenchCall(f:=x*Exp(-x/2));
BenchCall(res:=H(f));
BenchCall(PrettyForm(Simplify(res)));
BenchCall(PrettyForm(Simplify(res/f)));


DoNext("Show that the first few terms of the Taylor series expansion
of Sin(x) and Cos(x-Pi/2) are the same");
BenchCall(ans1:=Taylor(x,0,8)Sin(x));
BenchCall(PrettyForm(ans1));
BenchCall(ans2:=Taylor(x,0,8)Cos(x-Pi/2));
BenchCall(PrettyForm(ans2));
BenchShow(ans1-ans2);


DoNext("Determine a polynomial that goes through the points
(x,y) = { (-2,4), (1,1), (3,9) } and show that it is in fact x^2");

BenchCall(ans:=LagrangeInterpolant({-2,1,3},{4,1,9},x));
BenchCall(PrettyForm(ans));
BenchCall(PrettyForm(Simplify(ans)));

Echo({curline," examples shown"});

Echo({"</FONT></PRE></BODY></HTML>"});