Skip to content

R solve equation

5 messages · oryie, Paul Smith, rafamoral +1 more

1 day later
#
On Sat, Feb 7, 2009 at 10:20 AM, oryie <43248523 at qq.com> wrote:
You could use uniroot(), but your equation has no real solution.

Paul
#
If you are looking for a solution to a polynomial equation with imaginary
solutions you could use polyroot().
Example:
To solve the equation: 1 + x + x^3 + 2*x^4 = 0
you create a vector with the coefficients of x and use polyroot:

z <- matrix(c(1,1,0,1,2), ncol=1)
polyroot(z)

Also try ?polyroot

Rafael
Paul Smith wrote:

  
    
#
As suggested by somebody else, uniroot() can be used to solve
equations in one unknown variable. However, you will never get the
"exact x" in R, only an approximate root... 

Best,
Giovanni

  
    
#
On Mon, Feb 9, 2009 at 4:46 PM, Giovanni Petris <GPetris at uark.edu> wrote:
That is correct, Giovanni. But the given equation has no (real) solution.

Paul