/usr/share/yacas/example.rep/code.ys is in yacas 1.3.3-2.
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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | examplelist:=
Hold(
{
{40!,
"Simple factorial of a number.
"
},
{D(x)Sin(x),
"Taking the derivative of a function (the derivative of Sin(x) with
respect to x in this case).
"
},
{Taylor(x,0,5)Sin(x),
"Expanding a function into a taylor series.
"
},
{Integrate(x,a,b)Sin(x),
"Integrate a function.
"
},
{Solve(a+x*y==z,x),
"Solve a function for a variable.
"
},
{Limit(x,0) Sin(x)/x,
"Take a limit.
"
},
{Subst(x,Cos(a)) x+x,
"Substitute an expression with another in the main expression.
"
},
{Expand((1+x)^3),
"Expand into a polynomial.
"
},
{2^40,
"Big numbers.
"
},
{1<<40,
"Bitwise operations
"
},
{1 .. 4,
"Generating a list of numbers.
"
},
{a:b:c:{},
"Generating a list of items.
"
},
{[Local(x);x:={a,b,c};Sin(x)^2;],
"Threading: Sin(..)^2 will be performed on all elements of the list
passed in.
"
},
{[Local(list);list:={a,b,c,d,e,f}; list[2 .. 4];],
"Selecting a sublist from a list.
"
},
{Permutations({a,b,c}),
"Generate all permutations of a list.
"
},
{VarList(a+b*x),
"Show all variables that occur in an expression.
"
},
{TrigSimpCombine(Cos(a)*Cos(a)+Sin(a)*Sin(a)),
"Convert factors between trigonometric functions to addition of
trigonometric functions.
"
}
}
);
exampleindex:=0;
Example():=
[
exampleindex++;
If (exampleindex>Length(examplelist),exampleindex:=1);
Local(example);
example:=examplelist[exampleindex];
WriteString("Current example : ");
Write(example[1]);WriteString(";");NewLine();
NewLine();
WriteString(example[2]);
NewLine();
Eval(example[1]);
];
|