Come tracciamo il vettore magnitudo-angolo in Mathematica?

Aug 17 2020

Sono perso su come tracciare questo vettore abbastanza semplice con una grandezza e un angolo in Mathematica. Qualsiasi aiuto sarebbe apprezzato. Grazie in anticipo.

ad esempio 20 @ 50 gradi di angolo

Risposte

7 kglr Aug 18 2020 at 04:16

Puoi usare la funzione AnglePath:

{x, y} = {0, 0};
r = 20;
t = 50 Degree;
Graphics[{Red, Arrow @ AnglePath[{x, y}, {{r, t}}]}]

In alternativa puoi usare AngleVector:

Graphics[{Red, Arrow[{{x, y}, AngleVector[{r, t}]}]}]

stessa immagine

6 NonDairyNeutrino Aug 18 2020 at 04:52

Con

{r, t} = {20, 50 Degree}

Puoi sempre creare il vettore matematicamente con

vec = r {Cos@t, Sin@t}

e un esempio illustrativo

With[
 {pt = r {Cos@t, Sin@t}(*Mathematical implementation of the vector*)},
 Graphics[
  {
   (*Make all the lines thick*) Thickness[.007],
   (*The arrow itself*){Arrow@{{0, 0}, pt}},
   (*Arc to show label the angle*) {Circle[{0, 0}, 5, {0, 50 Degree}]},
   (*Angle label*) {Text[Style[θ == 50 Degree, 15], 4 {0.85 Cos[t/2.5], 1.1 Sin[t/2.5]}]},
   (*Magnitude label*) {Text[Style["r = 20", 15], pt {0.9, 1}]}
   }
  ]
 ]