jwmerrill / PowerSeries.jl

Truncated Power Series for Julia
MIT License
11 stars 7 forks source link

x*x and x^2 #6

Closed jverzani closed 10 years ago

jverzani commented 10 years ago

Are not equal, and I'm not sure if this is by design:

julia> x = series(0.0, 1.0, 0.0, 0.0)
Series3{Float64}(0.0,1.0,0.0,0.0)

julia> x*x
Series3{Float64}(0.0,0.0,1.0,0.0)

julia> x^2
Series3{Float64}(0.0,0.0,1.0,NaN)

They are the same when

x = series(1.0, 1.0, 0.0, 0.0)
jwmerrill commented 10 years ago

That's pretty ugly. Definitely not by design. I suspect it has to do with a logarithmic factor in the derivative of exponentials, that is NaN when the constant part is 0.0. I'll see if I can get this patched up.

jwmerrill commented 10 years ago

As you may have noticed, PowerSeries could really use some more unit tests.

I would like to combine the derivative definitions used in PowerSeries with definitions used by Calculus.jl (which are also used by DualNumbers.jl, I think) to reduce duplicated effort and bugs, but they aren't in exactly the right form for this application. I've been thinking about trying to extract these definitions from Calculus.jl into a slightly more abstract form and then sticking them in their own package that a bunch of us can all depend on.

jwmerrill commented 10 years ago

Fix is up as v0.1.6

jverzani commented 10 years ago

That was fast. Thanks!