

1  =head1 NAME 


2  


3  contextLimitedComplex.pl  Allow complex numbers but not complex operations. 


4  


5  =head1 DESCRIPTION 


6  


7  Implements a context in which complex numbers can be entered, 


8  but no complex operations are permitted. So students will 


9  be able to perform operations within the real and imaginary 


10  parts of the complex numbers, but not between complex numbers. 


11  


12  Context("LimitedComplex") 


13  


14  Complex Numbers can still be entered in a+bi or a*e^(bt) form. 


15  The e and i are allowed to be entered only once, so we have 


16  to keep track of that, and allow SOME complex operations, 


17  but only when one term is one of these constants (or an expression 


18  involving it that we've already OKed). 


19  


20  You control which format to use by setting the complex_format 


21  context flag to 'cartesian', 'polar' or 'either'. E.g., 


22  


23  Context()>flags>set(complex_format => 'polar'); 


24  


25  The default is 'either'. There are predefined contexts that 


26  already have these values set: 


27  


28  Context("LimitedComplexcartesian"); 


29  Context("LimitedComplexpolar"); 


30  


31  You can require that the a and b used in these forms be strictly 


32  numbers (not expressions) by setting the strict_numeric flag and 


33  disabling all the functions: 


34  


35  Context()>flags>set(strict_numeric=>1); 


36  Context()>functions>disable('All'); 


37  


38  There are predefined contexts that already have these values 


39  set: 


40  


41  Context("LimitedComplexcartesianstrict"); 


42  Context("LimitedComplexpolarstrict"); 


43  Context("LimitedComplexstrict"); 


44  


45  =cut 


46  
1  loadMacros("MathObjects.pl"); 
47  loadMacros("MathObjects.pl"); 
2  
48  
3  sub _contextLimitedComplex_init {LimitedComplex::Init()}; # don't load it again 
49  sub _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("LimitedComplexcartesian"); 


30  # Context("LimitedComplexpolar"); 


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("LimitedComplexcartesianstrict"); 


43  # Context("LimitedComplexpolarstrict"); 


44  # Context("LimitedComplexstrict"); 


45  # 


46  


47  =cut 


48  
50  
49  ################################################## 
51  ################################################## 
50  # 
52  # 
51  # Handle common checking for BOPs 
53  # Handle common checking for BOPs 
52  # 
54  # 