Skip to main content
Post Merged (destination) from mathematica.stackexchange.com/questions/82790/…
added 335 characters in body
Source Link
Greg Hurst
  • 36.8k
  • 1
  • 94
  • 143

Internal`PartitionRagged

This one has a usage statement!

Internal`PartitionRagged[Range[14], {3, 5, 2, 4}]
{{1, 2, 3}, {4, 5, 6, 7, 8}, {9, 10}, {11, 12, 13, 14}}

Note that Length[list] must equal n1 + ... + nk.

(* changed the last 4 to 3 *)
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]

Internal`S1, Internal`S2, Internal`P2

Is it possible to have a documentation of these frequently-used functions with the help of the users in this community?

These guy's aren't frequently used (and probably aren't used at all), but they're really mysterious looking.

After reading this paper, I realized they're submethods used in computing PrimePi.

With[{x = 10^9},
  {
    PrimePi[x],
    Internal`S1[x] + Internal`S2[x] + Internal`P2[x] + PrimePi[x^(1/3)] - 1
  }
]
{50847534, 50847534}

Internal`Square

??Internal`Square
(* Attributes[Internal`Square] = {Listable, NumericFunction, Protected} *)

Test it with a list:

list = RandomReal[{0, 100}, 10^8];

r1 = list*list; // RepeatedTiming
(* 0.118 seconds *)
r2 = list^2; // RepeatedTiming
(* 0.191 seconds *)
r3 = Internal`Square[list]; // RepeatedTiming
(* 0.121 seconds *)

The advantage of this function seems to come when computing higher powers on a list:

lis = RandomReal[{0, 1}, 10^7];

lis*lis*lis*lis; // RepeatedTiming
(* 0.55 seconds *)
lis^4; // RepeatedTiming
(* 0.21 seconds *)
Internal`Square @ Internal`Square @ lis; // RepeatedTiming
(* 0.15 seconds *)

Internal`PartitionRagged

This one has a usage statement!

Internal`PartitionRagged[Range[14], {3, 5, 2, 4}]
{{1, 2, 3}, {4, 5, 6, 7, 8}, {9, 10}, {11, 12, 13, 14}}

Note that Length[list] must equal n1 + ... + nk.

(* changed the last 4 to 3 *)
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]

Internal`S1, Internal`S2, Internal`P2

Is it possible to have a documentation of these frequently-used functions with the help of the users in this community?

These guy's aren't frequently used (and probably aren't used at all), but they're really mysterious looking.

After reading this paper, I realized they're submethods used in computing PrimePi.

With[{x = 10^9},
  {
    PrimePi[x],
    Internal`S1[x] + Internal`S2[x] + Internal`P2[x] + PrimePi[x^(1/3)] - 1
  }
]
{50847534, 50847534}

Internal`Square

??Internal`Square
(* Attributes[Internal`Square] = {Listable, NumericFunction, Protected} *)

Test it with a list:

list = RandomReal[{0, 100}, 10^8];

r1 = list*list; // RepeatedTiming
(* 0.118 seconds *)
r2 = list^2; // RepeatedTiming
(* 0.191 seconds *)
r3 = Internal`Square[list]; // RepeatedTiming
(* 0.121 seconds *)

Internal`PartitionRagged

This one has a usage statement!

Internal`PartitionRagged[Range[14], {3, 5, 2, 4}]
{{1, 2, 3}, {4, 5, 6, 7, 8}, {9, 10}, {11, 12, 13, 14}}

Note that Length[list] must equal n1 + ... + nk.

(* changed the last 4 to 3 *)
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]

Internal`S1, Internal`S2, Internal`P2

Is it possible to have a documentation of these frequently-used functions with the help of the users in this community?

These guy's aren't frequently used (and probably aren't used at all), but they're really mysterious looking.

After reading this paper, I realized they're submethods used in computing PrimePi.

With[{x = 10^9},
  {
    PrimePi[x],
    Internal`S1[x] + Internal`S2[x] + Internal`P2[x] + PrimePi[x^(1/3)] - 1
  }
]
{50847534, 50847534}

