diff --git a/expreduce.go b/expreduce.go index d42ae33..b7a0606 100644 --- a/expreduce.go +++ b/expreduce.go @@ -24,7 +24,7 @@ var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file") var netprofile = flag.Bool("netprofile", false, "Enable live profiling at http://localhost:8080/debug/pprof/") var scriptfile = flag.String("script", "", "script `file` to read from") var initfile = flag.String("initfile", "", "A script to run on initialization.") -var loadRubi = flag.Bool("loadrubi", true, "Load the Rubi definitions for integral support on startup.") +var preloadRubi = flag.Bool("preloadrubi", false, "Preload the Rubi definitions for integral support on startup.") func main() { flag.Parse() @@ -44,8 +44,8 @@ func main() { fmt.Printf("Welcome to Expreduce!\n\n") es := expreduce.NewEvalState() - if *loadRubi { - fmt.Println("Loading Rubi snapshot for integral support. Disable with -loadrubi=false.") + if *preloadRubi { + fmt.Println("Pre-loading Rubi snapshot for integral support. Disable with -preloadrubi=false.") es.Eval(atoms.E(atoms.S("LoadRubiBundledSnapshot"))) fmt.Println("Done loading Rubi snapshot.") fmt.Print("\n") diff --git a/expreduce/atoms/ex_complex.go b/expreduce/atoms/ex_complex.go index 37d26ae..ef66507 100644 --- a/expreduce/atoms/ex_complex.go +++ b/expreduce/atoms/ex_complex.go @@ -24,6 +24,9 @@ func (cmplx *Complex) AsExpr() expreduceapi.Ex { } return E(S("Times"), cmplx.Im, iSym) } + if imIsInt && imInt.Val.Int64() == 1 { + return E(S("Plus"), cmplx.Re, iSym) + } return E(S("Plus"), cmplx.Re, E(S("Times"), cmplx.Im, iSym)) } diff --git a/expreduce/resources.go b/expreduce/resources.go index b08cd39..d4f4c02 100644 --- a/expreduce/resources.go +++ b/expreduce/resources.go @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3916d384fed3f084e23c0984d17c4cc22547dc7a10b4ca6f70a3866fcf5beca7 -size 1339970 +oid sha256:de8042936af3daea88a4f4af8ffb88dc239b1f617d391ee29ddb3ec8c6c3cbef +size 1340326 diff --git a/expreduce/resources/calculus.m b/expreduce/resources/calculus.m index 696e6ef..ba82efc 100644 --- a/expreduce/resources/calculus.m +++ b/expreduce/resources/calculus.m @@ -67,6 +67,10 @@ Integrate[a_,{x_Symbol,start_,end_}] := (ReplaceAll[Integrate[a, x],x->end] - ReplaceAll[Integrate[a, x],x->start]) // Simplify; Integrate[a_,x_Symbol] := Module[{cleanedA, replaceRules}, + If[!MemberQ[$ContextPath, "Rubi`"], + Print["Loading Rubi rules for integration. This happens once. Preload on startup with -preloadrubi."]; + LoadRubiBundledSnapshot[] + ]; replaceRules = genSubscriptReplacements[a]; cleanedA = a /. replaceRules[[1]]; (Rubi`Int[cleanedA, x] /. replaceRules[[2]]) // Simplify