parserVectorUtils.pl - Utility macros that are useful in vector problems.

From WeBWorK

Jump to: navigation


NAME

parserVectorUtils.pl - Utility macros that are useful in vector problems.

DESCRIPTION

Some utility routines that are useful in vector problems

MACROS

Overline

        Overline($vectorName)

formats a vector name (should be used in math mode)

Vectors will be in bold italics in HTML modes, and will be overlined in TeX modes. (Bold italic could also work in TeX modes, but the low resolution on screen made it less easy to distinguish the difference between bold and regular letters.)

BoldMath

        BoldMath($vectorName)

This gets a bold letter in TeX as well as HTML modes. Although \boldsymbol{} works fine on screen in latex2html mode, the PDF file produces non-bold letters. I haven't been able to track this down, so used \mathbf{} in TeX mode, which produces roman bold, not math-italic bold.

$GRAD

        TEXT($GRAD)
        BEGIN_TEXT
        $GRAD
        END_TEXT

Grad symbol.

non_zero_point

        non_zero_point($Dim,$L_bound,$U_bound,$step)

Create a non-zero point with the given number of coordinates with the given random range (which defaults to (-5,5,1)).

non_zero_point(n,a,b,c) non_zero_point_2D(a,b,c) non_zero_point_3D(a,b,c)

non_zero_point2D and 3D automatically set Dimension to 2 and 3 respectively.

non_zero_vector, non_zero_vector2D, non_zero_vector3D

        non_zero_vector($Dim,$L_bound,$U_bound,$step)
        non_zero_vector2D($L_bound,$U_bound,$step)
        non_zero_vector3D($L_bound,$U_bound,$step)

Functions the same as non_zero_point but for Vectors. non_zero_vector2D and non_zero_vector3D automatically set Dimension to 2 and 3 respectively.

Line

        $P = Point(@coords1);
        $V = Vector(@coords2);
        $t = 't';
        Line($P,$V);
        Line($P,$V,$t);

Form the vector-parametric form for a line given its point and vector, where $P is the point and $V the direction vector for the line, and $t is the variable to use (default is 't').

For example:

        Line([1,-3],[2,1]);            # produces Vector("1+2t","-3+t").
        Line(Point(1,-3),Vector(2,1)); # produces Vector("1+2t","-3+t").

(It may be better to use the ParametricLine class from parserParametricLine.pl).

Plane

        Plane($point,$NormalVector)

Creates a displayable string for a plane given its normal vector and a point on the plane. (Better to use the ImplicitPlane class from parserImplicitPlane.pl).