Re: [R] system solver in R

2018-11-21 Thread peter dalgaard
Once you figure out how to decipher the output, you realise that it actually does give you all 4 roots, including the two real ones: ... > a <- .Last.value > complex_cartesian <- function(x,y) x+(0+1i)*y > eval(a$text[[1]][[2]][[3]]) [1] -1.00028+0.988174i > eval(a$text[[1]][[3]][[3]]) [1] -1.000

Re: [R] system solver in R

2018-11-20 Thread Engin Yılmaz
Yes, it works for me. Eik Vettorazzi , 21 Kas 2018 Çar, 00:19 tarihinde şunu yazdı: > How about this: > > library(rootSolve) > f1<-function(x)5/((1+x)^1) + 5/((1+x)^2) + 5/((1+x)^3) + 105/((1+x)^4) -105 > uniroot.all( f1,c(-1e6,1e6)) > > [1] -1.9881665 0.0363435 > > Cheers > > > Am 20.11.2018 um

Re: [R] system solver in R

2018-11-20 Thread Eik Vettorazzi
How about this: library(rootSolve) f1<-function(x)5/((1+x)^1) + 5/((1+x)^2) + 5/((1+x)^3) + 105/((1+x)^4) -105 uniroot.all( f1,c(-1e6,1e6)) [1] -1.9881665 0.0363435 Cheers Am 20.11.2018 um 13:09 schrieb Engin Yılmaz: Dea(R) I try to solve one equation but this program did not give me real r

Re: [R] system solver in R

2018-11-20 Thread J C Nash
A bit pedestrian, but you might try pf <- function(x){5/((1+x)^1) + 5/((1+x)^2) + 5/((1+x)^3) + 105/((1+x)^4) -105} uniroot(pf,c(-10,10)) curve(pf, c(-10,10)) require(pracma) tryn <- newton(pf, 0) tryn pf(0) pf(0.03634399) yc <- c(-105, 5,5,5,105) rooty <- polyroot(yc) rooty rootx <- 1/rooty - 1 r

Re: [R] system solver in R

2018-11-20 Thread Engin Yılmaz
Dea(R) I try to solve one equation but this program did not give me real roots for example yacas("Solve( 5/((1+x)^1) + 5/((1+x)^2) + 5/((1+x)^3) + 105/((1+x)^4) -105 ==0, x)") gave me following results How can I find real roots? expression(list(x == complex_cartesian((1/42 - ((1/63 - ((root(733945

Re: [R] system solver in R

2018-11-20 Thread Engin Yılmaz
Thanks a lot! Berend Hasselman , 20 Kas 2018 Sal, 12:02 tarihinde şunu yazdı: > > > R package Ryacas may be what you want. > > Berend > > > > On 20 Nov 2018, at 09:42, Engin Yılmaz wrote: > > > > Dea(R) > > > > Do you know any system solver in R ? > > > > For example, in matlab, is very easy > >

Re: [R] system solver in R

2018-11-20 Thread Berend Hasselman
R package Ryacas may be what you want. Berend > On 20 Nov 2018, at 09:42, Engin Yılmaz wrote: > > Dea(R) > > Do you know any system solver in R ? > > For example, in matlab, is very easy > > syms a b c x eqn = a*x^2 + b*x + c == 0; sol = solve(eqn) > > How can I find this type code in

[R] system solver in R

2018-11-20 Thread Engin Yılmaz
Dea(R) Do you know any system solver in R ? For example, in matlab, is very easy syms a b c x eqn = a*x^2 + b*x + c == 0; sol = solve(eqn) How can I find this type code in R (or directly solver)? *Since(R)ely* Engin YILMAZ [[alternative HTML version deleted]] ___