Dear Jorge Ivan Velez sir,

Thanks a million for your great solution. You have made my Sunday. Thanks again.

Regards

Amy



--- On Sun, 11/28/10, Jorge Ivan Velez <jorgeivanve...@gmail.com> wrote:

From: Jorge Ivan Velez <jorgeivanve...@gmail.com>
Subject: Re: [R] Finding root of quadratic equation
To: "Amy Milano" <milano_...@yahoo.com>
Cc: "R mailing list" <r-help@r-project.org>
Date: Sunday, November 28, 2010, 8:49 AM

Hi Amy,
Not using animation, but this seems to work:


f <- function(x) 0.0016^2 - 0.001^2*x^2 - 0.002^2*(1-x)^2 - 
2*0.7*0.001*0.002*x*(1-x)

curve(f, -1, 1)abline(h = 0, lty = 2, col = 'gray')

uniroot(f, c(-1,1))abline(v = .3203, lty = 2, col = 2)


HTH,Jorge

On Sun, Nov 28, 2010 at 3:43 AM, Amy Milano <> wrote:


Dear R Helpers,



I need to find the root of following equation.



0.0016^2 = (0.001*x)^2 + (0.002 * (1-x))^2 + 2 * 0.7 *0.001*0.002 * x * (1-x).



I had tried using "animation " package as follows.







# My Code





library(animation)

ani.options(nmax = 500)





solu = newton.method(function(x) 0.0016^2 - 0.001^2*x^2 - 0.002^2*(1-x)^2 - 
2*0.7*0.001*0.002*x*(1-x), 1, c(-1,1))



solu$root





# However, I am not getting the solution. Please guide.



Amy

















        [[alternative HTML version deleted]]



______________________________________________

R-help@r-project.org mailing list

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.






      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to