@@ -201,7 +201,7 @@ class Accuracy(Builtin):
201201
202202 summary_text = "find the accuracy of a number"
203203
204- def apply (self , z , evaluation ):
204+ def eval (self , z , evaluation ):
205205 "Accuracy[z_]"
206206 if isinstance (z , Real ):
207207 if z .is_zero :
@@ -211,8 +211,8 @@ def apply(self, z, evaluation):
211211 return MachineReal (dps (z .get_precision ()) - log10_z )
212212
213213 if isinstance (z , Complex ):
214- acc_real = self .apply (z .real , evaluation )
215- acc_imag = self .apply (z .imag , evaluation )
214+ acc_real = self .eval (z .real , evaluation )
215+ acc_imag = self .eval (z .imag , evaluation )
216216 if acc_real is SymbolInfinity :
217217 return acc_imag
218218 if acc_imag is SymbolInfinity :
@@ -222,7 +222,7 @@ def apply(self, z, evaluation):
222222 if isinstance (z , Expression ):
223223 result = None
224224 for element in z .elements :
225- candidate = self .apply (element , evaluation )
225+ candidate = self .eval (element , evaluation )
226226 if isinstance (candidate , Real ):
227227 candidate_f = candidate .to_python ()
228228 if result is None or candidate_f < result :
@@ -296,7 +296,7 @@ class IntegerExponent(Builtin):
296296
297297 summary_text = "number of trailing 0s in a given base"
298298
299- def apply_two_arg_integers (self , n : Integer , b : Integer , evaluation ):
299+ def eval_two_arg_integers (self , n : Integer , b : Integer , evaluation ):
300300 "IntegerExponent[n_Integer, b_Integer]"
301301
302302 py_n , py_b = n .value , b .value
@@ -313,7 +313,7 @@ def apply_two_arg_integers(self, n: Integer, b: Integer, evaluation):
313313
314314 # FIXME: If WMA supports things other than Integers, the below code might
315315 # be useful as a starting point.
316- # def apply (self, n: Integer, b: Integer, evaluation):
316+ # def eval (self, n: Integer, b: Integer, evaluation):
317317 # "IntegerExponent[n_Integer, b_Integer]"
318318
319319 # py_n, py_b = n.to_python(), b.to_python()
@@ -386,7 +386,7 @@ class IntegerLength(Builtin):
386386
387387 summary_text = "total number of digits in any base"
388388
389- def apply (self , n , b , evaluation ):
389+ def eval (self , n , b , evaluation ):
390390 "IntegerLength[n_, b_]"
391391
392392 n , b = n .get_int_value (), b .get_int_value ()
@@ -587,17 +587,17 @@ class RealDigits(Builtin):
587587
588588 summary_text = "digits of a real number"
589589
590- def apply_complex (self , n , var , evaluation ):
590+ def eval_complex (self , n , var , evaluation ):
591591 "%(name)s[n_Complex, var___]"
592592 return evaluation .message ("RealDigits" , "realx" , n )
593593
594- def apply_rational_with_base (self , n , b , evaluation ):
594+ def eval_rational_with_base (self , n , b , evaluation ):
595595 "%(name)s[n_Rational, b_Integer]"
596596 # expr = Expression(SymbolRealDigits, n)
597597 py_n = abs (n .value )
598598 py_b = b .value
599599 if check_finite_decimal (n .denominator ().get_int_value ()) and not py_b % 2 :
600- return self .apply_with_base (n , b , evaluation )
600+ return self .eval_with_base (n , b , evaluation )
601601 else :
602602 exp = int (mpmath .ceil (mpmath .log (py_n , py_b )))
603603 (head , tails ) = convert_repeating_decimal (
@@ -612,12 +612,12 @@ def apply_rational_with_base(self, n, b, evaluation):
612612 list_expr = ListExpression (* elements )
613613 return ListExpression (list_expr , Integer (exp ))
614614
615- def apply_rational_without_base (self , n , evaluation ):
615+ def eval_rational_without_base (self , n , evaluation ):
616616 "%(name)s[n_Rational]"
617617
618- return self .apply_rational_with_base (n , Integer (10 ), evaluation )
618+ return self .eval_rational_with_base (n , Integer (10 ), evaluation )
619619
620- def apply (self , n , evaluation ):
620+ def eval (self , n , evaluation ):
621621 "%(name)s[n_]"
622622
623623 # Handling the testcases that throw the error message and return the
@@ -626,9 +626,9 @@ def apply(self, n, evaluation):
626626 return evaluation .message ("RealDigits" , "ndig" , n )
627627
628628 if n .is_numeric (evaluation ):
629- return self .apply_with_base (n , from_python (10 ), evaluation )
629+ return self .eval_with_base (n , from_python (10 ), evaluation )
630630
631- def apply_with_base (self , n , b , evaluation , nr_elements = None , pos = None ):
631+ def eval_with_base (self , n , b , evaluation , nr_elements = None , pos = None ):
632632 "%(name)s[n_?NumericQ, b_Integer]"
633633
634634 expr = Expression (SymbolRealDigits , n )
@@ -739,7 +739,7 @@ def apply_with_base(self, n, b, evaluation, nr_elements=None, pos=None):
739739 list_expr = ListExpression (* elements )
740740 return ListExpression (list_expr , Integer (exp ))
741741
742- def apply_with_base_and_length (self , n , b , length , evaluation , pos = None ):
742+ def eval_with_base_and_length (self , n , b , length , evaluation , pos = None ):
743743 "%(name)s[n_?NumericQ, b_Integer, length_]"
744744 elements = []
745745 if pos is not None :
@@ -748,18 +748,18 @@ def apply_with_base_and_length(self, n, b, length, evaluation, pos=None):
748748 if not (isinstance (length , Integer ) and length .get_int_value () >= 0 ):
749749 return evaluation .message ("RealDigits" , "intnm" , expr )
750750
751- return self .apply_with_base (
751+ return self .eval_with_base (
752752 n , b , evaluation , nr_elements = length .get_int_value (), pos = pos
753753 )
754754
755- def apply_with_base_length_and_precision (self , n , b , length , p , evaluation ):
755+ def eval_with_base_length_and_precision (self , n , b , length , p , evaluation ):
756756 "%(name)s[n_?NumericQ, b_Integer, length_, p_]"
757757 if not isinstance (p , Integer ):
758758 return evaluation .message (
759759 "RealDigits" , "intm" , Expression (SymbolRealDigits , n , b , length , p )
760760 )
761761
762- return self .apply_with_base_and_length (
762+ return self .eval_with_base_and_length (
763763 n , b , length , evaluation , pos = p .get_int_value ()
764764 )
765765
@@ -1004,7 +1004,7 @@ class NumericQ(Builtin):
10041004 }
10051005 summary_text = "test whether an expression is a number"
10061006
1007- def apply (self , expr , evaluation ):
1007+ def eval (self , expr , evaluation ):
10081008 "NumericQ[expr_]"
10091009 return from_bool (expr .is_numeric (evaluation ))
10101010
@@ -1060,16 +1060,16 @@ class Precision(Builtin):
10601060
10611061 summary_text = "find the precision of a number"
10621062
1063- def apply (self , z , evaluation ):
1063+ def eval (self , z , evaluation ):
10641064 "Precision[z_]"
10651065 if isinstance (z , Real ):
10661066 if z .is_zero :
10671067 return MachineReal0
10681068 return MachineReal (dps (z .get_precision ()))
10691069
10701070 if isinstance (z , Complex ):
1071- prec_real = self .apply (z .real , evaluation )
1072- prec_imag = self .apply (z .imag , evaluation )
1071+ prec_real = self .eval (z .real , evaluation )
1072+ prec_imag = self .eval (z .imag , evaluation )
10731073 if prec_real is SymbolInfinity :
10741074 return prec_imag
10751075 if prec_imag is SymbolInfinity :
@@ -1080,7 +1080,7 @@ def apply(self, z, evaluation):
10801080 if isinstance (z , Expression ):
10811081 result = None
10821082 for element in z .elements :
1083- candidate = self .apply (element , evaluation )
1083+ candidate = self .eval (element , evaluation )
10841084 if isinstance (candidate , Real ):
10851085 candidate_f = candidate .to_python ()
10861086 if result is None or candidate_f < result :
0 commit comments