Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

The documentation for PossibleZeroQ says:

  • With the setting Method->"ExactAlgebraics", PossibleZeroQ will use exact guaranteed methods in the case of explicit algebraic numbers.

Unfortunately, there is no formal definition of what expressions are considered explicit algebraic numbers. I noticed that trig functions of rational multiples of π are not considered explicit algebraic numbers. Neither are RootSum expressions with algebraic functions as a second argument, nor Re, Im parts of Root expressions.

In[1]:= PossibleZeroQ[
 Root[-7 + 56 #1^2 - 112 #1^4 + 64 #1^6 &, 4] - Sin[π/7], Method -> "ExactAlgebraics"]

PossibleZeroQ::ztest1: Unable to decide whether numeric quantity Root[-7 + 56 #1^2 - 112 #1^4 + 64 #1^6 &, 4,] - Sin[π/7] is equal to zero. Assumіng‌ it is. >>

Out[1]= True

In[2]:= PossibleZeroQ[
 Root[25 + 3300 #1^4 - 530 #1^8 + 20 #1^12 + #1^16 &, 16] - 
  RootSum[5 - 20 #1^2 + 16 #1^4 &, Sqrt], Method -> "ExactAlgebraics"]

PossibleZeroQ::ztest1: Unable to decide whether numeric quantity Root[25 + 3300 #1^4 - 530 #1^8 + 20 #1^12 + #1^16 &, 16] - RootSum[5 - 20 #1^2 + 16 #1^4 &, Sqrt[#1] &] is equal to zero. Assumіng it is. >>

Out[2]= True

In[3]:= PossibleZeroQ[Re[Root[5 + 20 #1^2 + 16 #1^4 &, 1]], Method -> "ExactAlgebraics"]

PossibleZeroQ::ztest1: Unable to decide whether numeric quantity Re[Root[5 + 20 #1^2 + 16 #1^4 &, 1]] is equal to zero. Assumіng it is. >>

Out[3]= True

Could you suggest a function that can determine if a given expression is considered an explicit algebraic number from PossibleZeroQ's point of view?

share|improve this question
    
...why again are you avoiding RootReduce[]? –  J. M. Jun 6 '13 at 2:31
1  
Thanks, I am well aware of RootReduce. But, first, it can take much time for larger expressions, and if I only need to check for zero, I want to invoke RootReduce only if necessary. Second, it does not work for cases like RootReduce[RootSum[5 - 20 #1^2 + 16 #1^4 &, Sqrt]] so other approaches (e.g. invoke Normal first) may be needed. –  Vladimir Reshetnikov Jun 6 '13 at 2:41
1  
Good question. I find it surprising that there is apparently no problem with a RootSum, and even more so that the sum of a RootSum and a Root is accepted, but the difference isn't. (Differences between Roots, though, are handled without any message.) –  Oleksandr R. Jun 6 '13 at 3:49
    
Also I found, although your example threw warnings at first time, if I evaluate them again, they'll be quiet. –  Silvia Jun 6 '13 at 4:02

1 Answer 1

This is not an answer, but some clue which I think might suggest a bug on what is going on.

First I'd like to state that the following test is done in Mathematica 9.0.1 only, and I have no idea about the cases in other versions.

The inconsistency

Now let's start a fresh kernel, evaluate one of the examples in the question:

PossibleZeroQ[Re[Root[5 + 20 #1^2 + 16 #1^4 &, 1]], Method -> "ExactAlgebraics"]

enter image description here

It threw a warning message as OP described.

Now let's evaluate it again:

enter image description here

To my surprise, the warning is gone!

Trace it!

To invesgate it more detailed, here is the comparison of Trace results:

Restart the kernel, and evaluate the following Dynamic command:

evalCache = {};
Dynamic[evalCache // StringJoin,
        UpdateInterval -> 0, Initialization :> (evalCache := {})]

Keep the Dynamic cell visible and evaluate the following trace command:

With[{cachelength = 20},
 TraceScan[
  Module[{stopCond = False},
    If[Length[evalCache] > cachelength,
       evalCache = evalCache[[-cachelength ;;]]];
    stopCond = ! FreeQ[#, Message] &&
               ! FreeQ[#, MessageName[PossibleZeroQ, "ztest1"]];
    AppendTo[evalCache,
             StringJoin[Flatten@{ConstantArray["|\t", TraceLevel[] - 2],
                           ToString[
                               Framed[#, FrameStyle -> If[stopCond, Red, Hue[.3, .3, .8]]],
                            StandardForm],
                                 "\n"}]
            ];
    If[stopCond, Print[#]; Abort[]]
    ] &,

  PossibleZeroQ[Re[Root[5 + 20 #1^2 + 16 #1^4 &, 1]], Method -> "ExactAlgebraics"],

  TraceInternal -> True, TraceDepth -> 2]
 ]

Record the result in the Dynamic cell, and evaluate evalCache = {} to re-initialize the evaluation chain cache, then re-trace. Hopefully you'll see what happened in my Mathematica, that the second trace result is different from the first, fresh one.

This is what the results look like here. (Please open image in new tab/window to see the details.) The middle one is the result from the first, fresh trace, the right side is from the second trace. For comparison, I also pinned on the left side the result for default setting, i.e. PossibleZeroQ[Re[Root[5 + 20 #1^2 + 16 #1^4 &, 1]]].

Please note the Method option they chose. For the fresh one, even though we explicitly specified Method -> "ExactAlgebraics", it seems Mathematica ignored it and went on with the default settings.

enter image description here

My conjecture: I guess there is a bug here in the method-choosing code.

According to @0x4A4D, PossibleZeroQ[] caches. But nevertheless, hope my trace function will help you/someone find the real answers.

share|improve this answer
    
The caching is easily confirmed: ClearSystemCache[]; PossibleZeroQ[Re[Root[5 + 20 #1^2 + 16 #1^4 &, 1]], Method -> "ExactAlgebraics"] will produce an error even if executed repeatedly. –  J. M. Jun 6 '13 at 7:27
    
@0x4A4D Thanks I see it now. So what do you think about OP's question? –  Silvia Jun 6 '13 at 7:53
    
I haven't the foggiest notion on how to solve it. This will probably need somebody from within WRI to answer. –  J. M. Jun 6 '13 at 7:58
    
@0x4A4D Agree.. –  Silvia Jun 6 '13 at 8:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.