Andreas132

30 Reputation

0 Badges

0 years, 219 days

MaplePrimes Activity


These are questions asked by Andreas132

Hey!

I am working on a 2-dimensional real curve gamma, that is being deformed by a real 2x2 matrix A and translated by some shift vector s. Both the matrix A and the vector s depend on two real parameters alpha and beta, which vary between 0 and 1. My goal is to create an animated plot that shows the curve depending on the parameters alpha and beta (ideally with some sort of slider, so I can play with different values of alpha and beta). I am having a hard time animating this, also because I am unsure if this is actually possible in Maple. The code I am working with is so far:

with(plots);
with(LinearAlgebra);
f := x -> exp(2*I*Pi*x);
CDFT := Matrix(3, 3, [[1, 1, 1], [1, f(1/3), f(2/3)], [1, f(2/3), f(1/3)]]);

al := 10/100;
be := 10/100;
lam1 := f(al);
lam2 := f(be);
lam3 := f(-al - be);
coef := (1/3*HermitianTranspose(CDFT)) . (Vector[column](3, [lam3, lam2, lam1]));
a := coef[1];
b := coef[2];
c := coef[3];

gam := t -> MatrixVectorMultiply(Matrix(2, 2, [[Re(a^2 + b*c), -Im(a^2 - b*c)], [Im(a^2 + b*c), Re(a^2 - b*c)]]), Vector[column](2, [cos(2*t) - 2*cos(t), sin(2*t) + 2*sin(t)])) + 3*Vector[column](2, [Re(b*c), Im(b*c)]);
P1 := plot([cos(2*t) - 2*cos(t), sin(2*t) + 2*sin(t), t = 0 .. 2*Pi], color = [blue]);
P2 := plot([gam(t)[1], gam(t)[2], t = 0 .. 2*Pi], color = [purple]);
plots:-display([P1, P2]);

Note that you can basically ignore everything up to the definition of the curve gam (short for gamma), apart from the definition of the parameters al and be (alpha and beta). The plot P1 corresponds to the "unperturbed curve", i.e. when we multiply the curve by the identity, which happens for alpha=beta=0. The plot P2 is now the deformed curve. The output is then:

My goal is now to animate this plot such that I can play with different values of alpha and beta, without having to manually insert them. How do I do this?

So I have a complex-valued function f that depends on two real variables x and y. I want to plot its range, i.e. the set of all values f(x,y), where x and y vary over their entire domain (which is a compact subset of R^2). Since I did not find of a direct way to do this, I decided to just compute the output f(x,y) at a finite set of points and plot these values in the complex plane. This gives me a rough idea of what the range should look like. However, this process is very slow (even though it should not be that slow, in my opinion). Here is the code I have used:

f := x -> exp(2*I*Pi*x);
S1 := (x, y) -> Matrix(3, 3, [[f(x - y), 0, 0], [0, 1, 0], [0, 0, f(-y)]]);
S2 := (x, y) -> Matrix(3, 3, [[f(y), 0, 0], [0, f(y - x), 0], [0, 0, 1]]);
C := Typesetting[delayDotProduct](1/sqrt(3), Matrix(3, 3, [[1, 1, 1], [1, f(1/3), f(2/3)], [1, f(2/3), f(1/3)]]), true);
with(LinearAlgebra);
d := LinearAlgebra[Determinant](C . C);
V := (x, y) -> (((S1(x, y)/d^(1/3)) . C) . (S2(x, y))) . C;
tracevals := [];

for i from 0 to 100 do
    for j from 0 to 100 do tracevals := [op(tracevals), Trace(V(0.01*i, 0.01*j))]; end do;
end do;
with(plots);
P2 := complexplot(tracevals, x = -2 .. 3, y = -3 .. 3);

Note that the specific example (i.e. plotting the trace of a unitary matrix V(x,y)) is not really important to this question. We could instead think of any complex-valued function f(x,y), it should not have any impact on the problem. Maple generates the following output:

Even though this output shows quite well the range that the function will take, it takes almost two minutes to generate. Is there a quicker or more elegant way to compute the range of a function?

I am working with a family of unitary matrices, that depend on two parameters x and y in a smooth way. Their eigenvalues are thus complex numbers of absolute value 1. My goal is to plot the bands (i.e. the argument of the eigenvalues). I know that there exists a parametrization of the eigenvalues such that the corresponding bands are continuous. In particular, I use the following code:

f := x -> exp(2*I*Pi*x);
S1 := (x, y) -> Matrix(3, 3, [[f(x - y), 0, 0], [0, 1, 0], [0, 0, f(-y)]]);
S2 := (x, y) -> Matrix(3, 3, [[f(y), 0, 0], [0, f(y - x), 0], [0, 0, 1]]);
C := Typesetting[delayDotProduct](1/sqrt(3), Matrix(3, 3, [[1, 1, 1], [1, f(1/3), f(2/3)], [1, f(2/3), f(1/3)]]), true);
d := LinearAlgebra[Determinant](C . C);
V := (x, y) -> (((S1(x, y)/d^(1/3)) . C) . (S2(x, y))) . C;
with(LinearAlgebra);
bands := (x, y) -> -I*ln~(Eigenvalues(V(x, y)));

with(plots);
plot3d({bands(x, y)[1], bands(x, y)[2], bands(x, y)[3]}, x = 0 .. 1, y = 0 .. 1);

However, the output is the following plot:

One can see that the bands can technically be chosen in a way such that they are continuous and we dont have those weird vertical jumps. Is there a way to make Maple choose them like this? Or is there a way to at least surpress these vertical jumps in the plot, so that the plot is a bit more ordered? Ideally I would like a way that works for more examples than the one I gave above (I'd like to do these plots for different matrices C), but any help is appreciated!

 

Edit: Maybe an easier starting point is the following: If I choose the matrix C to be the identity matrix, the bands are of a nicer form:

We can see that Maple parametrizes the bands in a continuous way. The only problem is the vertical jumps that happen when the argument switches from pi to -pi. Is there a way to avoid plotting these jumps, so the plot does not include these vertical lines?

Page 1 of 1