Reduce.jl icon indicating copy to clipboard operation
Reduce.jl copied to clipboard

[Upstream] Integration error? (cannot parse unusual output format)

Open kirtsar opened this issue 6 years ago • 1 comments

My use-case is:

x = :x
int(log(x)/x, x, 0, 1)  # works fine
int(log(x)/(x - 1), x, 0, 1) # error

ERROR: Reduce: 
*hold(limit)$$$$
at line 1

***** Too few right parentheses 


 - 2*limit!+(( - 2*int(log(x)/(2*x**2 + x),x) + log(x)**2)/4,x,0) - sub(x=1,int(
log(x)/(2*x**2 + x),x)) - 2*pi**2

kirtsar avatar Aug 25 '18 12:08 kirtsar

Thanks for pointing this scenario out, I have not encountered this specific use case before.

By the looks of it, this result is not currently supported. You can observe it from the REDUCE code

julia> int(RExpr(log(x)/(x-1)),x,0,1)

                  log(x)             2
           2*int(--------,x) + log(x)
                   2
                  x  - x                                    log(x)            2
 - limit+(-----------------------------,x,0) + sub(x=1,int(--------,x)) - 2*pi
                        2                                    2
                                                            x  - x

julia> int(RExpr(log(x)/(x-1)),x,0,1) |> string
" - limit!+((2*int(log(x)/(x**2 - x),x) + log(x)**2)/2,x,0) + sub(x=1,int(log(x)/(x**2 - x),x)) - 2*pi**2"

The string that is read back into the REDUCE parser contains syntax that is not currently supported by the parser generator. The syntax is not currently part of the parser generator.

Since the output is returned in this format, I'm not immediately sure yet how to handle the parsing, but I will think some more about this and how it might be handled in the future.

As of now, reading back an output of that format and parsing it into Julia is not currently possible.

chakravala avatar Aug 25 '18 13:08 chakravala