2
$\begingroup$

For the code below, I am trying to make it such that when I go through $\alpha$ values, the plot updates. However, currently, it just plots with a stagnant $\alpha$ value with no updating. When I try to redefine everything in terms of a function of $\alpha$, mathematica tells me that I cannot use graphics and define variables. For instance, I cannot write plotcoordinates[$\alpha$] due to the limitations of graphics. How can I get around this to have the plot update as I wish in the slide bar?

plotcoordinates = 
  Graphics3D[{Arrow[{{0, 0, 0}, {0, 1, 0}}], 
    Arrow[{{0, 0, 0}, {1, 0, 0}}], 
    Arrow[{{0, 0, 0}, {0, 0, 1}}], {Dashed, 
     Arrow[{{0, 0, 0}, {x1, x2, x3}}]}, {Dashed, 
     Arrow[{{0, 0, 0}, {0, 1, 0}}]}, {Dashed, 
     Arrow[{{0, 0, 0}, {0, 0, 1}}]}}, Boxed -> False];

Voriginal = {1, 0, 0};
Rz = {{Cos[\[Alpha]], -Sin[\[Alpha]], 0}, {Sin[\[Alpha]], 
    Cos[\[Alpha]], 0}, {0, 0, 1}};

Vector = Rz.Voriginal;
x1 = Vector[[1]];
x2 = Vector[[2]];
x3 = Vector[[3]];

Manipulate[plotcoordinates, {\[Alpha], 0, 2 \[Pi], 
  Appearance -> "Labeled"}]
$\endgroup$

1 Answer 1

5
$\begingroup$

If I understood correctly the following is what you want to see

gif

The code:

Voriginal = {1, 0, 0};
Rz = {{Cos[a], -Sin[a], 0}, {Sin[a], Cos[a], 0}, {0, 0, 1}};
Vector = Rz . Voriginal;
x1 = Vector[[1]];
x2 = Vector[[2]];
x3 = Vector[[3]];
plotcoordinates =
  Graphics3D[
   {Arrow[{{0, 0, 0}, {0, 1, 0}}],
    Arrow[{{0, 0, 0}, {1, 0, 0}}],
    Arrow[{{0, 0, 0}, {0, 0, 1}}],
    {Dashed, Arrow[{{0, 0, 0}, {x1, x2, x3}}]},
    {Dashed, Arrow[{{0, 0, 0}, {0, 1, 0}}]},
    {Dashed, Arrow[{{0, 0, 0}, {0, 0, 1}}]}},
   Boxed -> False];
Manipulate[
 Evaluate[plotcoordinates], {a, 0, 2 π, Appearance -> "Labeled"}]
$\endgroup$
2
  • $\begingroup$ thank you SO much $\endgroup$ Commented Feb 14, 2023 at 9:55
  • 1
    $\begingroup$ @Relativisticcucumber glad I was able to help :) $\endgroup$
    – bmf
    Commented Feb 14, 2023 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.