[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 5550 Revision 5551
1=head1 NAME
2
3contextLimitedComplex.pl - Allow complex numbers but not complex operations.
4
5=head1 DESCRIPTION
6
7Implements a context in which complex numbers can be entered,
8but no complex operations are permitted. So students will
9be able to perform operations within the real and imaginary
10parts of the complex numbers, but not between complex numbers.
11
12 Context("LimitedComplex")
13
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
16to keep track of that, and allow SOME complex operations,
17but only when one term is one of these constants (or an expression
18involving it that we've already OKed).
19
20You control which format to use by setting the complex_format
21context flag to 'cartesian', 'polar' or 'either'. E.g.,
22
23 Context()->flags->set(complex_format => 'polar');
24
25The default is 'either'. There are predefined contexts that
26already have these values set:
27
28 Context("LimitedComplex-cartesian");
29 Context("LimitedComplex-polar");
30
31You can require that the a and b used in these forms be strictly
32numbers (not expressions) by setting the strict_numeric flag and
33disabling all the functions:
34
35 Context()->flags->set(strict_numeric=>1);
36 Context()->functions->disable('All');
37
38There are predefined contexts that already have these values
39set:
40
41 Context("LimitedComplex-cartesian-strict");
42 Context("LimitedComplex-polar-strict");
43 Context("LimitedComplex-strict");
44
45=cut
46
1loadMacros("MathObjects.pl"); 47loadMacros("MathObjects.pl");
2 48
3sub _contextLimitedComplex_init {LimitedComplex::Init()}; # don't load it again 49sub _contextLimitedComplex_init {LimitedComplex::Init()}; # don't load it again
4
5=head3 Context("LimitedComplex")
6
7 ##########################################################
8 #
9 # Implements a context in which complex numbers can be entered,
10 # but no complex operations are permitted. So students will
11 # be able to perform operations within the real and imaginary
12 # parts of the complex numbers, but not between complex numbers.
13 #
14 #
15 # Complex Numbers can still be entered in a+bi or a*e^(bt) form.
16 # The e and i are allowed to be entered only once, so we have
17 # to keep track of that, and allow SOME complex operations,
18 # but only when one term is one of these constants (or an expression
19 # involving it that we've already OKed).
20 #
21 # You control which format to use by setting the complex_format
22 # context flag to 'cartesian', 'polar' or 'either'. E.g.,
23 #
24 # Context()->flags->set(complex_format => 'polar');
25 #
26 # The default is 'either'. There are predefined contexts that
27 # already have these values set:
28 #
29 # Context("LimitedComplex-cartesian");
30 # Context("LimitedComplex-polar");
31 #
32 # You can require that the a and b used in these forms be strictly
33 # numbers (not expressions) by setting the strict_numeric flag and
34 # disabling all the functions:
35 #
36 # Context()->flags->set(strict_numeric=>1);
37 # Context()->functions->disable('All');
38 #
39 # There are predefined contexts that already have these values
40 # set:
41 #
42 # Context("LimitedComplex-cartesian-strict");
43 # Context("LimitedComplex-polar-strict");
44 # Context("LimitedComplex-strict");
45 #
46
47=cut
48 50
49################################################## 51##################################################
50# 52#
51# Handle common checking for BOPs 53# Handle common checking for BOPs
52# 54#

Legend:
Removed from v.5550  
changed lines
  Added in v.5551

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9