diff --git a/mathics/builtin/atomic/numbers.py b/mathics/builtin/atomic/numbers.py index 4f8d143a1..6d31f447c 100644 --- a/mathics/builtin/atomic/numbers.py +++ b/mathics/builtin/atomic/numbers.py @@ -45,7 +45,7 @@ SymbolRound, ) from mathics.eval.nevaluator import eval_N -from mathics.eval.numbers import eval_Accuracy, eval_Precision +from mathics.eval.numbers.numbers import eval_Accuracy, eval_Precision SymbolIntegerDigits = Symbol("IntegerDigits") SymbolIntegerExponent = Symbol("IntegerExponent") diff --git a/mathics/builtin/numbers/algebra.py b/mathics/builtin/numbers/algebra.py index 3ea0052d9..9c21f7782 100644 --- a/mathics/builtin/numbers/algebra.py +++ b/mathics/builtin/numbers/algebra.py @@ -17,7 +17,6 @@ import sympy -from mathics.algorithm.simplify import default_complexity_function from mathics.builtin.inference import evaluate_predicate from mathics.builtin.options import options_to_rules from mathics.builtin.scoping import dynamic_scoping @@ -64,7 +63,8 @@ SymbolTable, SymbolTanh, ) -from mathics.eval.numbers import cancel, sympy_factor +from mathics.eval.numbers.algebra.simplify import default_complexity_function +from mathics.eval.numbers.numbers import cancel, sympy_factor from mathics.eval.parts import walk_parts from mathics.eval.patterns import match diff --git a/mathics/builtin/numbers/calculus.py b/mathics/builtin/numbers/calculus.py index 987d201a0..ad5c38a1d 100644 --- a/mathics/builtin/numbers/calculus.py +++ b/mathics/builtin/numbers/calculus.py @@ -15,18 +15,6 @@ import numpy as np import sympy -from mathics.algorithm.integrators import ( - _fubini, - _internal_adaptative_simpsons_rule, - decompose_domain, - eval_D_to_Integral, -) -from mathics.algorithm.series import ( - build_series, - series_derivative, - series_plus_series, - series_times_series, -) from mathics.builtin.scoping import dynamic_scoping from mathics.core.atoms import ( Atom, @@ -90,6 +78,18 @@ ) from mathics.eval.makeboxes import format_element from mathics.eval.nevaluator import eval_N +from mathics.eval.numbers.calculus.integrators import ( + _fubini, + _internal_adaptative_simpsons_rule, + decompose_domain, + eval_D_to_Integral, +) +from mathics.eval.numbers.calculus.series import ( + build_series, + series_derivative, + series_plus_series, + series_times_series, +) # These should be used in lower-level formatting SymbolDifferentialD = Symbol("System`DifferentialD") @@ -748,7 +748,9 @@ class FindMaximum(_BaseFinder): messages = _BaseFinder.messages.copy() summary_text = "local maximum optimization" try: - from mathics.algorithm.optimizers import native_local_optimizer_methods + from mathics.eval.numbers.calculus.optimizers import ( + native_local_optimizer_methods, + ) methods.update(native_local_optimizer_methods) except Exception: @@ -797,7 +799,7 @@ class FindMinimum(_BaseFinder): messages = _BaseFinder.messages.copy() summary_text = "local minimum optimization" try: - from mathics.algorithm.optimizers import ( + from mathics.eval.numbers.calculus.optimizers import ( native_local_optimizer_methods, native_optimizer_messages, ) @@ -883,7 +885,7 @@ class FindRoot(_BaseFinder): ) try: - from mathics.algorithm.optimizers import ( + from mathics.eval.numbers.calculus.optimizers import ( native_findroot_messages, native_findroot_methods, ) @@ -1349,7 +1351,7 @@ class NIntegrate(Builtin): try: # builtin integrators - from mathics.algorithm.integrators import ( + from mathics.eval.numbers.calculus.integrators import ( integrator_messages, integrator_methods, ) diff --git a/mathics/core/builtin.py b/mathics/core/builtin.py index 31845afa7..3e26f3a71 100644 --- a/mathics/core/builtin.py +++ b/mathics/core/builtin.py @@ -63,7 +63,7 @@ SymbolSequence, ) from mathics.eval.arithmetic import eval_mpmath_function -from mathics.eval.numbers import cancel +from mathics.eval.numbers.numbers import cancel from mathics.eval.numerify import numerify from mathics.eval.scoping import dynamic_scoping diff --git a/mathics/eval/numbers/__init__.py b/mathics/eval/numbers/__init__.py new file mode 100644 index 000000000..6166b84b7 --- /dev/null +++ b/mathics/eval/numbers/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +""" +Implementation of mathics.builtin.numbers +""" diff --git a/mathics/eval/numbers/algebra/__init__.py b/mathics/eval/numbers/algebra/__init__.py new file mode 100644 index 000000000..20769ed33 --- /dev/null +++ b/mathics/eval/numbers/algebra/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +""" +Implementation of mathics.builtin.numbers.algebra +""" diff --git a/mathics/algorithm/simplify.py b/mathics/eval/numbers/algebra/simplify.py similarity index 100% rename from mathics/algorithm/simplify.py rename to mathics/eval/numbers/algebra/simplify.py diff --git a/mathics/eval/numbers/calculus/__init__.py b/mathics/eval/numbers/calculus/__init__.py new file mode 100644 index 000000000..5f2e067a0 --- /dev/null +++ b/mathics/eval/numbers/calculus/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +""" +Implementation of mathics.builtin.numbers.calculus +""" diff --git a/mathics/algorithm/integrators.py b/mathics/eval/numbers/calculus/integrators.py similarity index 99% rename from mathics/algorithm/integrators.py rename to mathics/eval/numbers/calculus/integrators.py index e10ef8999..31e9d4884 100644 --- a/mathics/algorithm/integrators.py +++ b/mathics/eval/numbers/calculus/integrators.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- - +""" +Implementation of builtin function integrators. +""" import numpy as np from mathics.core.atoms import Integer, Integer0, Number diff --git a/mathics/algorithm/optimizers.py b/mathics/eval/numbers/calculus/optimizers.py similarity index 99% rename from mathics/algorithm/optimizers.py rename to mathics/eval/numbers/calculus/optimizers.py index 6fd40270b..cfdba2b5a 100644 --- a/mathics/algorithm/optimizers.py +++ b/mathics/eval/numbers/calculus/optimizers.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- - +""" +Implementation of builtin optimizers. +""" from typing import Optional from mathics.builtin.scoping import dynamic_scoping diff --git a/mathics/algorithm/series.py b/mathics/eval/numbers/calculus/series.py similarity index 99% rename from mathics/algorithm/series.py rename to mathics/eval/numbers/calculus/series.py index c627fd7ec..2cbb5cb55 100644 --- a/mathics/algorithm/series.py +++ b/mathics/eval/numbers/calculus/series.py @@ -1,3 +1,7 @@ +# -*- coding: utf-8 -*- +""" +Implementation of Series handling functions. +""" from mathics.core.atoms import Integer, Integer0, Rational from mathics.core.convert.expression import to_mathics_list from mathics.core.expression import Expression diff --git a/mathics/eval/numbers.py b/mathics/eval/numbers/numbers.py similarity index 98% rename from mathics/eval/numbers.py rename to mathics/eval/numbers/numbers.py index 7389ac8d3..628043d4e 100644 --- a/mathics/eval/numbers.py +++ b/mathics/eval/numbers/numbers.py @@ -1,3 +1,8 @@ +# -*- coding: utf-8 -*- +""" +Implementation of numbers handling functions. +""" + from typing import Optional import mpmath