[system] / trunk / pg / macros / parserVectorUtils.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/parserVectorUtils.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 5372 Revision 5373
1 1
2=head1 DESCRIPTION 2=head1 DESCRIPTION
3 3
4##################################################################### 4 #####################################################################
5# 5 #
6# Some utility routines that are useful in vector problems 6 # Some utility routines that are useful in vector problems
7# 7 #
8 8
9=cut 9=cut
10 10
11sub _parserVectorUtils_init {}; # don't reload this file 11sub _parserVectorUtils_init {}; # don't reload this file
12 12
13=head3 Overline($vectorName) 13=head3 Overline($vectorName)
14 14
15################################################## 15 ##################################################
16 16
17# 17 #
18# formats a vector name (should be used in math mode) 18 # formats a vector name (should be used in math mode)
19# 19 #
20# Vectors will be in bold italics in HTML modes, and 20 # Vectors will be in bold italics in HTML modes, and
21# will be overlined in TeX modes. (Bold italic could also work in 21 # will be overlined in TeX modes. (Bold italic could also work in
22# TeX modes, but the low resolution on screen made it less easy 22 # TeX modes, but the low resolution on screen made it less easy
23# to distinguish the difference between bold and regular letters.) 23 # to distinguish the difference between bold and regular letters.)
24# 24 #
25 25
26=cut 26=cut
27 27
28sub Overline { 28sub Overline {
29 my $v = shift; 29 my $v = shift;
36 ); 36 );
37} 37}
38 38
39=head3 BoldMath($vectorName) 39=head3 BoldMath($vectorName)
40 40
41# 41 #
42# This gets a bold letter in TeX as well as HTML modes. 42 # This gets a bold letter in TeX as well as HTML modes.
43# Although \boldsymbol{} works fine on screen in latex2html mode, 43 # Although \boldsymbol{} works fine on screen in latex2html mode,
44# the PDF file produces non-bold letters. I haven't been able to 44 # the PDF file produces non-bold letters. I haven't been able to
45# track this down, so used \mathbf{} in TeX mode, which produces 45 # track this down, so used \mathbf{} in TeX mode, which produces
46# roman bold, not math-italic bold. 46 # roman bold, not math-italic bold.
47# 47 #
48 48
49=cut 49=cut
50 50
51sub BoldMath { 51sub BoldMath {
52 my $v = shift; 52 my $v = shift;
61 ); 61 );
62} 62}
63 63
64=head3 $GRAD 64=head3 $GRAD
65 65
66# 66 #
67# Grad symbol 67 # Grad symbol
68# 68 #
69$GRAD = '\nabla ';
70 69
71=cut 70=cut
72 71
72$GRAD = '\nabla ';
73
73=head3 non_zero_point($Dim,$L_bound,$U_bound,$step) 74=head3 non_zero_point($Dim,$L_bound,$U_bound,$step)
74 75
75# 76 #
76# Create a non-zero point with the given number of coordinates 77 # Create a non-zero point with the given number of coordinates
77# with the given random range (which defaults to (-5,5,1)). 78 # with the given random range (which defaults to (-5,5,1)).
78# 79 #
79# non_zero_point(n,a,b,c) 80 # non_zero_point(n,a,b,c)
80# non_zero_point_2D(a,b,c) 81 # non_zero_point_2D(a,b,c)
81# non_zero_point_3D(a,b,c) 82 # non_zero_point_3D(a,b,c)
82# 83 #
83# non_zero_point2D and 3D automatically set Dimension to 2 and 3 respectively. 84 # non_zero_point2D and 3D automatically set Dimension to 2 and 3 respectively.
84# 85 #
85 86
86=cut 87=cut
87 88
88sub non_zero_point { 89sub non_zero_point {
89 my $n = shift; my $k = $n; my @v = (); 90 my $n = shift; my $k = $n; my @v = ();
95sub non_zero_point2D {non_zero_point(2,@_)} 96sub non_zero_point2D {non_zero_point(2,@_)}
96sub non_zero_point3D {non_zero_point(3,@_)} 97sub non_zero_point3D {non_zero_point(3,@_)}
97 98
98=head3 non_zero_vector($Dim,$L_bound,$U_bound,$step) 99=head3 non_zero_vector($Dim,$L_bound,$U_bound,$step)
99 100
100# 101 #
101# Functions the same as non_zero_point but for Vectors 102 # Functions the same as non_zero_point but for Vectors
102# 103 #
103# non_zero_vector2D and 3D automatically set Dimension to 2 and 3 respectively. 104 # non_zero_vector2D and 3D automatically set Dimension to 2 and 3 respectively.
104# 105 #
105 106
106=cut 107=cut
107 108
108sub non_zero_vector {Vector(non_zero_point(@_))} 109sub non_zero_vector {Vector(non_zero_point(@_))}
109sub non_zero_vector2D {non_zero_vector(2,@_)} 110sub non_zero_vector2D {non_zero_vector(2,@_)}
110sub non_zero_vector3D {non_zero_vector(3,@_)} 111sub non_zero_vector3D {non_zero_vector(3,@_)}
111 112
112=head3 Line(Point(@coords1),Vector(@coords2),'variableLetter') 113=head3 Line(Point(@coords1),Vector(@coords2),'variableLetter')
113 114
114# 115 #
115# Form the vector-parametric form for a line given its point and vector 116 # Form the vector-parametric form for a line given its point and vector
116# 117 #
117# Usage: Line(P,V); or Line(P,V,'t'); 118 # Usage: Line(P,V); or Line(P,V,'t');
118# 119 #
119# where P is the point and V the direction vector for the line, and 120 # where P is the point and V the direction vector for the line, and
120# t is the variable to use (default is 't'). 121 # t is the variable to use (default is 't').
121# 122 #
122# Ex: Line([1,-3],[2,1]) produces Vector("1+2t","-3+t"). 123 # Ex: Line([1,-3],[2,1]) produces Vector("1+2t","-3+t").
123# Ex: Line(Point(1,-3),Vector(2,1)) produces Vector("1+2t","-3+t"). 124 # Ex: Line(Point(1,-3),Vector(2,1)) produces Vector("1+2t","-3+t").
124# 125 #
125# (It may be better to use the ParametricLine class from 126 # (It may be better to use the ParametricLine class from
126# parserParametricLine.pl). 127 # parserParametricLine.pl).
127# 128 #
128 129
129=cut 130=cut
130 131
131sub Line { 132sub Line {
132 my @p = Point(shift)->value; my @v = Vector(shift)->value; 133 my @p = Point(shift)->value; my @v = Vector(shift)->value;
137 return Vector(@coords); 138 return Vector(@coords);
138} 139}
139 140
140=head3 Plane($point,$NormalVector) 141=head3 Plane($point,$NormalVector)
141 142
142# 143 #
143# Creates a displayable string for a plane given its 144 # Creates a displayable string for a plane given its
144# normal vector and a point on the plane. (Better to use 145 # normal vector and a point on the plane. (Better to use
145# the ImplicitPlane class from parserImplicitPlane.pl). 146 # the ImplicitPlane class from parserImplicitPlane.pl).
146# 147 #
147# Usage: Plane(P,N); 148 # Usage: Plane(P,N);
148# 149 #
149 150
150=cut 151=cut
151 152
152sub Plane { 153sub Plane {
153 my $P = Point(shift); my $N = Vector(shift); my @N = $N->value; 154 my $P = Point(shift); my $N = Vector(shift); my @N = $N->value;

Legend:
Removed from v.5372  
changed lines
  Added in v.5373

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9