Undocumented function SumOfSquaresReps

5

2

There is an interesting (and documented) number-theoretic function in MMA called PowersRepresentations[$n$, $k$, $p$].

It gives the distinct representations of the integer $n$ as a sum of $k$ non-negative $p$-th integer powers.


I recently heard about related undocumented function SumOfSquaresReps.

How can I find out more on that undocumented function (number of arguments etc.)? What does it do exactly? How does it relate to PowersRepresentations, esp. performance-wise? Is there SumOfCubesReps, etc.?

The only place on the Internet known to me where this function is mentioned and used is @kglr answer to a question on this site.


Related:

How does Mathematica compute how to write integers as the sum of k non-negative pth integer powers so quickly?

VividD

Posted 2015-08-30T15:43:24.293

Reputation: 3 500

5"number of arguments etc." - as you can surmise from kglr's answer, it takes two arguments: Reduce`SumOfSquaresReps[k, n] returns all possible lists of k positive integers whose squares sum to n. – J. M.'s ennui – 2015-08-30T15:51:12.997

4

The function is implemented in top-level code, so if you are interested you can look at its implementation using Spelunk[Reduce\SumOfSquaresReps]` (you need "spelunking tools" for this, see this post to get them).

– MarcoB – 2015-08-30T18:19:35.633

Vivid, could you explain what you would like to see in an answer? As I mentioned the first time you asked the question, you can access the actual implementation code for SumOfSquaresReps: ClearAttributes[Reduce`SumOfSquaresReps, ReadProtected];??Reduce`SumOfSquaresReps. What would be more credible and official than the code itself? – MarcoB – 2017-10-16T04:33:34.303

@MarkoB I would like to see everything that I mentioned in the question: implementation details (if possible), perf comparison SumOfSquaresReps vs PowersRepresentations, details on other related undocumented and documented functions, etc... An overview of general methods for exploring internals of built-in functions would definitely not hurt. Thanks for interest and info so far! – VividD – 2017-10-16T11:36:16.017

No answers