I’ve been trying to find a function that returns all complex solutions of an equation such as:
16^(1/4) = 2+i0, -2+i0, 0+i2, 0-i2
As it stands, if I enter 16^(1/4) into the console, it only returns 2. I can write a function for this but I was wondering if there is a simple way to do this in R.
You need
polyroot():Where
zis a “vector of polynomial coefficients in increasing order”.The vector I passed to
zin the example above is a compact representation of this equation:Edit:
If
polyroot‘s syntax bothers you, you just could write a wrapper function that presents you with a nicer (if less versatile) interface: