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.

I needed to write patterns that could distinguish between arbitrary-function and polynomial forms of Root objects, for example, Root[{-3 + #1 + #1^E &, 1.2``1}] and Root[-3 + #1 + #1^5 &, 1].

MatchQ[Root[{-3 + #1 + #1^E &, 1.2``1}], Root[{_, _Real}]]
(* True *)

MatchQ[Root[-3 + #1 + #1^5 &, 1], Root[_, _Integer]]
(* False *)

The last result looks unexpected. An investigation shows that there is a third, invisible and, apparently, undocumented argument 0:

Root[-3 + #1 + #1^5 &, 1] // InputForm
(* Root[-3 + #1 + #1^5 & , 1, 0] *)

Once we know this, pattern matching is easy to fix, but still there are some questions:

  • What's the purpose of this parameter? Is it documented anywhere?
  • Why is it invisible in StandardForm and OutputForm?
  • Are there cases when I might need to explicitly provide an argument for it?
share|improve this question
1  
Some info here. Curiously enough, it was asked today :) –  belisarius Oct 25 '13 at 22:45

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.