Re: [R] R solve equation

2009-02-09 Thread Paul Smith
On Mon, Feb 9, 2009 at 4:46 PM, Giovanni Petris 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 > >> Date: Sat, 07 Feb 2009 02:20:10 -080

Re: [R] R solve equation

2009-02-09 Thread Giovanni Petris
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 > Date: Sat, 07 Feb 2009 02:20:10 -0800 (PST) > From: oryie <43248...@qq.com> > Sender: r-help-boun...@r-pr

Re: [R] R solve equation

2009-02-08 Thread rafamoral
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

Re: [R] R solve equation

2009-02-08 Thread Paul Smith
On Sat, Feb 7, 2009 at 10:20 AM, oryie <43248...@qq.com> wrote: > I want to use R to calculate the variable x which is in some eqation, give > an example: > > 3*x-log(x)+1=0, > > how to solve equation to get the exact x in R? You could use uniroot(), but your equation has no real solution. Paul

[R] R solve equation

2009-02-08 Thread oryie
Hello! I want to use R to calculate the variable x which is in some eqation, give an example: 3*x-log(x)+1=0, how to solve equation to get the exact x in R? Thank you very much! -- View this message in context: http://www.nabble.com/R-solve-equation-tp21886831p21886831.html Sent from the R