3
$\begingroup$

When using RandomInstance on a GeometricScene the answer loses precision when root objects are encountered. Is there a way to make RandomInstance work with exact numbers?

For example consider the following:

scene = 
  GeometricScene[{"O","TA","IA","F"},
    {
    "O" == {0, 0},
    "IA" == {4Sqrt[2], 0},
    EuclideanDistance["O", "TA"] == 4 Sqrt[2],
    PlanarAngle[{"IA", "O", "TA"}, "Counterclockwise"] == 240 °
    }];

Grabbing the point "TA" produces an inexact result:

"TA" /. RandomInstance[scene]["Points"]

How can I make it get the exact answer?

$\endgroup$
10
  • $\begingroup$ Sadly, no. It is a big weakness in the new synthetic geometry system. I reported it to Wolfram tech support awhile ago. In some cases, a reformulation of the problem can fix it so machine precision works. $\endgroup$
    – m_goldberg
    Commented Dec 18, 2020 at 8:54
  • $\begingroup$ Actually, it isn't just "TA". All the points you specify are converted to machine precision. $\endgroup$
    – m_goldberg
    Commented Dec 18, 2020 at 9:06
  • 2
    $\begingroup$ I’m voting to close this question because the OP is asking for functionality that does not exist in the current version of Mathematica. $\endgroup$
    – m_goldberg
    Commented Dec 18, 2020 at 9:08
  • $\begingroup$ In your example, the calculations are accurate enough that Mathematica recognizes that IA and TA have the same length. Is that what you wanted from it? $\endgroup$
    – m_goldberg
    Commented Dec 18, 2020 at 9:31
  • 2
    $\begingroup$ @m_goldberg This question does not need to be closed, nor should it. The OP's question squarely falls within the scope of this site. The question is Is it possible to make RandomInstance work with exact numbers? The answer is simply no. $\endgroup$
    – QuantumDot
    Commented Dec 19, 2020 at 20:00

2 Answers 2

3
$\begingroup$

Currently, all numeric quantities given in a GeometricScene expression are transformed to machine precision when RandomInstance is applied. This can be observed by evaluating the following code.

scene =
  GeometricScene[{"O", "TA", "IA"}, 
    {"O" == {0, 0},
     "IA" == {4 Sqrt[2], 0},
     EuclideanDistance["O", "TA"] == 4 Sqrt[2], 
     PlanarAngle[{"IA", "O", "TA"}, "Counterclockwise"] == 240 °}];
RandomInstance[scene] // InputForm

which produces

scene

Notice that, although the 2nd argument (the hypotheses) preserve the exact quantities you entered, in the 1st argument all the symbolic points have been associated with machine precision quantities and these are the quantities that will be used by RandomInstance and FindGeometricConjectures when making calculations. So there is no way RandomInstance will use exact arithmetic.

However, as explained by chyanog in a comment to your question, sometimes it is possible to recover the exact values from the results returned.

$\endgroup$
2
$\begingroup$

Maybe you can. This seems to work, I guess, on the simple example:

RandomInstance[scene] /. x_Real :> RootApproximant[x] // InputForm
(*
GeometricScene[{{"IA" -> {4*Sqrt[2], 0}, 
   "O" -> {0, 0}, "TA" -> {-2*Sqrt[2], 
     -2*Sqrt[6]}}, {}}, {"O" == {0, 0}, 
  "IA" == {4*Sqrt[2], 0}, 
  EuclideanDistance["O", "TA"] == 4*Sqrt[2], 
  PlanarAngle[{"IA", "O", "TA"}, 
    "Counterclockwise"] == 240*Degree}, {}]
*)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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