@@ -2,10 +2,10 @@ module SymPyPythonCallSymbolicsExt
2
2
3
3
# from https://github.com/JuliaSymbolics/Symbolics.jl/pull/957/
4
4
# by @jClugstor
5
- using SymPyPythonCall
5
+ import SymPyPythonCall
6
6
const sp = SymPyPythonCall. sympy. py
7
7
const PythonCall = SymPyPythonCall. PythonCall
8
- import SymPyPythonCall . PythonCall: Py, pyisinstance, pyconvert
8
+ import PythonCall: Py, pyisinstance, pyconvert
9
9
10
10
import Symbolics
11
11
import Symbolics: @variables
38
38
39
39
function pyconvert_rule_sympy_add (:: Type{Symbolics.Num} , x:: Py )
40
40
if ! pyisinstance (x,sp. Add)
41
- return PythonCall. pyconvert_unconverted ()
41
+ return PythonCall. pyconvert_unconverted ()
42
42
end
43
43
sum = reduce (+ , PythonCall. pyconvert .(Symbolics. Num,x. args))
44
44
return PythonCall. pyconvert_return (sum)
45
45
end
46
46
47
47
function pyconvert_rule_sympy_equality (:: Type{Symbolics.Equation} , x:: Py )
48
48
if ! pyisinstance (x,sp. Equality)
49
- return PythonCall. pyconvert_unconverted ()
49
+ return PythonCall. pyconvert_unconverted ()
50
50
end
51
51
rhs = pyconvert (Symbolics. Num,x. rhs)
52
52
lhs = pyconvert (Symbolics. Num,x. lhs)
53
53
return PythonCall. pyconvert_return (rhs ~ lhs)
54
54
end
55
-
56
55
function pyconvert_rule_sympy_derivative (:: Type{Symbolics.Num} , x:: Py )
57
56
if ! pyisinstance (x,sp. Derivative)
58
57
return PythonCall. pyconvert_unconverted ()
@@ -74,10 +73,10 @@ function pyconvert_rule_sympy_function(::Type{Symbolics.Num}, x::Py)
74
73
end
75
74
76
75
# added rules
77
- PythonCall. pyconvert_add_rule (" sympy.core.power:Pow" , Symbolics. Num, pyconvert_rule_sympy_pow)
78
-
79
76
PythonCall. pyconvert_add_rule (" sympy.core.symbol:Symbol" , Symbolics. Num, pyconvert_rule_sympy_symbol)
80
77
78
+ PythonCall. pyconvert_add_rule (" sympy.core.power:Pow" , Symbolics. Num, pyconvert_rule_sympy_pow)
79
+
81
80
PythonCall. pyconvert_add_rule (" sympy.core.mul:Mul" , Symbolics. Num, pyconvert_rule_sympy_mul)
82
81
83
82
PythonCall. pyconvert_add_rule (" sympy.core.add:Add" , Symbolics. Num, pyconvert_rule_sympy_add)
0 commit comments