Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

75%
+4 −0
Challenges Evaluate a single variable polynomial equation

Vyxal, 6, 5, 4 bytes Źe*∑ Try it Online! Takes input in the format coeffs, x Explained Źe*∑ Ź # Generate range [0, len(coeffs)) e # Calculate x ** [0, len(coeffs) (vectorising) ...

posted 3y ago by lyxal‭  ·  edited 3y ago by lyxal‭

Answer
#9: Post edited by user avatar lyxal‭ · 2021-01-11T22:38:14Z (over 3 years ago)
  • # [Vyxal](https://github.com/Lyxal/Vyxal), <strike>6</strike> 5 bytes
  • :ʁe*∑
  • Takes input in the format `x, coeffs`
  • ## Explained
  • ```
  • e*∑
  • # Duplicate x and generate the range [0, x)
  • e # Calculate x ** [0, x) (vectorising)
  • * # Multiply the coefficients by the exponated x's. The lists are extended with 0s to be the same length
  • # Sum that list and output
  • ```
  • # [Vyxal](https://github.com/Lyxal/Vyxal), <s>6</s>, <s>5</s>, 4 bytes
  • ```
  • Źe*∑
  • ```
  • [Try it Online!](http://lyxal.pythonanywhere.com?flags=&code=%C5%B9e*%E2%88%91&inputs=%5B1.0,%202.0,%203.0,%204.0%5D%0A1.5)
  • Takes input in the format `coeffs, x`
  • ## Explained
  • ```
  • Źe*∑
  • Ź # Generate range [0, len(coeffs))
  • e # Calculate x ** [0, len(coeffs) (vectorising)
  • * # Multiply the coefficients by the exponated x's. The lists are extended with 0s to be the same length
  • # Sum that list and output
  • ```
#8: Post edited by user avatar Moshi‭ · 2020-11-14T00:37:37Z (over 3 years ago)
  • # [Vyxal](https://github.com/Lyxal/Vyxal), <del>6</del> 5 bytes
  • :ʁe*∑
  • Takes input in the format `x, coeffs`
  • ## Explained
  • ```
  • :ʁe*∑
  • :ʁ # Duplicate x and generate the range [0, x)
  • e # Calculate x ** [0, x) (vectorising)
  • * # Multiply the coefficients by the exponated x's. The lists are extended with 0s to be the same length
  • ∑ # Sum that list and output
  • ```
  • # [Vyxal](https://github.com/Lyxal/Vyxal), <strike>6</strike> 5 bytes
  • :ʁe*∑
  • Takes input in the format `x, coeffs`
  • ## Explained
  • ```
  • :ʁe*∑
  • :ʁ # Duplicate x and generate the range [0, x)
  • e # Calculate x ** [0, x) (vectorising)
  • * # Multiply the coefficients by the exponated x's. The lists are extended with 0s to be the same length
  • ∑ # Sum that list and output
  • ```
#7: Post edited by user avatar moony‭ · 2020-11-13T23:39:13Z (over 3 years ago)
#6: Post edited by user avatar lyxal‭ · 2020-11-13T23:38:58Z (over 3 years ago)
  • # [Vyxal](https://github.com/Lyxal/Vyxal), ~~6~~ 5 bytes
  • :ʁe*∑
  • Takes input in the format `x, coeffs`
  • ## Explained
  • ```
  • :ʁe*∑
  • :ʁ # Duplicate x and generate the range [0, x)
  • e # Calculate x ** [0, x) (vectorising)
  • * # Multiply the coefficients by the exponated x's. The lists are extended with 0s to be the same length
  • ∑ # Sum that list and output
  • ```
  • # [Vyxal](https://github.com/Lyxal/Vyxal), <del>6</del> 5 bytes
  • :ʁe*∑
  • Takes input in the format `x, coeffs`
  • ## Explained
  • ```
  • :ʁe*∑
  • :ʁ # Duplicate x and generate the range [0, x)
  • e # Calculate x ** [0, x) (vectorising)
  • * # Multiply the coefficients by the exponated x's. The lists are extended with 0s to be the same length
  • ∑ # Sum that list and output
  • ```
#5: Post edited by user avatar lyxal‭ · 2020-11-13T23:27:41Z (over 3 years ago)
  • # [Vyxal](https://github.com/Lyxal/Vyxal), <s>.6.</s> 5 bytes
  • :ʁe*∑
  • Takes input in the format `x, coeffs`
  • ## Explained
  • ```
  • :ʁe*∑
  • :ʁ # Duplicate x and generate the range [0, x)
  • e # Calculate x ** [0, x) (vectorising)
  • * # Multiply the coefficients by the exponated x's. The lists are extended with 0s to be the same length
  • ∑ # Sum that list and output
  • ```
  • # [Vyxal](https://github.com/Lyxal/Vyxal), ~~6~~ 5 bytes
  • :ʁe*∑
  • Takes input in the format `x, coeffs`
  • ## Explained
  • ```
  • :ʁe*∑
  • :ʁ # Duplicate x and generate the range [0, x)
  • e # Calculate x ** [0, x) (vectorising)
  • * # Multiply the coefficients by the exponated x's. The lists are extended with 0s to be the same length
  • ∑ # Sum that list and output
  • ```
#4: Post edited by user avatar lyxal‭ · 2020-11-13T23:27:16Z (over 3 years ago)
  • # [Vyxal](https://github.com/Lyxal/Vyxal), <s>6</s> 5 bytes
  • :ʁe*∑
  • Takes input in the format `x, coeffs`
  • ## Explained
  • ```
  • :ʁe*∑
  • :ʁ # Duplicate x and generate the range [0, x)
  • e # Calculate x ** [0, x) (vectorising)
  • * # Multiply the coefficients by the exponated x's. The lists are extended with 0s to be the same length
  • ∑ # Sum that list and output
  • ```
  • # [Vyxal](https://github.com/Lyxal/Vyxal), <s>.6.</s> 5 bytes
  • :ʁe*∑
  • Takes input in the format `x, coeffs`
  • ## Explained
  • ```
  • :ʁe*∑
  • :ʁ # Duplicate x and generate the range [0, x)
  • e # Calculate x ** [0, x) (vectorising)
  • * # Multiply the coefficients by the exponated x's. The lists are extended with 0s to be the same length
  • ∑ # Sum that list and output
  • ```
#3: Post edited by user avatar lyxal‭ · 2020-11-13T23:26:48Z (over 3 years ago)
  • # [Vyxal](https://github.com/Lyxal/Vyxal), 6 bytes
  • $:ʁe*∑
  • Takes input in the format `coeffs, x`
  • ## Explained
  • ```$:ʁe*∑
  • $ # Swap the two inputs so that the stack is [coeffs, x]
  • :ʁ # Duplicate x and generate the range [0, x)
  • e # Calculate x ** [0, x) (vectorising)
  • * # Multiply the coefficients by the exponated x's. The lists are extended with 0s to be the same length
  • ∑ # Sum that list and output
  • ```
  • # [Vyxal](https://github.com/Lyxal/Vyxal), <s>6</s> 5 bytes
  • :ʁe*∑
  • Takes input in the format `x, coeffs`
  • ## Explained
  • ```
  • :ʁe*∑
  • :ʁ # Duplicate x and generate the range [0, x)
  • e # Calculate x ** [0, x) (vectorising)
  • * # Multiply the coefficients by the exponated x's. The lists are extended with 0s to be the same length
  • ∑ # Sum that list and output
  • ```
#2: Post edited by user avatar lyxal‭ · 2020-11-13T23:25:35Z (over 3 years ago)
  • # [Vyxal](https://github.com/Lyxal/Vyxal), 6 bytes
  • $:ʁe*∑
  • ## Explained
  • ```$:ʁe*∑
  • $ # Swap the two inputs so that the stack is [coeffs, x]
  • :ʁ # Duplicate x and generate the range [0, x)
  • e # Calculate x ** [0, x) (vectorising)
  • * # Multiply the coefficients by the exponated x's. The lists are extended with 0s to be the same length
  • ∑ # Sum that list and output
  • ```
  • # [Vyxal](https://github.com/Lyxal/Vyxal), 6 bytes
  • $:ʁe*∑
  • Takes input in the format `coeffs, x`
  • ## Explained
  • ```$:ʁe*∑
  • $ # Swap the two inputs so that the stack is [coeffs, x]
  • :ʁ # Duplicate x and generate the range [0, x)
  • e # Calculate x ** [0, x) (vectorising)
  • * # Multiply the coefficients by the exponated x's. The lists are extended with 0s to be the same length
  • ∑ # Sum that list and output
  • ```
#1: Initial revision by user avatar lyxal‭ · 2020-11-13T23:25:12Z (over 3 years ago)
# [Vyxal](https://github.com/Lyxal/Vyxal), 6 bytes

    $:ʁe*∑

## Explained

```$:ʁe*∑
$       # Swap the two inputs so that the stack is [coeffs, x]
 :ʁ     # Duplicate x and generate the range [0, x)
   e    # Calculate x ** [0, x) (vectorising)
    *   # Multiply the coefficients by the exponated x's. The lists are extended with 0s to be the same length
     ∑  # Sum that list and output
```