@@ -6,13 +6,7 @@ using Symbolics
66using PyCall
77sympy = pyimport (" sympy" )
88
9- # @syms x 𝐞 a b c d e p t m n z
10- @variables x 𝐞 a b c d e p t m n z
11-
12- axion_rules = [
13- @rule ^ (𝐞, ~ k) => exp (~ k)
14- @rule 𝐞 => MathConstants. e
15- ]
9+ @variables x a b c d e p t m n z
1610
1711function convert_axiom (name:: AbstractString )
1812 fd = open (name, " r" )
@@ -29,16 +23,14 @@ function convert_axiom(name::AbstractString)
2923 if ma != nothing
3024 line = ma. match
3125 println (line)
32- line = replace (line, " %e" => 𝐞 )
26+ line = replace (line, " %e" => MathConstants . e )
3327 line = replace (line, " %i" => im)
3428
3529 try
3630 expr = Meta. parse (line)
3731 P = eval (expr)
3832
3933 print (lineno, " : " , P[1 ], " => " )
40- P[1 ] = Prewalk (PassThrough (Chain (axion_rules)))(P[1 ])
41- P[4 ] = Prewalk (PassThrough (Chain (axion_rules)))(P[4 ])
4234
4335 for ν in Symbolics. get_variables (P[1 ])
4436 if ! isequal (ν, x) && ! haskey (D, ν)
@@ -49,6 +41,7 @@ function convert_axiom(name::AbstractString)
4941 P[1 ] = substitute (P[1 ], D)
5042 P[4 ] = substitute (P[4 ], D)
5143
44+ printstyled (length (L)+ 1 , " : " ; color= :red )
5245 println (P[1 ])
5346 push! (L, P)
5447 catch err
@@ -108,10 +101,11 @@ function accept_integral(sol, ans, x; radius=1.0, abstol=1e-3, n=5)
108101 ϵ = zeros (n)
109102 for i = 1 : n
110103 x₀ = test_point (true , radius)
111- ϵ[i] = abs (substitute (sol - ans, Dict (x => x₀)))
104+ ϵ[i] = value ( abs (substitute (sol - ans, Dict (x => x₀) )))
112105 end
113- return maximum (ϵ) - minimum (ϵ) < abstol
106+ return maximum (ϵ) - minimum (ϵ) <= abstol
114107 catch e
108+ println (e)
115109 end
116110 return false
117111end
@@ -137,7 +131,7 @@ function test_axiom(L, try_sympy=true; kwargs...)
137131 if isequal (sol, 0 )
138132 printstyled (" \t Failure\n " ; color= :red )
139133 n_fail += 1
140- elseif accept_integral (sol, ans, x)
134+ elseif accept_integral (value ( sol), value ( ans) , x)
141135 printstyled (" \t Success:\t " , sol, ' \n ' ; color= :cyan )
142136 n_ok += 1
143137 else
0 commit comments