Difference between revisions of "UnitVector Command"

From GeoGebra Manual
Jump to: navigation, search
m (command syntax: changed [ ] into ( ))
 
(10 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<noinclude>{{Manual Page|version=4.0}}[[Category:Manual (official)|{{PAGENAME}}]]</noinclude>
+
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|cas=true|vector-matrix}}
{{command|vector-matrix}}
+
;UnitVector( <Vector> )
;UnitVector[ <Vector> ]
 
 
:Yields a vector with length 1, which has the same direction and orientation as the given vector. The vector must be defined first.  
 
:Yields a vector with length 1, which has the same direction and orientation as the given vector. The vector must be defined first.  
:{{example|1=<div>Let ''v=<math>\begin{pmatrix}3\\4\end{pmatrix}</math>. <code><nowiki>UnitVector[v]</nowiki></code> yields ''<math>\begin{pmatrix}0.6\\0.8\end{pmatrix}</math>''.</div>}}
+
:{{example|1=<div>Let ''v=<math>\begin{pmatrix}3\\4\end{pmatrix}</math>''. <code><nowiki>UnitVector(v)</nowiki></code> yields ''<math>\begin{pmatrix}0.6\\0.8\end{pmatrix}</math>''.</div>}}
;UnitVector[ <Line> ]
+
;UnitVector( <Line> )
:Yields the direction vector of the given line, with length 1 .
+
:Yields the direction vector of the given line with length 1.
:{{example|1=<div><code><nowiki>UnitVector[3x + 4y = 5]</nowiki></code> yields ''<math>\begin{pmatrix}0.8\\-0.6\end{pmatrix}</math>''.</div>}}
+
:{{example|1=<div><code><nowiki>UnitVector(3x + 4y = 5)</nowiki></code> yields ''<math>\begin{pmatrix}0.8\\-0.6\end{pmatrix}</math>''.</div>}}
;UnitVector[ <Segment> ]
+
;UnitVector( <Segment> )
:Yields the direction vector of the given segment, with length 1.
+
:Yields the direction vector of the given segment with length 1.
==CAS Syntax==
+
:{{example|1=<div>Let <code><nowiki>s = Segment((1,1),(4,5))</nowiki></code>. <div><code><nowiki>UnitVector(s)</nowiki></code> yields ''<math>\begin{pmatrix}0.6\\0.8\end{pmatrix}</math>''.</div></div>}}
In [[CAS View]] only one syntax is allowed:
+
 
;UnitVector[ <Vector> ]
+
{{hint|1=
:Yields a vector with length 1, which has the same direction and orientation as the given vector.
+
In the [[File:Menu view cas.svg|link=|16px]] [[CAS View]] three-dimensional vectors and vectors with undefined variables are also valid inputs.
:{{example|1=<div><code><nowiki>UnitVector[{a, b}]</nowiki></code> yields ''{<math>\frac{a}{\sqrt{a^{2} + b^{2}&#125;}</math>, <math>\frac{b}{\sqrt{a^{2} + b^{2}&#125;}</math>}''.</div>}}
+
:{{examples|1=<div>
:{{example|1=<div><code><nowiki>UnitVector[{2, 4, 4}]</nowiki></code> yields ''{<math>\frac{1}{3}</math>, <math>\frac{2}{3}</math>, <math>\frac{2}{3}</math>}''.</div>}}
+
:*<code><nowiki>UnitVector((a, b))</nowiki></code> yields ''(<math>\frac{a}{\sqrt{a a + b b&#125;}</math>, <math>\frac{b}{\sqrt{a a + b b&#125;}</math>)''.
 +
:* <code><nowiki>UnitVector((2, 4, 4))</nowiki></code> yields ''(<math>\frac{1}{3}</math>, <math>\frac{2}{3}</math>, <math>\frac{2}{3}</math>)''.</div>}}
 +
}}

Latest revision as of 16:45, 29 September 2017


UnitVector( <Vector> )
Yields a vector with length 1, which has the same direction and orientation as the given vector. The vector must be defined first.
Example:
Let v=\begin{pmatrix}3\\4\end{pmatrix}. UnitVector(v) yields \begin{pmatrix}0.6\\0.8\end{pmatrix}.
UnitVector( <Line> )
Yields the direction vector of the given line with length 1.
Example:
UnitVector(3x + 4y = 5) yields \begin{pmatrix}0.8\\-0.6\end{pmatrix}.
UnitVector( <Segment> )
Yields the direction vector of the given segment with length 1.
Example:
Let s = Segment((1,1),(4,5)).
UnitVector(s) yields \begin{pmatrix}0.6\\0.8\end{pmatrix}.


Note Hint: In the Menu view cas.svg CAS View three-dimensional vectors and vectors with undefined variables are also valid inputs.
Examples:
  • UnitVector((a, b)) yields (\frac{a}{\sqrt{a a + b b}}, \frac{b}{\sqrt{a a + b b}}).
  • UnitVector((2, 4, 4)) yields (\frac{1}{3}, \frac{2}{3}, \frac{2}{3}).
© 2024 International GeoGebra Institute