src/Vector.php
public function multiplyByScalar($scalar)
    {
        $result = [];
        foreach ($this->components() as $i => $component) {
            $result[$i] = $component * $scalar;
        }

        return new static($result);
    }
public function multiplyByScalar($scalar)
    {
        $result = [];
        foreach ($this->components() as $i => $component) {
            $result[$i] = $component * $scalar;
        }

        return new static($result);
    }
Multiplies the vector by the given scalar.

@api
@param int|float $scalar The real number to multiply by.
@return self The result of the multiplication.