Group Abstract Group Abstract

Message Boards Message Boards

0
|
148 Views
|
6 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Need explanation for FullSimplify result of mathematical expression

Posted 1 day ago

Pardon my curiosity, but I'm wondering how Wolfram calculates

FullSimplify[x == q Quotient[x, q] + Mod[x, q]].

I tried Trace and the TraceOriginal->True option, but I still don't get it. Does Wolfram know it's True, or does it apply some transformation rules to get True?

POSTED BY: Sasha Mandra
6 Replies
Posted 3 hours ago

Got it. Thanks!!! I mistakenly thought that Wolfram computes in much the same way I write a sequence of commands, just along all paths at once, and selects the ones that get closest to the result. It turns out that applying a built-in function is not so easy to detect, much less see the entire computation process.

POSTED BY: Sasha Mandra

Yes, symbolic computation, which is what FullSimplify[] carries out, is done in part via equivalence transformations that are programmed into the system. From a purely mathematical viewpoint, one calls these transformations identities or even theorems. One presumes they are based on how the functions are defined and computed in WL (when there exists more than one definition out in the world). Symbolic computation is inescapably based on theory. I don't think there is another way to perform this computation.

In WL, the transformations are often coded as replacement rules. There is a large table of them SimplifyDump`$FSTab[...]. Internally, FullSimplify[] does more or less what @Gianluca Gorni shows:

Block[{Internal`FunctionExpand`$Debug = True},
 FullSimplify[x == q Quotient[x, q] + Mod[x, q]]
 ]

shows which $FSTab rules were tried

Then exploring which rules cause the transformations, we find these two:

SimplifyDump`$FSTab[540]
Quotient[x, q] /. %
(*
Quotient[SimplifyDump`x_, SimplifyDump`y_] :> 
  Floor[SimplifyDump`x/SimplifyDump`y]
Floor[x/q]
*)

SimplifyDump`$FSTab[680]
Mod[x, q] /. %
(*
Mod[SimplifyDump`x_, SimplifyDump`y_] :> 
  SimplifyDump`x - SimplifyDump`y Floor[SimplifyDump`x/SimplifyDump`y]
x - q Floor[x/q]
*)
POSTED BY: Michael Rogers
Posted 13 hours ago

Rather, from the examples given there, we should conclude that the result is derived from theory rather than computation.

POSTED BY: Sasha Mandra
Posted 13 hours ago

I tried that too, but I didn't detect those transformations. How did you find them?

POSTED BY: Sasha Mandra

This behavior is documented in the "Properties & Relations" section of https://reference.wolfram.com/language/ref/Quotient.html (3rd example therein).

POSTED BY: Michael Rogers

Using Reduce I get the message that it is using FunctionExpand:

Reduce[x == q Quotient[x, q] + Mod[x, q]]

In fact FunctionExpand translates the expression into Floor objects:

FunctionExpand[q Quotient[x, q]]
FunctionExpand[Mod[x, q]]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard