-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathch1.mp
3407 lines (3064 loc) · 120 KB
/
ch1.mp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% CH1.mp
% MetaPost input file with chapter one pictures.
verbatimtex
%&latex
\documentclass{book}
\usepackage{bookjh}
\usepackage{linalgjh}
\usepackage{tabstackengine} \setstacktabbedgap{1pt}
\begin{document}
etex
input jh
ahangle:=40;
%..........................................
% dblarrow_with_label
% draw this: |<----label----->|
%def dblarrow_with_label(expr ptone, pttwo, lbl)=
% begingroup
% pickup updown_tick;
% drawdot ptone; drawdot pttwo;
% drawdblarrow (ptone+.5(tickwidth,0v))--(pttwo-.5(tickwidth,0v));
% pic p;
% p=thelabel(btex lbl etex,.5[ptone,pttwo]);
% unfill bbox p;
% draw p;
% endgroup
%enddef;
%--------------------------------
% Fulcrum and Balls (1) and (2)
% section 1.1
beginfig(1);
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.015in; v:=u; w:=v;
% the teeter-totter
linecap:=butt;
z0=(-55w,0v); z1=-z0;
pickup pencircle scaled line_width_light;
draw z0--z1;
path fulcrum;
z2=(-8w,-5v); x3=-x2; y3=y2;
fulcrum=(0w,0v)--z2--z3--cycle;
filldraw fulcrum withcolor shading_color; draw fulcrum;
% the masses
numeric unitmass, c, h, two;
unitmass=16pt; % with c=4 and h=1, solved for (4/3)\pi x^3.
c=0.98475*unitmass; h=0.62035*unitmass; two=0.78159*unitmass;
draw fullcircle scaled c shifted (-15w,.5c);
label(btex {\small $c$} etex,(-15w,.5c));
draw fullcircle scaled h shifted (-40w,.5h);
label(btex {\small $h$} etex,(-40w,.5h));
draw fullcircle scaled two shifted (50w,.5two);
label(btex {\small $2$} etex,(50w,.5two));
% the decorations
linecap:=squared;
pickup pencircle scaled line_width_light;
y4=1.3unitmass; y5=-.9unitmass;
picture picc, pich, pictwo;
picc=thelabel(btex {\tiny $15$} etex,(.5*(-15w),y5));
pich=thelabel(btex {\tiny $40$} etex,(.5*(-40w),y4));
pictwo=thelabel(btex {\tiny $50$} etex,(.5*(50w),y4));
interim ahangle:=30;
drawarrow ((-15w,y5)-(10pt,0v))--((-15w,y5)-(.5tickwidth,0v));
drawarrow ((0w,y5)+(10pt,0v))--((0w,y5)+(.5tickwidth,0v));
unfill bbox picc;
draw picc;
drawdblarrow ((-40w,y4)+(.5tickwidth,0v))--((0w,y4)-(.5tickwidth,0v));
unfill bbox pich;
draw pich;
drawdblarrow ((0w,y4)+(.5tickwidth,0v))--((50w,y4)-(.5tickwidth,0v));
unfill bbox pictwo;
draw pictwo;
pen vert_bar;
vert_bar:=pensquare xscaled tickwidth yscaled 4pt;
pickup vert_bar;
drawdot (-15w,y5); drawdot (0w,y5);
drawdot (-40w,y4); drawdot (0w,y4);
drawdot (0w,y4); drawdot (50w,y4);
endfig;
beginfig(2);
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.015in; v:=u; w:=v;
linecap:=butt;
z0=(-55w,0v); z1=-z0;
pickup pencircle scaled line_width_light;
draw z0--z1;
path fulcrum;
z2=(-8w,-5v); x3=-x2; y3=y2;
fulcrum=(0w,0v)--z2--z3--cycle;
filldraw fulcrum withcolor shading_color; draw fulcrum;
numeric unitmass, c, h, two;
unitmass=16pt;
c=0.98475*unitmass; h=0.62035*unitmass; two=0.78159*unitmass;
draw fullcircle scaled c shifted (-25w,.5c);
label(btex {\small $c$} etex,(-25w,.5c));
draw fullcircle scaled h shifted (50w,.5h);
label(btex {\small $h$} etex,(50w,.5h));
draw fullcircle scaled two shifted (25w,.5two);
label(btex {\small $2$} etex,(25w,.5two));
linecap:=squared;
pickup pencircle scaled line_width_light;
y4=1.3unitmass; y5=-.9unitmass;
picture picc, pich, pictwo;
picc=thelabel(btex {\tiny $25$} etex,(.5*(-25w),y4));
pich=thelabel(btex {\tiny $50$} etex,(.5*(50w),y4));
pictwo=thelabel(btex {\tiny $25$} etex,(.5*(25w),y5));
interim ahangle:=30;
drawdblarrow ((-25w,y4)+(.5tickwidth,0v))--((0w,y4)-(.5tickwidth,0v));
unfill bbox picc;
draw picc;
drawdblarrow ((50w,y4)+(.5tickwidth,0v))--((0w,y4)-(.5tickwidth,0v));
unfill bbox pich;
draw pich;
drawdblarrow ((0w,y5)+(.5tickwidth,0v))--((25w,y5)-(.5tickwidth,0v));
unfill bbox pictwo;
draw pictwo;
pen vert_bar;
vert_bar:=pensquare xscaled tickwidth yscaled 4pt;
pickup vert_bar;
drawdot (-25w,y4); drawdot (0w,y4);
drawdot (50w,y4); drawdot (0w,y4);
drawdot (0w,y5); drawdot (25w,y5);
endfig;
%--------------------------------------
% Linear Systems (3), (4), and (5)
def onetwo_axes=
begingroup
pickup pencircle scaled line_width_light;
draw (-3.5w,0v)--(3.5w,0v);
draw (0w,-1v)--(0w,4.5v);
updown_ticks(3,(-3w,0v),(1w,0v)); updown_ticks(3,(1w,0v),(1w,0v));
sidetoside_ticks(4,(0w,1v),(0w,1v));
endgroup
enddef;
beginfig(3) %one solution
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.14in; v:=u; w:=v;
onetwo_axes;
pickup pencircle scaled line_width_dark;
z0=(-0.67w,4.5v); z1=(3w,-1v); % 3x+2y=7
drawdblarrow z0--z1;
z2=(-1.75w,-.75v); z3=(3w,4v); % x-y=-1
drawdblarrow z2--z3;
endfig;
beginfig(4) % no solutions
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.14in; v:=u; w:=v;
onetwo_axes;
pickup pencircle scaled line_width_dark;
z0=(-0.67w,4.5v); z1=(3w,-1v); % 3x+2y=7
drawdblarrow z0--z1;
z2=(-1.67w,4.5v); z3=(2w,-1v); % 3x+2y=4
drawdblarrow z2--z3;
endfig;
beginfig(5) % infinitely many solutions
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.14in; v:=u; w:=v;
onetwo_axes;
pickup pencircle scaled line_width_dark;
z0=(-0.67w,4.5v); z1=(3w,-1v); % 3x+2y=7
drawdblarrow z0--z1;
endfig;
beginfig(6) % one-dimensional space
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.4in; v:=u; w:=v;
pickup pencircle scaled line_width_dark;
z0=(-3w,0v); z1=-z0;
drawdblarrow z0--z1;
endfig;
beginfig(7) % R^1
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.4in; v:=u; w:=v;
pickup pencircle scaled line_width_dark;
z0=(-3w,0v); z1=-z0;
drawdblarrow z0--z1;
updown_ticks(2,(0w,0v),(1w,0v));
label.bot(btex {\small $0$} etex,(0w,-ticklength));
label.bot(btex {\small $1$} etex,(1w,-ticklength));
endfig;
beginfig(8) % generic vector
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.2in; v:=u; w:=v;
pickup pencircle scaled line_width_dark;
z0=(2w,1.5v); z1=(0w,0v);
drawarrow z0--z1;
endfig;
beginfig(9) % two equal vectors in space
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.2in; v:=u; w:=v;
pickup pencircle scaled line_width_dark;
z0=(0w,.8v); z1=(2w,.8v);
drawarrow z0--z1;
z3=(-.7w,-.8v);
drawarrow (z0-z3)--(z1-z3);
endfig;
beginfig(10) % same two equal vectors, with boxes
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.2in; v:=u; w:=v;
z0=(0w,.8v); z1=(2w,.8v);
z3=(-.7w,-.8v);
pickup pensquare scaled .4u;
drawdot z0;
drawdot (z0-z3);
pickup pensquare scaled .35u;
drawdot z0 withcolor shading_color;
drawdot (z0-z3) withcolor shading_color;
pickup pencircle scaled (1.414*line_width_dark);
drawarrow z0--z1 withcolor white;
drawarrow (z0-z3)--(z1-z3) withcolor white;
pickup pencircle scaled line_width_dark;
drawarrow z0--z1;
drawarrow (z0-z3)--(z1-z3);
endfig;
beginfig(11) % two vectors on axis (one over, two up)
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.14in; v:=u; w:=v;
% onetwo_axes without the negative x's
pickup pencircle scaled line_width_light;
draw (-.5w,0v)--(3.5w,0v);
draw (0w,-.5v)--(0w,3.5v);
updown_ticks(3,(1w,0v),(1w,0v));
sidetoside_ticks(3,(0w,1v),(0w,1v));
pickup pencircle scaled line_width_dark;
z0=(1w,1v); z1=(2w,3v);
drawarrow z0--z1;
z3=(1w,0v);
drawarrow (z0+z3)--(z1+z3);
endfig;
beginfig(12) % many vectors on axis (one over, two up's)
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.14in; v:=u; w:=v;
% axes
pickup pencircle scaled line_width_light;
draw (-3.5w,0v)--(3.5w,0v);
draw (0w,-1.5v)--(0w,3.5v);
updown_ticks(3,(1w,0v),(1w,0v));
updown_ticks(3,(-1w,0v),(-1w,0v));
sidetoside_ticks(3,(0w,1v),(0w,1v));
sidetoside_ticks(1,(0w,-1v),(0w,-1v));
pickup pencircle scaled line_width_dark;
z0=(0w,0v); z1=(1w,2v);
drawarrow z0--z1;
z3=(1w,1v); drawarrow (z0+z3)--(z1+z3);
z4=(-1.75w,-1.5v); drawarrow (z0+z4)--(z1+z4);
z5=(1.6w,-1.2v); drawarrow (z0+z5)--(z1+z5);
z6=(-2.3w,-.5v); drawarrow (z0+z6)--(z1+z6);
z7=(-.6w,1.2v); drawarrow (z0+z7)--(z1+z7);
z8=(-3.1w,.8v); drawarrow (z0+z8)--(z1+z8);
endfig;
beginfig(13) % three vectors in space, the second the neg and the third triple
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.2in; v:=u; w:=v;
pickup pencircle scaled line_width_dark;
z0=(0w,1v); z1=(2w,1v);
drawarrow z0--z1;
label.top(btex {\small $\vec{v}$} etex,.5[z0,z1]);
z2=(0w,-1v); z3=(-2w,-1v);
drawarrow (z2)--(z3);
label.top(btex {\small $-\vec{v}$} etex,.5[z2,z3]);
z4=(0w,0v); z5=(6w,0v);
drawarrow (z4)--(z5);
label.top(btex {\small $3\vec{v}$} etex,.5[z4,z5]);
endfig;
beginfig(14) % a vector as the sum of two others; not parallelogram
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.2in; v:=u; w:=v;
numeric n; %what percentage of arrow ends to knock off?
n:=.02;
pickup pencircle scaled line_width_light;
z0=(0w,0v); z1=(5w,.65v);
drawarrow (n[z0,z1])--((1-n)[z0,z1]);
label.bot(btex {\small $\vec{v}$} etex,.5[z0,z1]);
z2=(6w,3v);
drawarrow (n[z1,z2])--((1-n)[z1,z2]);
label.rt(btex {\small $\vec{w}$} etex,.5[z1,z2]);
pickup pencircle scaled line_width_dark;
z4=0.02*(-1*(y2-y0),x2-x0); % perp to hyp to offset from w's arrow
drawarrow (n[z0,z2]+z4)--((1-n)[z0,z2]+z4);
label.ulft(btex {\small $\vec{v}+\vec{w}$} etex,.707[z0+z4,z2+z4]);
endfig;
beginfig(15) % parallelogram rule for a vector as the sum of two others
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.2in; v:=u; w:=v;
numeric n; %what percentage of arrow ends to knock off?
n:=.02;
pickup pencircle scaled line_width_light;
z0=(0w,0v); z1=(5w,.65v);
z2=(6w,3v); % sum
z4=0.02*(-1*(y2-y0),x2-x0); % perp to hyp to offset from w's arrow
z5=z2-z1;
pickup pencircle scaled line_width_light;
draw (n[z5,z2])--((1-5n)[z5,z2]) withcolor shading_color; % nb 5n for a-head
draw (n[z1,z2])--((1-n)[z1,z2]) withcolor shading_color;
pickup pencircle scaled (2*line_width_dark);
drawarrow z0--z2 withcolor white;
pickup pencircle scaled line_width_dark;
% drawarrow (n[z0,z2])--((1-n)[z0,z2]);
% label.urt(btex {\small $\vec{v}+\vec{w}=
% \smash{\colvec{v_1+w_1 \\ v_2+w_2}}$} etex,z2);
drawarrow (n[z0,z2])--((1-n)[z0,z2]);
label.urt(btex {\small $\vec{v}+\vec{w}$} etex,z2);
pickup pencircle scaled line_width_light;
drawarrow (n[z0,z1])--((1-n)[z0,z1]);
% label.bot(btex {\small $\vec{v}=\colvec{v_1 \\ v_2}$} etex,z1);
label.bot(btex {\small $\vec{v}$} etex,z1);
drawarrow (n[z0,z2])--((1-n)[z0,z5]);
% label.ulft(btex {\small $\vec{w}=\colvec{w_1\\ w_2}$} etex,z5);
label.ulft(btex {\small $\vec{w}$} etex,z5);
endfig;
beginfig(16) % vector description of a line
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.16in; v:=u; w:=v;
numeric n; %what percentage of arrow ends to knock off?
n:=.00; % tried some values; looks funny
% onetwo_axes without the negative x's
pickup pencircle scaled line_width_light;
draw (-1.5w,0v)--(4.5w,0v);
draw (0w,-.5v)--(0w,3.5v);
updown_ticks(4,(1w,0v),(1w,0v));
updown_ticks(1,(-1w,0v),(-1w,0v));
sidetoside_ticks(3,(0w,1v),(0w,1v));
z0=(-1w,3v); z1=(4.5w,0.25v); % t=-1 and t=1.75
pickup pencircle scaled (2*line_width_dark);
draw z0--z1 withcolor white;
pickup pencircle scaled line_width_dark;
draw z0--z1 withcolor shading_color;
z2=(0w,0v); z3=(1w,2v);
drawarrow z2--((1-n)[z2,z3]) withcolor shading_color;
z4=(3w,1v);
drawarrow z2--((1-n)[z2,z4]) withcolor shading_color;
drawarrow z3--z4;
label.urt(btex {\small
\ $\colvec{2 \\ -1}=\colvec{3 \\ 1}-\colvec{1 \\ 2}$} etex,.5[z3,z4]);
endfig;
input jh3d
beginfig(17) % line in R3 thru (1,2,3) and (5,5,5)
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.2in; v:=u; w:=v;
drawing_scale:=40pt;
save c_a, c_b, c_c, c_d,
origin;
c_a:=new_vect; c_b:=new_vect; c_c:=new_vect; c_d:=new_vect;
origin:=new_vect; vect_def(origin,0,0,0);
vect_def(c_a,-1,0,-1); vect_def(c_b,3,4,3); % t=-2 and 2
vect_def(c_c,1,2,1); vect_def(c_d,2,3,2);
%
set_point(Obs,20,5,5);
Obs_phi:=90; Obs_dist:=10;
point_of_view_abs(origin,Obs_phi);
% draw axes (with a white border)
pickup pencircle scaled line_width_dark;
xaxiscolor:=white; yaxiscolor:=white; zaxiscolor:=white;
draw_xyz_axes(3.5,4.5,2.5);
pickup pencircle scaled line_width_light;
xaxiscolor:=black; yaxiscolor:=black; zaxiscolor:=black;
draw_xyz_axes_withticks(3.5,4.5,2.5,3,4,2);
% Now project the 3D points c_a ... c_d down to z1 ... z4
project_point(1,c_a);
project_point(2,c_b);
project_point(3,c_c);
project_point(4,c_d);
project_point(5,origin);
pickup pencircle scaled (2*line_width_dark);
draw z1--z2 withcolor white;
pickup pencircle scaled line_width_dark;
draw z1--z2 withcolor shading_color;
drawarrow z5--z3 withcolor shading_color;
drawarrow z5--z4 withcolor shading_color;
drawarrow z3--z4;
% label.lrt(btex {\small $\colvec{1 \\ 1 \\ 1}$} etex,.5[z3,z4]);
\label.lrt(btex {\small $\set{ \colvec{1 \\ 2 \\ 1}
+t\cdot\colvec{1 \\ 1 \\ 1}
\suchthat t\in\Re}$} etex,z2);
endfig;
beginfig(18) % 2-flat in R3; 2x+y+z=4
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.2in; v:=u; w:=v;
drawing_scale:=30pt;
save c_a, c_b, c_c, c_d,
origin;
c_a:=new_vect; c_b:=new_vect; c_c:=new_vect; c_d:=new_vect;
origin:=new_vect; vect_def(origin,0,0,0);
% four corners of the part of the plane shown
vect_def(c_b,1.15,-0.3,2); vect_def(c_d,-0.5,3,2);
vect_def(c_a,2.3,-0.3,-0.3); vect_def(c_c,0.65,3,-0.3);
% I don't understand what these do.
set_point(Obs,10,4,5);
Obs_phi:=90; Obs_dist:=8;
point_of_view_abs(origin,Obs_phi);
% Now project the 3D points c_a ... c_d down to z1 ... z4
project_point(1,c_a);
project_point(2,c_b);
project_point(3,c_c);
project_point(4,c_d);
pickup pencircle scaled line_width_dark;
draw z1--z2--z4--z3--cycle;
% draw axes (with a white border)
pickup pencircle scaled line_width_dark;
xaxiscolor:=white; yaxiscolor:=white; zaxiscolor:=white;
draw_xyz_axes(2.95,3.5,2.5);
pickup pencircle scaled line_width_light;
xaxiscolor:=black; yaxiscolor:=black; zaxiscolor:=black;
draw_xyz_axes_withticks(2.95,3.5,2.5,2,3,2);
% filldraw z1--z2--z4--z3--cycle withcolor shading_color;
pickup pencircle scaled (2*line_width_dark);
draw z2--z4 withcolor white;
pickup pencircle scaled line_width_dark;
draw .5[z1,z2]--z2--z4--.5[z4,z3];
label.rt(btex {\hspace*{0.05in} \small
$P=\set{\colvec{x \\ y \\ z} \suchthat 2x+y+z=4}$} etex,.618[z3,z4]);
endfig;
% beginfig(19) % 2-flat in R3; 2x+y+z=4
% numeric u; %scaling factor
% numeric v; %vertical scaling factor
% numeric w; %horizontal scaling factor
% u:=.2in; v:=u; w:=v;
% drawing_scale:=30pt;
% save c_a, c_b, c_c, c_d,
% origin;
% c_a:=new_vect; c_b:=new_vect; c_c:=new_vect; c_d:=new_vect;
% c_e:=new_vect; c_f:=new_vect; c_g:=new_vect;
% origin:=new_vect; vect_def(origin,0,0,0);
% vect_def(c_a,2.1,-0.1,-0.1); vect_def(c_b,1.05,-0.1,2);
% vect_def(c_c,0.55,3,-0.1); vect_def(c_d,-0.5,3,2);
% vect_def(c_e,1.5,1.5,1); vect_def(c_f,1,2.5,1);
% vect_def(c_g,1,1.5,2);
% % I don't understand what these do.
% set_point(Obs,10,5,5);
% Obs_phi:=90; Obs_dist:=8;
% point_of_view_abs(origin,Obs_phi);
% % Now project the 3D points c_a ... c_d down to z1 ... z4
% project_point(1,c_a);
% project_point(2,c_b);
% project_point(3,c_c);
% project_point(4,c_d);
% project_point(5,c_e);
% project_point(6,c_f);
% project_point(7,c_g);
% pickup pencircle scaled line_width_dark;
% draw z1--z2--z4--z3--cycle;
% % draw axes (with a white border)
% pickup pencircle scaled line_width_dark;
% xaxiscolor:=white; yaxiscolor:=white; zaxiscolor:=white;
% draw_xyz_axes(2.5,3.5,2.5);
% pickup pencircle scaled line_width_light;
% xaxiscolor:=black; yaxiscolor:=black; zaxiscolor:=black;
% draw_xyz_axes_withticks(2.5,3.5,2.5,2,3,2);
% % filldraw z1--z2--z4--z3--cycle withcolor shading_color;
% pickup pencircle scaled (2*line_width_dark);
% draw z2--z4 withcolor white;
% pickup pencircle scaled line_width_dark;
% draw .5[z1,z2]--z2--z4--.5[z4,z3];
% label.lft(btex {\small \hspace*{1em}
% $P=\set{\colvec{2 \\ 0 \\ 0}
% +\colvec{-0.5 \\ 1 \\ 0} y
% +\colvec{-0.5 \\ 0 \\ 1} z
% \suchthat y,z\in\Re}$} etex,.707[z3,z4]);
% drawarrow (z5+(.25w,-.1v))--(z6+(.25w,-.1v));
% drawarrow z5--z7;
% endfig;
beginfig(19) % 2-flat in R3; 2x+y+z=4, paramatized
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.2in; v:=u; w:=v;
drawing_scale:=30pt;
save c_a, c_b, c_c, c_d,
origin;
c_a:=new_vect; c_b:=new_vect; c_c:=new_vect; c_d:=new_vect;
c_e:=new_vect; c_f:=new_vect; c_g:=new_vect;
origin:=new_vect; vect_def(origin,0,0,0);
% four corners of the part of the plane
vect_def(c_b,1.15,-0.3,2); vect_def(c_d,-0.5,3,2);
vect_def(c_a,2.3,-0.3,-0.3); vect_def(c_c,0.65,3,-0.3);
% three vectors from the paramatrization
vect_def(c_e,2,0,0); vect_def(c_f,1.5,1,0);
vect_def(c_g,1.5,0,1);
% I don't understand what these do.
set_point(Obs,10,4,5);
Obs_phi:=90; Obs_dist:=8;
point_of_view_abs(origin,Obs_phi);
% Now project the 3D points c_a ... c_d down to z1 ... z4
project_point(1,c_a);
project_point(2,c_b);
project_point(3,c_c);
project_point(4,c_d);
project_point(5,c_e);
project_point(6,c_f);
project_point(7,c_g);
project_point(8,origin);
pickup pencircle scaled line_width_dark;
draw z1--z2--z4--z3--cycle;
% draw axes (with a white border)
pickup pencircle scaled line_width_dark;
xaxiscolor:=white; yaxiscolor:=white; zaxiscolor:=white;
draw_xyz_axes(2.95,3.5,2.5);
pickup pencircle scaled line_width_light;
xaxiscolor:=black; yaxiscolor:=black; zaxiscolor:=black;
draw_xyz_axes_withticks(2.95,3.5,2.5,2,3,2);
% filldraw z1--z2--z4--z3--cycle withcolor shading_color;
pickup pencircle scaled (2*line_width_dark);
draw z2--z4 withcolor white;
pickup pencircle scaled line_width_dark;
draw .5[z1,z2]--z2--z4--.5[z4,z3];
% label.rt(btex {\hspace*{0.05in} \small
% $P=\set{\colvec{2 \\ 0 \\ 0}
% +\colvec{-0.5 \\ 1 \\ 0} y
% +\colvec{-0.5 \\ 0 \\ 1} z
% \suchthat y,z\in\Re}$}} etex,.618[z3,z4]);
% sides and diagonal of parallelogram
save c_h, c_i, c_j;
c_h:=new_vect; c_i:=new_vect; c_j:=new_vect;
vect_def(c_h,1,2,0);
vect_def(c_i,1,0,2);
vect_def(c_j,1,1,1);
project_point(9,c_h);
project_point(10,c_i);
project_point(11,c_j);
pickup pencircle scaled (2*line_width_light);
draw .05[z7,z11]--.875[z7,z11] withcolor white;
draw .05[z6,z11]--.875[z6,z11] withcolor white;
pickup pencircle scaled line_width_light;
draw .05[z7,z11]--.875[z7,z11];
draw .05[z6,z11]--.875[z6,z11];
pickup pencircle scaled (2*line_width_dark);
drawarrow .04[z5,z11]--z11 withcolor white;
pickup pencircle scaled line_width_dark;
drawarrow .04[z5,z11]--z11;
%dotlabels.rt(5,6,7,9,10,11);
% draw these last or else the diagonal vector cuts into them
pickup pencircle scaled line_width_dark;
%drawarrow z8--z5 withcolor shading_color;
drawarrow z5--z6 withcolor shading_color;
drawarrow z5--z7 withcolor shading_color;
label.rt(btex {\hspace*{0.05in} \small
$P=\set{\colvec[r]{2 \\ 0 \\ 0}
+y\cdot\colvec[r]{-1/2 \\ 1 \\ 0}
+z\cdot\colvec[r]{-1/2 \\ 0 \\ 1}\suchthat y,z\in\Re}$} etex,.618[z3,z4]);
endfig;
beginfig(20) % 2-flat in R3; 2x+y+z=4, paramatized
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.2in; v:=u; w:=v;
drawing_scale:=30pt;
save c_a, c_b, c_c, c_d,
origin;
c_a:=new_vect; c_b:=new_vect; c_c:=new_vect; c_d:=new_vect;
c_e:=new_vect; c_f:=new_vect; c_g:=new_vect;
origin:=new_vect; vect_def(origin,0,0,0);
% four corners of the part of the plane
vect_def(c_b,1.15,-0.3,2); vect_def(c_d,-0.5,3,2);
vect_def(c_a,2.3,-0.3,-0.3); vect_def(c_c,0.65,3,-0.3);
% three vectors from the paramatrization
vect_def(c_e,2,0,0); vect_def(c_f,1.5,1,0);
vect_def(c_g,1.5,0,1);
% I don't understand what these do.
set_point(Obs,10,4,5);
Obs_phi:=90; Obs_dist:=8;
point_of_view_abs(origin,Obs_phi);
% Now project the 3D points c_a ... c_d down to z1 ... z4
project_point(1,c_a);
project_point(2,c_b);
project_point(3,c_c);
project_point(4,c_d);
project_point(5,c_e);
project_point(6,c_f);
project_point(7,c_g);
project_point(8,origin);
pickup pencircle scaled line_width_dark;
draw z1--z2--z4--z3--cycle;
% draw axes (with a white border)
pickup pencircle scaled line_width_dark;
xaxiscolor:=white; yaxiscolor:=white; zaxiscolor:=white;
draw_xyz_axes(2.95,3.5,2.5);
pickup pencircle scaled line_width_light;
xaxiscolor:=black; yaxiscolor:=black; zaxiscolor:=black;
draw_xyz_axes_withticks(2.95,3.5,2.5,2,3,2);
% filldraw z1--z2--z4--z3--cycle withcolor shading_color;
pickup pencircle scaled (2*line_width_dark);
draw z2--z4 withcolor white;
pickup pencircle scaled line_width_dark;
draw .5[z1,z2]--z2--z4--.5[z4,z3];
label.rt(btex \hbox{\hspace*{0.05in} \small
$P=\set{\colvec{2 \\ 0 \\ 0}
+\colvec{-0.5 \\ 1 \\ 0} y
+\colvec{-0.5 \\ 0 \\ 1} z
\suchthat y,z\in\Re}$} etex,.618[z3,z4]);
pickup pencircle scaled line_width_dark;
drawarrow z8--z5 withcolor shading_color;
drawarrow z5--z6;
drawarrow z5--z7;
endfig;
beginfig(21) % two vectors in R3, just in space
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.2in; v:=u; w:=v;
drawing_scale:=30pt;
save c_a, c_b, c_c, c_d,
origin;
c_a:=new_vect; c_b:=new_vect; c_c:=new_vect; c_d:=new_vect;
origin:=new_vect; vect_def(origin,0,0,0);
vect_def(c_a,1,0,1); vect_def(c_b,2,-1,3); % first vector from c_a to c_b
vect_def(c_c,1,1,1); vect_def(c_d,2,3,2.5); % second vector
% I don't understand what these do.
set_point(Obs,20,5,5);
Obs_phi:=90; Obs_dist:=10;
point_of_view_abs(origin,Obs_phi);
% draw axes (with a white border)
pickup pencircle scaled line_width_dark;
xaxiscolor:=white; yaxiscolor:=white; zaxiscolor:=white;
draw_xyz_axes(3.5,4.5,3.5);
pickup pencircle scaled line_width_light;
xaxiscolor:=black; yaxiscolor:=black; zaxiscolor:=black;
draw_xyz_axes_withticks(3.5,4.5,3.5,3,4,3);
% Now project the 3D points c_a ... c_d down to z1 ... z4
project_point(1,c_a);
project_point(2,c_b);
project_point(3,c_c);
project_point(4,c_d);
project_point(5,origin);
pickup pencircle scaled (2*line_width_dark);
drawarrow z1--z2 withcolor white;
drawarrow z3--z4 withcolor white;
pickup pencircle scaled line_width_dark;
drawarrow z1--z2;
label.llft(btex {\small $\vec{v}$} etex,.707[z1,z2]);
drawarrow z3--z4;
label.lrt(btex {\small $\vec{u}$} etex,.707[z3,z4]);
endfig;
beginfig(22) % two vectors in R3, canonical position, in a plane, with a hyp
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.2in; v:=u; w:=v;
drawing_scale:=30pt;
numeric n; %what percentage of arrow ends to knock off?
n:=.00; % tried some values
z0=(0pt,1pt);
save c_a, c_b, c_c, c_d,
origin;
c_a:=new_vect; c_b:=new_vect;
c_c:=new_vect; c_d:=new_vect; c_e:=new_vect; c_f:=new_vect;
origin:=new_vect; vect_def(origin,0,0,0);
vect_def(c_a,1,-1,2); % first vector
vect_def(c_b,1,2,1.5); % second vector
vect_def(c_c,2/11,-2,0); % plane boundaries: y=-2, z=0
vect_def(c_d,20/11,-2,3); % y=-2, z=3
vect_def(c_e,-3/11,3,0); % y=3, z=0
vect_def(c_f,15/11,3,3); % y=3, z=3
% I don't understand what these do.
set_point(Obs,20,5,5);
Obs_phi:=90; Obs_dist:=10;
point_of_view_abs(origin,Obs_phi);
% draw axes (with a white border)
pickup pencircle scaled line_width_dark;
xaxiscolor:=white; yaxiscolor:=white; zaxiscolor:=white;
draw_xyz_axes(3.5,4.5,3.5);
pickup pencircle scaled line_width_light;
xaxiscolor:=black; yaxiscolor:=black; zaxiscolor:=black;
draw_xyz_axes_withticks(3.5,4.5,3.5,3,4,3);
% draw plane boundary
project_point(4,c_c);
project_point(5,c_d);
project_point(6,c_e);
project_point(7,c_f);
% pickup pencircle scaled line_width_dark;
% draw z4--z5--z7--z6--cycle withcolor white;
pickup pencircle scaled line_width_light;
draw z4--z5--z7--z6--cycle withcolor shading_color;
% Now project the 3D points c_a ... c_d down to z1 ... z4
project_point(1,c_a);
project_point(2,c_b);
project_point(3,origin);
pickup pencircle scaled (2*line_width_dark);
drawarrow z3--z1 withcolor white;
drawarrow z3--z2 withcolor white;
drawarrow (n[z1,z2]+z0)--((1-n)[z1,z2]+z0) withcolor white;
pickup pencircle scaled line_width_dark;
drawarrow z3--z1;
drawarrow z3--z2;
drawarrow (n[z1,z2]+z0)--((1-n)[z1,z2]+z0);
endfig;
beginfig(23) % a vec as sum of two others; illustrate Triangle Inequality
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.2in; v:=u; w:=v;
numeric n; %what percentage of arrow ends to knock off?
n:=.01;
pickup pencircle scaled line_width_light;
z0=(0w,0v); z1=(5w,.65v);
drawarrow (.5n[z0,z1])--((1-n)[z0,z1]);
label.bot(btex {\small $\vec{u}$} etex,.5[z0,z1]);
z2=(6w,3v);
drawarrow (n[z1,z2])--((1-n)[z1,z2]);
label.rt(btex {\small $\vec{v}$} etex,.5[z1,z2]);
pickup pencircle scaled line_width_dark;
z4=0.02*(-1*(y2-y0),x2-x0); % perp to hyp to offset from w's arrow
drawarrow (.5n[z0,z2]+z4)--((1-n)[z0,z2]+z4);
label.ulft(btex {\small $\vec{u}+\vec{v}$} etex,.5[z0+z4,z2+z4]);
z5=whatever[z0,z1]=whatever[n[z0,z2]+z4,(1-n)[z0,z2]+z4];
drawpoint(z5);
label.lft(btex {\small\textit{start}} etex,z5);
z6=whatever[z1,z2]=whatever[n[z0,z2]+z4,(1-n)[z0,z2]+z4];
drawpoint(z6);
label.rt(btex {\small\textit{finish}} etex,z6);
endfig;
beginfig(24) % a plane with a bend in it
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.2in; v:=u; w:=v;
numeric n; %what percentage of arrow ends to knock off?
n:=.01;
% first the shortcut
x8=0w; x9=4w; y8=y9=.35v;
pickup pencircle scaled line_width_dark;
draw z8--z9 withcolor shading_color;
% next the surface
z1=(-.75w,0v);
z2=(0.65w,0v);
z3=(0.75w,0v);
z4=(2.2w,0.7v);
z5=(3.25w,0v);
z6=(3.35w,0v);
z7=(4.75w,0v);
path p[];
p1=z1--z2...z3..z4..z5...z6--z7;
z0=(0.4w,1.25v); % width and offset of surface
transform t[];
t0=identity shifted z0;
p2=p1 transformed t0;
p3=p1--reverse p2--cycle;
pickup pencircle scaled line_width_dark;
draw p3 withcolor white;
pickup pencircle scaled line_width_light;
draw p3;
% the solid curve that is in the surface
p4=(x8,0w)--z2..z3..z4..z5..z6--(x9,0v);
t1=identity shifted (0w,y8);
pickup pencircle scaled line_width_dark;
draw p4 transformed t1;
drawpoint(z8);
label.top(btex {\small $P$} etex,z8);
drawpoint(z9);
label.top(btex {\small $Q$} etex,z9);
endfig;
beginfig(25) % two vectors in plane, orthogonal
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.14in; v:=u; w:=v;
% onetwo_axes without the negative x's
pickup pencircle scaled line_width_light;
draw (-.5w,0v)--(3.5w,0v);
draw (0w,-.5v)--(0w,3.5v);
updown_ticks(3,(1w,0v),(1w,0v));
sidetoside_ticks(3,(0w,1v),(0w,1v));
pickup pencircle scaled line_width_dark;
z0=(0w,2v); z1=(1w,1v);
drawarrow z0--z1;
z3=(2w,2v); z4=(3w,3v);
drawarrow z3--z4;
% label.rt(btex {\small
% $\colvec{1 \\ -1}\dotprod\colvec{1 \\ 1}=0$} etex,(3w,1.5v));
endfig;
beginfig(26) % two vectors in R3, not orthogonal
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=.2in; v:=u; w:=v;
drawing_scale:=40pt;
save c_a, c_b,
origin;
c_a:=new_vect; c_b:=new_vect; c_c:=new_vect; c_d:=new_vect;
origin:=new_vect; vect_def(origin,0,0,0);
vect_def(c_a,0,3,2); vect_def(c_b,1,1,0); %
% I don't understand what these do.
set_point(Obs,20,5,5);
Obs_phi:=90; Obs_dist:=10;
point_of_view_abs(origin,Obs_phi);
% draw axes (with a white border)
pickup pencircle scaled line_width_dark;
xaxiscolor:=white; yaxiscolor:=white; zaxiscolor:=white;
draw_xyz_axes(2.5,3.5,3.5);
pickup pencircle scaled line_width_light;
xaxiscolor:=black; yaxiscolor:=black; zaxiscolor:=black;
draw_xyz_axes_withticks(2.5,3.5,2.5,2,3,2);
% Now project the 3D points down to z1 ... z2
project_point(1,c_a);
project_point(2,c_b);
project_point(0,origin);
pickup pencircle scaled (2*line_width_dark);
drawarrow z0--z1 withcolor white;
drawarrow z0--z2 withcolor white;
pickup pencircle scaled line_width_dark;
drawarrow z0--z1;
label.rt(btex {\small
$\colvec{0 \\ 3 \\ 2}$} etex,z1);
drawarrow z0--z2;
label.lrt(btex {\small
$\colvec{1 \\ 1 \\ 0}$} etex,z2);
endfig;
beginfig(27) % equiv relation; row-equiv mats
numeric u; %scaling factor
numeric v; %vertical scaling factor
numeric w; %horizontal scaling factor
u:=1in; v:=u; w:=v;
path p[]; partition;