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

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

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

Revision 5554 Revision 5555
7Implements a context in which complex numbers can be entered, 7Implements a context in which complex numbers can be entered,
8but no complex operations are permitted. So students will 8but no complex operations are permitted. So students will
9be able to perform operations within the real and imaginary 9be able to perform operations within the real and imaginary
10parts of the complex numbers, but not between complex numbers. 10parts of the complex numbers, but not between complex numbers.
11 11
12 Context("LimitedComplex") 12 Context("LimitedComplex")
13 13
14Complex Numbers can still be entered in a+bi or a*e^(bt) form. 14Complex Numbers can still be entered in a+bi or a*e^(bt) form.
15The e and i are allowed to be entered only once, so we have 15The e and i are allowed to be entered only once, so we have
16to keep track of that, and allow SOME complex operations, 16to keep track of that, and allow SOME complex operations,
17but only when one term is one of these constants (or an expression 17but only when one term is one of these constants (or an expression
18involving it that we've already OKed). 18involving it that we've already OKed).
19 19
20You control which format to use by setting the complex_format 20You control which format to use by setting the complex_format
21context flag to 'cartesian', 'polar' or 'either'. E.g., 21context flag to 'cartesian', 'polar' or 'either'. E.g.,
22 22
23 Context()->flags->set(complex_format => 'polar'); 23 Context()->flags->set(complex_format => 'polar');
24 24
25The default is 'either'. There are predefined contexts that 25The default is 'either'. There are predefined contexts that
26already have these values set: 26already have these values set:
27 27
28 Context("LimitedComplex-cartesian"); 28 Context("LimitedComplex-cartesian");
29 Context("LimitedComplex-polar"); 29 Context("LimitedComplex-polar");
30 30
31You can require that the a and b used in these forms be strictly 31You can require that the a and b used in these forms be strictly
32numbers (not expressions) by setting the strict_numeric flag and 32numbers (not expressions) by setting the strict_numeric flag and
33disabling all the functions: 33disabling all the functions:
34 34
35 Context()->flags->set(strict_numeric=>1); 35 Context()->flags->set(strict_numeric=>1);
36 Context()->functions->disable('All'); 36 Context()->functions->disable('All');
37 37
38There are predefined contexts that already have these values 38There are predefined contexts that already have these values
39set: 39set:
40 40
41 Context("LimitedComplex-cartesian-strict"); 41 Context("LimitedComplex-cartesian-strict");
42 Context("LimitedComplex-polar-strict"); 42 Context("LimitedComplex-polar-strict");
43 Context("LimitedComplex-strict"); 43 Context("LimitedComplex-strict");
44 44
45=cut 45=cut
46 46
47loadMacros("MathObjects.pl"); 47loadMacros("MathObjects.pl");
48 48

Legend:
Removed from v.5554  
changed lines
  Added in v.5555

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9