Ask Your Question
0

A simple rational computation throws RuntimeError: ECL says: THROW: The catch RAT-ERR is undefined.

asked 2022-04-18 21:55:42 +0100

tamandua gravatar image

I have two a simple but highly nested (rational) expressions, compute their difference and want to manipulate the output:

sage: x, Y = var('x Y')
sage: xi = function('xi')
sage: phi = function('phi')
sage: e1=1/22*(1/((3993*x**11/((121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) +19216/(x**2*(Y**2/x**4 + 32*Y/x**6 +          256/x**8)))*(55*x**6/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))) - 5*x**3 - 792*x**2/((11*
....: x**3 - 96/(x*(Y/x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))*(5*x**6/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))) - 72*x**2/((11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))) + 5*Y*x**4/(11*x
....: **3 - 96/(x*(Y/x**2 + 16/x**4))))*x**2) + 16/((33*Y*x**7/((5*x**6/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))) - 72*x**2/((11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))*(11*x**3 - 96/
....: (x*(Y/x**2 + 16/x**4)))) - 80*Y*x**4/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))))*x**2))*phi(Y, x)/(3993*x**7/((3993*x**11/((121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y**2/x**4 + 32*
....: Y/x**6 + 256/x**8)))*(55*x**6/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))) - 5*x**3 - 792*x**2/((11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))*(5*x**6/(11*x**3 - 96/(x*(Y/x**2 + 16/x*
....: *4))) - 72*x**2/((11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))) + 5*Y*x**4/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))))*(121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y**2/x
....: **4 + 32*Y/x**6 + 256/x**8)))*(55*x**6/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))) - 5*x**3 - 792*x**2/((11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))*(5*x**6/(11*x**3 - 96/(x*(Y/x**
....: 2 + 16/x**4))) - 72*x**2/((11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))) - 33*Y*x**3/((33*Y*x**7/((5*x**6/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))) - 72*x**2/((11*x**3 - 96/(x*(Y/ 
....: x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))*(11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))) - 80*Y*x**4/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))))*(5*x**6/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))) - 72*x**2/((1
....: 1*x**3 - 96/(x*(Y/x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))*(11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))) + 5*Y/((3993*x**11/((121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y**2/x**4 + 32*Y/
....: x**6 + 256/x**8)))*(55*x**6/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))) - 5*x**3 - 792*x**2/((11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))*(5*x**6/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4
....: ))) - 72*x**2/((11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))) + 5*Y*x**4/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))))*(11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))) + 80*Y/((33*Y*x**7/((5*x
....: **6/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))) - 72*x**2/((11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))*(11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))) - \ 
....: 80*Y*x**4/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))))*(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))))) \ 
....: + xi(Y, x)
 sage: e2=1/22*(1/((363*x**11/((25*x**12/(121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y/x**2 + 16/x**4)**2)) - 720*x**8/((121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y**2/x**4 + 32*Y/x**6 + 256/x**8)))*(Y/x**2 + 16/x**4)) + 5184*x**4/((121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y/x**2 + 16/x**4)**2))*(Y**2/x**4 + 32*Y/x**6 + 256/x**8)))*(121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y**2/x**4 + 32*Y/x**6 + 256/x**8)))) + 5*Y*x**4/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))))*x**2) + 16/((33*Y*x**7/((5*x**6/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))) - 72*x**2/((11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))*(11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))) - 80*Y*x**4/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))))*x**2))*phi(Y, x)/(363*x**7/((25*x**12/(121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y/x**2 + 16/x**4)**2)) - 720*x**8/((121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y**2/x**4 + 32*Y/x**6 + 256/x**8)))*(Y/x**2 + 16/x**4)) + 5184*x**4/((121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y/x**2 + 16/x**4)**2))*(Y**2/x**4 + 32*Y/x**6 + 256/x**8)))*(363*x**11/((25*x**12/(121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y/x**2 + 16/x**4)**2)) - 720*x**8/((121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y**2/x**4 + 32*Y/x**6 + 256/x**8)))*(Y/x**2 + 16/x**4)) + 5184*x**4/((121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y/x**2 + 16/x**4)**2))*(Y**2/x**4 + 32*Y/x**6 + 256/x**8)))*(121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y**2/x**4 + 32*Y/x**6 + 256/x**8)))) + 5*Y*x**4/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))))*(121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y**2/x**4 + 32*Y/x**6 + 256/x**8)))) - 33*Y*x**3/((33*Y*x**7/((5*x**6/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))) - 72*x**2/((11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))*(11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))) - 80*Y*x**4/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))))*(5*x**6/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))) - 72*x**2/((11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))*(11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))) + 5*Y/((363*x**11/((25*x**12/(121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y/x**2 + 16/x**4)**2)) - 720*x**8/((121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y**2/x**4 + 32*Y/x**6 + 256/x**8)))*(Y/x**2 + 16/x**4)) + 5184*x**4/((121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y/x**2 + 16/x**4)**2))*(Y**2/x**4 + 32*Y/x**6 + 256/x**8)))*(121*x**6 - 2112*x**2/(Y/x**2 + 16/x**4) + 9216/(x**2*(Y**2/x**4 + 32*Y/x**6 + 256/x**8)))) + 5*Y*x**4/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))))*(11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))) + 80*Y/((33*Y*x**7/((5*x**6/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))) - 72*x**2/((11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))*(Y/x**2 + 16/x**4)))*(11*x**3 - 96/(x*(Y/x**2 + 16/x**4)))) - 80*Y*x**4/(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))))*(11*x**3 - 96/(x*(Y/x**2 + 16/x**4))))) + xi(Y, x)
sage: v = (e1 - e2).denominator()

This throws a : RuntimeError: ECL says: THROW: The catch RAT-ERR is undefined.

Is there a possible workaround around maxima? This kind of rational expression occur very frequently in my computations.

Sorry for the strange formatting, I have no idea why the copy-paste of e1 gives continuation lines, and that of e2 not.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-04-18 22:41:54 +0100

Emmanuel Charpentier gravatar image

Your original expressions have a problem :

sage: e1.operator()
<function add_vararg at 0x7f1ddc9dddc0>
sage: e1.operands()[1]
xi(Y, x)
sage: e2.operator()
<function add_vararg at 0x7f1ddc9dddc0>
sage: e2.operands()[1]
xi(Y, x)

We might as well work on the first operands :

sage: e10=e1.operands()[0]
sage: e10.operator()
<function mul_vararg at 0x7f1ddc9dde50>

so far so good. But :

sage: e10.operands()[0].denominator()
0

Your e10 is a fraction of null denominator. No wonder Maxima gags on it. BTW :

sage: e2.operands()[0].operands()[0].denominator()
0

e2 has the same problem.

How did you derive e1 and e2 ? The root of your problem is there...

HTH,

edit flag offensive delete link more

Comments

I didn't manage to get one of these expressions equal to zero or to cancel out though the program is full of zero checks.

So THX, I'll try to incorporate one more zero check at the correct position

To answer your last question: I'm computing Janet bases. These are like of Groebner bases but for linear PDE systems. As we all know that the Groebner bases calculation can become quite nasty the calculation of Janet bases can become very nasty, too.

tamandua gravatar imagetamandua ( 2022-04-19 12:55:52 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2022-04-18 21:55:42 +0100

Seen: 169 times

Last updated: Apr 18 '22