[R] system solver in R
Eik Vettorazzi
E@Vettor@zzi @ending from uke@de
Tue Nov 20 22:19:11 CET 2018
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 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(7339451281/3087580356,
> 2) - 4535/71442)^(1/3) - (4535/71442 + root(7339451281/3087580356,
> 2))^(1/3)))/21 - -2/21)/(4 * root(((root(7339451281/3087580356,
> 2) - 4535/71442)^(1/3) - (4535/71442 + root(7339451281/3087580356,
> 2))^(1/3) - 1/63)^2/4 + 1, 2)))/2 - 1, root(4 *
> (((root(7339451281/3087580356,
> 2) - 4535/71442)^(1/3) - (4535/71442 + root(7339451281/3087580356,
> 2))^(1/3) - 1/63)/2 + root(((root(7339451281/3087580356,
> 2) - 4535/71442)^(1/3) - (4535/71442 + root(7339451281/3087580356,
> 2))^(1/3) - 1/63)^2/4 + 1, 2)) - (((1/63 -
> ((root(7339451281/3087580356,
> 2) - 4535/71442)^(1/3) - (4535/71442 + root(7339451281/3087580356,
> 2))^(1/3)))/21 - -2/21)/(4 * root(((root(7339451281/3087580356,
> 2) - 4535/71442)^(1/3) - (4535/71442 + root(7339451281/3087580356,
> 2))^(1/3) - 1/63)^2/4 + 1, 2)) - 1/42)^2, 2)/2),...more
>
>
>
>
> Engin Yılmaz <ispanyolcom using gmail.com>, 20 Kas 2018 Sal, 12:53 tarihinde şunu
> yazdı:
>
>> Thanks a lot!
>>
>> Berend Hasselman <bhh using xs4all.nl>, 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 <ispanyolcom using gmail.com> 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 (or directly solver)?
>>>>
>>>> *Since(R)ely*
>>>> Engin YILMAZ
>>>>
>>>> [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>
>> --
>> *Saygılarımla*
>> Engin YILMAZ
>>
>
>
--
Eik Vettorazzi
Universitätsklinikum Hamburg-Eppendorf
Institut für Medizinische Biometrie und Epidemiologie
Martinistraße 52
Gebäude W 34
20246 Hamburg
Telefon: +49 (0) 40 7410 - 58243
Fax: +49 (0) 40 7410 - 57790
Web: www.uke.de/imbe
--
_____________________________________________________________________
Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; Gerichtsstand: Hamburg | www.uke.de
Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr. Dr. Uwe Koch-Gromus, Joachim Prölß, Marya Verdel
_____________________________________________________________________
SAVE PAPER - THINK BEFORE PRINTING
More information about the R-help
mailing list