This is a small tour of the capabilities Yacas currently offers. Note that this list of examples is far from complete. Yacas contains a few hundred commands, of which only a few are shown here.
Additional example calculations including the results can be found here:
100!; |
ToBase(16,255); FromBase(16,"2FF"); |
Expand((1+x)^5); |
Apply("+",{2,3});
|
Apply({{x,y},x+y},{2,3});
|
D(x)D(x) Sin(x); |
Solve(a+x*y==z,x); |
Taylor(x,0,5) Sin(x); |
Limit(x,0) Sin(x)/x; |
Newton(Sin(x),x,3,0.0001); |
DiagonalMatrix({a,b,c});
|
Integrate(x,a,b) x*Sin(x); |
Factors(x^2-1); |
Apart(1/(x^2-1),x); |
The function g(q,phi,chi) is defined by
To solve this problem, we prepare a separate file with the following Yacas code:
/* Auxiliary function */
g1(n, q, phi, chi) := [
Local(s);
s := q^2-n^2;
N(Cos(n*chi) * If(s=0,
1/2, /* Special case of s=0:
avoid division by 0 */
Sin(Sqrt(s)*phi)/Sin(2*Sqrt(s)*phi)
/* now s != 0 */
/* note that Sqrt(s) may
be imaginary here */
)
);
];
/* Main function */
g(q, phi, chi) := [
Local(M, n);
M := 16;
/* Exp(-M) will be the precision */
/* Use N() to force numerical
evaluation */
N(1/2*Sin(q*phi)/Sin(2*q*phi)) +
/* Estimate the necessary number
of terms in the series */
Sum(n, 1, N(1+Sqrt(q^2+M^2/phi^2)),
g1(n, q, phi, chi)) ;
];
/* Parameters */
q:=3.5;
phi:=2;
/* Make a function for plotting:
it must have only one argument */
f(x) := g(q, phi, x);
/* Plot from 0 to 2*Pi with 80 points */
Plot2D(f(x), 0: 2*Pi);
|
Name this file "fun1" and execute this script by typing
Load("fun1");
|