Internal`Square

??Internal`Square
(* Attributes[Internal`Square] = {Listable, NumericFunction, Protected} *)

Test it with a list:

list = RandomReal[{0, 100}, 10^8];

r1 = list*list; // RepeatedTiming
(* 0.118 seconds *)
r2 = list^2; // RepeatedTiming
(* 0.191 seconds *)
r3 = Internal`Square[list]; // RepeatedTiming
(* 0.121 seconds *)

The advantage of this function seems to come when computing higher powers on a list:

lis = RandomReal[{0, 1}, 10^7];

lis*lis*lis*lis; // RepeatedTiming
(* 0.55 seconds *)
lis^4; // RepeatedTiming
(* 0.21 seconds *)
Internal`Square @ Internal`Square @ lis; // RepeatedTiming
(* 0.15 seconds *)
deleted 33 characters in body
Source Link
Greg Hurst
  • 36.8k
  • 1
  • 94
  • 143

Internal`PartitionRagged

This one has a usage statement!

Internal`PartitionRagged[Range[14], {3, 5, 2, 4}]
{{1, 2, 3}, {4, 5, 6, 7, 8}, {9, 10}, {11, 12, 13, 14}}

Note that Length[list] must equal n1 + ... + nk.

(* changed the last 4 to 3 *)
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]

Internal`S1, Internal`S2, Internal`P2

Is it possible to have a documentation of these frequently-used functions with the help of the users in this community?

These guy's aren't frequently used (and probably aren't used at all), but they're really mysterious looking.

After reading this paper, I realized they're submethods used in computing PrimePi.

With[{x = 10^9},
  {
    PrimePi[x],
    Internal`S1[x] + Internal`S2[x] + Internal`P2[x] + PrimePi[x^(1/3)] - 1
  }
]
{50847534, 50847534}

