Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 11 characters in body
Source Link
Rosario
  • 1.7k
  • 5
  • 9

APL(NARS), 76 chars

{⍵⊥⌽⍺⍵⊥⍺}∂

For the input of polynom the list

$$ a_0 a_1 ... a_n $$$$ a_n a_{n-1} ... a_1 a_0 $$

means polynom

$$ a_0+a_1 X^1+ ... +a_n X^n $$

test:$$ a_n X^n+a_{n-1} X^{n-1} ... a_1 X+a_0 $$

 f←{⍵⊥⌽⍺⍵⊥⍺}∂
 4 5 4 f ̄13
5
 05 0 0 4 ̄2 0 0 0 ̄2 4 0 0 50 f 19
1.613438484E13
 0 0 0 0 0 f 400
0
 0 f 400
0
 04.14 0 48 0 4.140 f ̄3
 ̄735.12
  ̄51 0 0 1  ̄5 f 5.4
87.48

APL(NARS), 7 chars

{⍵⊥⌽⍺}∂

For the input of polynom the list

$$ a_0 a_1 ... a_n $$

means polynom

$$ a_0+a_1 X^1+ ... +a_n X^n $$

test:

 f←{⍵⊥⌽⍺}∂
 4 5 f ̄13
5
 0 0 0 4 ̄2 0 0 0 0 0 5 f 19
1.613438484E13
 0 0 0 0 0 f 400
0
 0 f 400
0
 0 0 48 0 4.14 f ̄3
 ̄735.12
  ̄5 0 0 1  f 5.4
87.48

APL(NARS), 6 chars

{⍵⊥⍺}∂

For the input of polynom the list

$$ a_n a_{n-1} ... a_1 a_0 $$

means polynom

$$ a_n X^n+a_{n-1} X^{n-1} ... a_1 X+a_0 $$

 f←{⍵⊥⍺}∂
 5 4 f ̄13
5
 5 0 0 0 0 0 ̄2 4 0 0 0 f 19
1.613438484E13
 0 0 0 0 0 f 400
0
 0 f 400
0
 4.14 0 48 0 0 f ̄3
 ̄735.12
 1 0 0  ̄5 f 5.4
87.48
Source Link
Rosario
  • 1.7k
  • 5
  • 9

APL(NARS), 7 chars

{⍵⊥⌽⍺}∂

For the input of polynom the list

$$ a_0 a_1 ... a_n $$

means polynom

$$ a_0+a_1 X^1+ ... +a_n X^n $$

test:

 f←{⍵⊥⌽⍺}∂
 4 5 f ̄13
5
 0 0 0 4 ̄2 0 0 0 0 0 5 f 19
1.613438484E13
 0 0 0 0 0 f 400
0
 0 f 400
0
 0 0 48 0 4.14 f ̄3 
 ̄735.12
 ̄5 0 0 1 f 5.4 
87.48

AltStyle によって変換されたページ (->オリジナル) /