## 2228 Reputation

17 years, 169 days

## Unitary from hermitian...

The case (a) is proven as follows:

## Matrix constructor...

You can use the Matrix constructor as follows:
```M := Matrix(8,9,(i,j) -> diff(x^i+(x+1)^j,x));
```
The determinants, though, all seem to be zero:
```with(LinearAlgebra):
seq(Determinant(DeleteColumn(M,i)),i=1..9);
```

## Use expand in conjunction with convert...

For your second example try the following:
```expr := -I*(1-exp(-2*I*x))/(1+exp(-2*I*x)):
simplify(expand(convert(expr,trig),x));
```

## Tensors...

If you (as I do myself) like things spelled out in glorious detail, then a great book on tensors is the book by David Lovelock and Hanno Rund: Tensors, Differential Forms, and Variational Principles. Concerning the difference between contravariant and covariant indices: They are of importance especially for spaces with indefinite metrics, i.e., metrics being neither positive- nor negative definite. An example is Minkowski spacetime, in which we live (if gravity is ignored): Here the metric in Cartesian coordinates may be taken as diag(-1,1,1,1). Because (as quite generally for any Riemannian space) indices are raised with the inverse metric (which is a second rank contravariant tensor), and lowered with the metric itself (which is a second rank covariant tensor), the -1 of the time-time component of the metric makes the contravariant- and covariant time-components of any vector (rank one tensor), and therefore also various components of any higher rank tensors (because tensors are tensor products of vectors), differ in sign. This can be contrasted with a metric like diag(1,1,1) for flat cartesian three-space, say, where it is of no importance as to whether the index is contravariant or covariant. But please be aware: Even for a (flat) space with definite metric it is useful/necessary to distinguish between contravariant and covariant indices whenever the coordinate system is chosen so that the metric and its inverse differ; an example: spherical coordinates of euclidian three-space.

## Create a maple.ini file...

You have to tell Maple where to find these files. This can be done by creating a text file called maple.ini in the Users-folder, which is a subfolder of the folder where the Maple program itself is installed. An example: Let Maple 11 be installed in C:/Programs/Maple 11/, and let maple.ind and maple.lib be located in D:/Maple/Packages/. Note that this example uses also a different drive, D. Then in the folder C:/Programs/Maple 11/Users/ create the text file maple.ini, using for instance Notepad, containing the following:
```savelibname := "D:/Maple/Packages/":
libname := libname,savelibname:
```
If you have several packages, and you wish to have them in separate folders, then you can expand the example above as follows:
```savelibname :=
"D:/Maple/Packages/Name_1/",
"D:/Maple/Packages/Name_2/",
"D:/Maple/Packages/Name_3/",
...
"D:/Maple/Packages/Name_n/":
libname := libname,savelibname:
```
Now, to access any package from within a worksheet use, as for any other standard packages of Maple, the with(...) command.

## Re and Im parts...

Maple has built in the commands Re(...) and Im(...), for the real and the imaginary parts, respectively. An example:
```expr := exp(I*theta);
Re(expr);
Im(expr);
```
Quite often, however, this does not explicitly give the real and imaginary parts. To achieve that use in conjuction with Re(...) and Im(...) the command evalc(...):
```evalc(expr);
evalc(Re(expr));
evalc(Im(expr));
```
In your case, for which the expression depends on several parameters, the real and imaginary parts may however become quite intricate. But have a go!

## Parametrizing and plotting the sphere...

Is the following of any help?
```x := (theta,phi) -> sin(theta)*cos(phi):
y := (theta,phi) -> sin(theta)*sin(phi):
z := (theta,phi) -> cos(theta):
plot3d([x(theta,phi),y(theta,phi),z(theta,phi)],theta=0..Pi,phi=0..2*Pi);
```

## General formula...

Generally, the solutions of the equation x^n = a can be given by
```x := (a,n,m) -> (a)^(1/n)*(cos(2*Pi*m/n)+I*sin(2*Pi*m/n));
```
where m, running from 0 to n-1, numbers the n different roots. An example using the equation x^n = 1+I:
```x(1+I,3,1);
x(1+I,3,2);
x(1+I,3,3);

(1+I)^(1/3)*(-1/2+1/2*I*3^(1/2))
(1+I)^(1/3)*(-1/2-1/2*I*3^(1/2))
(1+I)^(1/3)
```
Up to a different order of the roots, this agrees with what the Maple command solve(...) gives
```solve(x^3=1+I,x);

(1+I)^(1/3),
-1/2*(1+I)^(1/3)+1/2*I*3^(1/2)*(1+I)^(1/3),
-1/2*(1+I)^(1/3)-1/2*I*3^(1/2)*(1+I)^(1/3)
```
Checking:
```simplify(solve(x^3=1+I,x)[1]-x(1+I,3,3)),
simplify(solve(x^3=1+I,x)[2]-x(1+I,3,1)),
simplify(solve(x^3=1+I,x)[3]-x(1+I,3,2));

0, 0, 0
```

## Using op(...)...

Maybe you can use the following:
```expr := a(m) * f(z);
op(expr)[1];
op(expr)[2];

expr := a(m) f(z)
a(m)
f(z)

Generally, you can break down any statement, step-by-step, using op(...).```

## Using map(...)...

You can use the following:
```map(x -> f(x),A);
```

## Index an Array...

Your problem reminded me of a similar problem I had, when I was working on my Maple package "Gravitation". It can be solved as follows:
````index/index` := proc(indices::list,array::Array,value::list)
# Retrieving from the Array
if nargs = 2 then return array[op(indices)]: end if:
# Storing in the Array
if nargs = 3 then array[op(indices)] := indices = op(value): end if:
end proc:

A := Array(1..10,i -> 2*i);
B := Array(index,A);
convert(map(x -> if rhs(x) mod 3 = 0 then op(lhs(x)): end if,B),set);
```

## Using nested seq(...)'s...

Though not being a single command, here is another way which gives a list of combinations: [seq(seq(seq([A[i],B[j],C[k]],k=1..nops(C)),j=1..nops(B)),i=1..nops(A))]; To get them nicely ordered, maybe it would be preferable to let A, B, and C themselves be lists, instead of sets.
 First 17 18 19 Page 19 of 19
﻿