Internal`Square

??Internal`Square
(* Attributes[Internal`Square] = {Listable, NumericFunction, Protected} *)

Test it with a list:

Needs["GeneralUtilities`"];
list = RandomReal[{0, 100}, 10^8];

r1 = list*list; // AccurateTimingRepeatedTiming
(* 0.118 seconds *)
r2 = list^2; // AccurateTimingRepeatedTiming
(* 0.191 seconds *)
r3 = Internal`Square[list]; // AccurateTimingRepeatedTiming
(* 0.121 seconds *)

Internal`PartitionRagged

This one has a usage statement!

Internal`PartitionRagged[Range[14], {3, 5, 2, 4}]
{{1, 2, 3}, {4, 5, 6, 7, 8}, {9, 10}, {11, 12, 13, 14}}

Note that Length[list] must equal n1 + ... + nk.

(* changed the last 4 to 3 *)
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]

Internal`S1, Internal`S2, Internal`P2

Is it possible to have a documentation of these frequently-used functions with the help of the users in this community?

These guy's aren't frequently used (and probably aren't used at all), but they're really mysterious looking.

After reading this paper, I realized they're submethods used in computing PrimePi.

With[{x = 10^9},
  {
    PrimePi[x],
    Internal`S1[x] + Internal`S2[x] + Internal`P2[x] + PrimePi[x^(1/3)] - 1
  }
]
{50847534, 50847534}

Internal`Square

??Internal`Square
(* Attributes[Internal`Square] = {Listable, NumericFunction, Protected} *)

Test it with a list:

Needs["GeneralUtilities`"];
list = RandomReal[{0, 100}, 10^8];

r1 = list*list; // AccurateTiming
(* 0.118 seconds *)
r2 = list^2; // AccurateTiming
(* 0.191 seconds *)
r3 = Internal`Square[list]; // AccurateTiming
(* 0.121 seconds *)

Internal`PartitionRagged

This one has a usage statement!

Internal`PartitionRagged[Range[14], {3, 5, 2, 4}]
{{1, 2, 3}, {4, 5, 6, 7, 8}, {9, 10}, {11, 12, 13, 14}}

Note that Length[list] must equal n1 + ... + nk.

(* changed the last 4 to 3 *)
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]

Internal`S1, Internal`S2, Internal`P2

Is it possible to have a documentation of these frequently-used functions with the help of the users in this community?

These guy's aren't frequently used (and probably aren't used at all), but they're really mysterious looking.

After reading this paper, I realized they're submethods used in computing PrimePi.

With[{x = 10^9},
  {
    PrimePi[x],
    Internal`S1[x] + Internal`S2[x] + Internal`P2[x] + PrimePi[x^(1/3)] - 1
  }
]
{50847534, 50847534}

Internal`Square

??Internal`Square
(* Attributes[Internal`Square] = {Listable, NumericFunction, Protected} *)

Test it with a list:

list = RandomReal[{0, 100}, 10^8];

r1 = list*list; // RepeatedTiming
(* 0.118 seconds *)
r2 = list^2; // RepeatedTiming
(* 0.191 seconds *)
r3 = Internal`Square[list]; // RepeatedTiming
(* 0.121 seconds *)
added 432 characters in body
Source Link
dr.blochwave
  • 8.8k
  • 3
  • 43
  • 76

Internal`PartitionRagged

This one has a usage statement!

Internal`PartitionRagged[Range[14], {3, 5, 2, 4}]
{{1, 2, 3}, {4, 5, 6, 7, 8}, {9, 10}, {11, 12, 13, 14}}

Note that Length[list] must equal n1 + ... + nk.

(* changed the last 4 to 3 *)
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]

Internal`S1, Internal`S2, Internal`P2

Is it possible to have a documentation of these frequently-used functions with the help of the users in this community?

These guy's aren't frequently used (and probably aren't used at all), but they're really mysterious looking.

After reading this paper, I realized they're submethods used in computing PrimePi.

With[{x = 10^9},
  {
    PrimePi[x],
    Internal`S1[x] + Internal`S2[x] + Internal`P2[x] + PrimePi[x^(1/3)] - 1
  }
]
{50847534, 50847534}

Internal`Square

??Internal`Square
(* Attributes[Internal`Square] = {Listable, NumericFunction, Protected} *)

Test it with a list:

Needs["GeneralUtilities`"];
list = RandomReal[{0, 100}, 10^8];

r1 = list*list; // AccurateTiming
(* 0.118 seconds *)
r2 = list^2; // AccurateTiming
(* 0.191 seconds *)
r3 = Internal`Square[list]; // AccurateTiming
(* 0.121 seconds *)

Internal`PartitionRagged

This one has a usage statement!

Internal`PartitionRagged[Range[14], {3, 5, 2, 4}]
{{1, 2, 3}, {4, 5, 6, 7, 8}, {9, 10}, {11, 12, 13, 14}}

Note that Length[list] must equal n1 + ... + nk.

(* changed the last 4 to 3 *)
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]

Internal`S1, Internal`S2, Internal`P2

Is it possible to have a documentation of these frequently-used functions with the help of the users in this community?

These guy's aren't frequently used (and probably aren't used at all), but they're really mysterious looking.

After reading this paper, I realized they're submethods used in computing PrimePi.

With[{x = 10^9},
  {
    PrimePi[x],
    Internal`S1[x] + Internal`S2[x] + Internal`P2[x] + PrimePi[x^(1/3)] - 1
  }
]
{50847534, 50847534}

Internal`PartitionRagged

This one has a usage statement!

Internal`PartitionRagged[Range[14], {3, 5, 2, 4}]
{{1, 2, 3}, {4, 5, 6, 7, 8}, {9, 10}, {11, 12, 13, 14}}

Note that Length[list] must equal n1 + ... + nk.

(* changed the last 4 to 3 *)
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]
Internal`PartitionRagged[Range[14], {3, 5, 2, 3}]

Internal`S1, Internal`S2, Internal`P2

Is it possible to have a documentation of these frequently-used functions with the help of the users in this community?

These guy's aren't frequently used (and probably aren't used at all), but they're really mysterious looking.

After reading this paper, I realized they're submethods used in computing PrimePi.

With[{x = 10^9},
  {
    PrimePi[x],
    Internal`S1[x] + Internal`S2[x] + Internal`P2[x] + PrimePi[x^(1/3)] - 1
  }
]
{50847534, 50847534}

Internal`Square

??Internal`Square
(* Attributes[Internal`Square] = {Listable, NumericFunction, Protected} *)

Test it with a list:

Needs["GeneralUtilities`"];
list = RandomReal[{0, 100}, 10^8];

r1 = list*list; // AccurateTiming
(* 0.118 seconds *)
r2 = list^2; // AccurateTiming
(* 0.191 seconds *)
r3 = Internal`Square[list]; // AccurateTiming
(* 0.121 seconds *)
added 462 characters in body
Source Link
Greg Hurst
  • 36.8k
  • 1
  • 94
  • 143
Loading
Source Link
Greg Hurst
  • 36.8k
  • 1
  • 94
  • 143
Loading
Post Made Community Wiki by Greg Hurst