#Dyalog APL , (削除) 22 (削除ここまで)(削除) 21 (削除ここまで) 15 bytes
Dyalog APL , (削除) 22 (削除ここまで)(削除) 21 (削除ここまで) 15 bytes
.5∘(×ばつ.*⍨)⍣⎕
Takes (a,b) as right argument, and prompts for n:
(
×ばつ dot product of 0.5 and the right argument
, followed by
×ばつ.*⍨ "dot power" of the right argument and 0.5*
)⍣⎕ applied numeric-prompt times.
* "dot power" is like dot product, but using multiplication and power instead of plus and multiplication, as follows:
n
A ×ばつ.*⍨ B is ∏ BiA = ∏ B1AB2A
i=1
-3 bytes thanks to ngn.
Old version:
{((+/÷≢)×ばつ/)⍣⍺⊢⍵}
Takes n as left argument and a b as right argument.
⊢⍵ On the RightArg
(...)⍣⍺ recalculate LeftArg times
(+/÷≢) sum divided by tally
, followed by
×ばつ/ the square root of the product.
All the test cases:
f←{((×ばつ+/)×ばつ/)⍣⍺⊢⍵}
0 1 2 5 10 10 f ̈ (24 6)(24 6)(24 6)(24 6)(100 50)(1,2*.5)
┌────┬─────┬────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐
│24 6│15 12│13.5 13.41640786│13.45817148 13.45817148│72.83955155 72.83955155│1.198140235 1.198140235│
└────┴─────┴────────────────┴───────────────────────┴───────────────────────┴───────────────────────┘
#Dyalog APL , (削除) 22 (削除ここまで)(削除) 21 (削除ここまで) 15 bytes
.5∘(×ばつ.*⍨)⍣⎕
Takes (a,b) as right argument, and prompts for n:
(
×ばつ dot product of 0.5 and the right argument
, followed by
×ばつ.*⍨ "dot power" of the right argument and 0.5*
)⍣⎕ applied numeric-prompt times.
* "dot power" is like dot product, but using multiplication and power instead of plus and multiplication, as follows:
n
A ×ばつ.*⍨ B is ∏ BiA = ∏ B1AB2A
i=1
-3 bytes thanks to ngn.
Old version:
{((+/÷≢)×ばつ/)⍣⍺⊢⍵}
Takes n as left argument and a b as right argument.
⊢⍵ On the RightArg
(...)⍣⍺ recalculate LeftArg times
(+/÷≢) sum divided by tally
, followed by
×ばつ/ the square root of the product.
All the test cases:
f←{((×ばつ+/)×ばつ/)⍣⍺⊢⍵}
0 1 2 5 10 10 f ̈ (24 6)(24 6)(24 6)(24 6)(100 50)(1,2*.5)
┌────┬─────┬────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐
│24 6│15 12│13.5 13.41640786│13.45817148 13.45817148│72.83955155 72.83955155│1.198140235 1.198140235│
└────┴─────┴────────────────┴───────────────────────┴───────────────────────┴───────────────────────┘
Dyalog APL , (削除) 22 (削除ここまで)(削除) 21 (削除ここまで) 15 bytes
.5∘(×ばつ.*⍨)⍣⎕
Takes (a,b) as right argument, and prompts for n:
(
×ばつ dot product of 0.5 and the right argument
, followed by
×ばつ.*⍨ "dot power" of the right argument and 0.5*
)⍣⎕ applied numeric-prompt times.
* "dot power" is like dot product, but using multiplication and power instead of plus and multiplication, as follows:
n
A ×ばつ.*⍨ B is ∏ BiA = ∏ B1AB2A
i=1
-3 bytes thanks to ngn.
Old version:
{((+/÷≢)×ばつ/)⍣⍺⊢⍵}
Takes n as left argument and a b as right argument.
⊢⍵ On the RightArg
(...)⍣⍺ recalculate LeftArg times
(+/÷≢) sum divided by tally
, followed by
×ばつ/ the square root of the product.
All the test cases:
f←{((×ばつ+/)×ばつ/)⍣⍺⊢⍵}
0 1 2 5 10 10 f ̈ (24 6)(24 6)(24 6)(24 6)(100 50)(1,2*.5)
┌────┬─────┬────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐
│24 6│15 12│13.5 13.41640786│13.45817148 13.45817148│72.83955155 72.83955155│1.198140235 1.198140235│
└────┴─────┴────────────────┴───────────────────────┴───────────────────────┴───────────────────────┘
#Dyalog APL, (削除) 22 (削除ここまで) 21(削除) 21 (削除ここまで) 15 bytes
{(
.5∘(×ばつ.*⍨)⍣⎕
Takes (+/÷≢a,b) as right argument, and prompts for n:
(
×ばつ dot product of 0.×ばつ/)⍣⍺⊢⍵}5 and the right argument
, followed by
×ばつ.*⍨ "dot power" of the right argument and 0.5*
)⍣⎕ applied numeric-prompt times.
* "dot power" is like dot product, but using multiplication and power instead of plus and multiplication, as follows:
nA ×ばつ.*⍨ B is ∏BiA = ∏B1AB2A
i=1
-3 bytes thanks to ngn.
Old version:
{((+/÷≢)×ばつ/)⍣⍺⊢⍵}
Takes n as left argument and a b as right argument.
⊢⍵ On the RightArg
(...)⍣⍺ recalculate LeftArg times
(+/÷≢) sum divided by tally
, followed by
×ばつ/ the square root of the product.
All the test cases:
f←{((×ばつ+/)×ばつ/)⍣⍺⊢⍵}
0 1 2 5 10 10 f ̈ (24 6)(24 6)(24 6)(24 6)(100 50)(1,2*.5)
┌────┬─────┬────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐
│24 6│15 12│13.5 13.41640786│13.45817148 13.45817148│72.83955155 72.83955155│1.198140235 1.198140235│
└────┴─────┴────────────────┴───────────────────────┴───────────────────────┴───────────────────────┘
#Dyalog APL, (削除) 22 (削除ここまで) 21 bytes
{((+/÷≢),.×ばつ/)⍣⍺⊢⍵}
Takes n as left argument and a b as right argument.
⊢⍵ On the RightArg
(...)⍣⍺ recalculate LeftArg times
(+/÷≢) sum divided by tally
, followed by
×ばつ/ the square root of the product.
All the test cases:
f←{((×ばつ+/)×ばつ/)⍣⍺⊢⍵}
0 1 2 5 10 10 f ̈ (24 6)(24 6)(24 6)(24 6)(100 50)(1,2*.5)
┌────┬─────┬────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐
│24 6│15 12│13.5 13.41640786│13.45817148 13.45817148│72.83955155 72.83955155│1.198140235 1.198140235│
└────┴─────┴────────────────┴───────────────────────┴───────────────────────┴───────────────────────┘
#Dyalog APL, (削除) 22 (削除ここまで) (削除) 21 (削除ここまで) 15 bytes
.5∘(×ばつ.*⍨)⍣⎕
Takes (a,b) as right argument, and prompts for n:
(
×ばつ dot product of 0.5 and the right argument
, followed by
×ばつ.*⍨ "dot power" of the right argument and 0.5*
)⍣⎕ applied numeric-prompt times.
* "dot power" is like dot product, but using multiplication and power instead of plus and multiplication, as follows:
nA ×ばつ.*⍨ B is ∏BiA = ∏B1AB2A
i=1
-3 bytes thanks to ngn.
Old version:
{((+/÷≢)×ばつ/)⍣⍺⊢⍵}
Takes n as left argument and a b as right argument.
⊢⍵ On the RightArg
(...)⍣⍺ recalculate LeftArg times
(+/÷≢) sum divided by tally
, followed by
×ばつ/ the square root of the product.
All the test cases:
f←{((×ばつ+/)×ばつ/)⍣⍺⊢⍵}
0 1 2 5 10 10 f ̈ (24 6)(24 6)(24 6)(24 6)(100 50)(1,2*.5)
┌────┬─────┬────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐
│24 6│15 12│13.5 13.41640786│13.45817148 13.45817148│72.83955155 72.83955155│1.198140235 1.198140235│
└────┴─────┴────────────────┴───────────────────────┴───────────────────────┴───────────────────────┘
APL, (削除) 22 (削除ここまで) 21 bytes
{((+/÷≢)×ばつ/)⍣⍺⊢⍵}
#Dyalog APL , (削除) 22 (削除ここまで) 21 bytes
{((+/÷≢)×ばつ/)⍣⍺⊢⍵}
Takes n as left argument and a b as right argument.
⊢⍵ On the RightArg
(...)⍣⍺ recalculate LeftArg times
(+/÷≢) sum divided by tally
, followed by
×ばつ/ the square root of the product.
All the test cases:
f←{((×ばつ+/)×ばつ/)⍣⍺⊢⍵}
0 1 2 5 10 10 f ̈ (24 6)(24 6)(24 6)(24 6)(100 50)(1,2*.5)
┌────┬─────┬────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐
│24 6│15 12│13.5 13.41640786│13.45817148 13.45817148│72.83955155 72.83955155│1.198140235 1.198140235│
└────┴─────┴────────────────┴───────────────────────┴───────────────────────┴───────────────────────┘
APL, (削除) 22 (削除ここまで) 21 bytes
{((+/÷≢)×ばつ/)⍣⍺⊢⍵}
Takes n as left argument and a b as right argument.
⊢⍵ On the RightArg
(...)⍣⍺ recalculate LeftArg times
(+/÷≢) sum divided by tally
, followed by
×ばつ/ the square root of the product.
All the test cases:
f←{((×ばつ+/)×ばつ/)⍣⍺⊢⍵}
0 1 2 5 10 10 f ̈ (24 6)(24 6)(24 6)(24 6)(100 50)(1,2*.5)
┌────┬─────┬────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐
│24 6│15 12│13.5 13.41640786│13.45817148 13.45817148│72.83955155 72.83955155│1.198140235 1.198140235│
└────┴─────┴────────────────┴───────────────────────┴───────────────────────┴───────────────────────┘
#Dyalog APL , (削除) 22 (削除ここまで) 21 bytes
{((+/÷≢)×ばつ/)⍣⍺⊢⍵}
Takes n as left argument and a b as right argument.
⊢⍵ On the RightArg
(...)⍣⍺ recalculate LeftArg times
(+/÷≢) sum divided by tally
, followed by
×ばつ/ the square root of the product.
All the test cases:
f←{((×ばつ+/)×ばつ/)⍣⍺⊢⍵}
0 1 2 5 10 10 f ̈ (24 6)(24 6)(24 6)(24 6)(100 50)(1,2*.5)
┌────┬─────┬────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐
│24 6│15 12│13.5 13.41640786│13.45817148 13.45817148│72.83955155 72.83955155│1.198140235 1.198140235│
└────┴─────┴────────────────┴───────────────────────┴───────────────────────┴───────────────────────┘