Re: [R] help about solving two equations

2010-03-13 Thread Berend Hasselman
Ravi Varadhan wrote: require(BB) fn - function(x, s){ f - rep(NA, length(x)) f[1] - digamma(x[1]) - digamma(x[1]+x[2]) - s[1] f[2] - digamma(x[2]) - digamma(x[1]+x[2]) - s[2] f } nr - 10 smat - matrix(runif(2*nr, -3, -1), nr, 2) soln - matrix(NA, nr, 2) for (i in

Re: [R] help about solving two equations

2010-03-12 Thread Ravi Varadhan
-help@r-project.org Sent: Thursday, March 11, 2010 8:02:43 PM GMT -06:00 US/Canada Central Subject: Re: [R] help about solving two equations You have to install it from CRAN before you can load it into your session. Ravi Varadhan

Re: [R] help about solving two equations

2010-03-11 Thread Berend Hasselman
Shaoqiong Zhao wrote: I am not sure if this is correct and also this can only solve one row. How to get the whole 1000 rows of p and q? You can try something like this: library(nleqslv) library(BB) fn - function(x, s){ f - rep(NA, length(x)) f[1] - digamma(x[1]) -

Re: [R] help about solving two equations

2010-03-11 Thread Ravi Varadhan
email: rvarad...@jhmi.edu - Original Message - From: Shaoqiong Zhao zh...@uwm.edu Date: Thursday, March 11, 2010 9:00 pm Subject: Re: [R] help about solving two equations To: Ravi Varadhan rvarad...@jhmi.edu Cc: r-help@r-project.org Hello Professor Ravi, I tried to load BB into R

Re: [R] help about solving two equations

2010-03-11 Thread Shaoqiong Zhao
: Ravi Varadhan rvarad...@jhmi.edu To: Shaoqiong Zhao zh...@uwm.edu Cc: r-help@r-project.org Sent: Wednesday, March 10, 2010 9:03:25 PM GMT -06:00 US/Canada Central Subject: Re: [R] help about solving two equations Here is how you can solve: fn - function(x, s){ f - rep(NA, length(x)) f[1

[R] help about solving two equations

2010-03-10 Thread Shaoqiong Zhao
I have two matrix s1 and s2, each of them is 1000*1. and I have two equations: digamma(p)-digamma(p+q)=s1, digamma(q)-digamma(p+q)=s2, and I want to sovle these two equations to get the value of x and y, which are also two 1000*1 matrices. I write a program like this: f - function(x) { p- x[1];

Re: [R] help about solving two equations

2010-03-10 Thread Ravi Varadhan
and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: Shaoqiong Zhao zh...@uwm.edu Date: Wednesday, March 10, 2010 8:19 pm Subject: [R] help about solving two equations To: r-help@r-project.org I have two matrix s1

Re: [R] help about solving two equations

2010-03-10 Thread Berend Hasselman
Shaoqiong Zhao wrote: I have two matrix s1 and s2, each of them is 1000*1. and I have two equations: digamma(p)-digamma(p+q)=s1, digamma(q)-digamma(p+q)=s2, and I want to sovle these two equations to get the value of x and y, which are also two 1000*1 matrices. Besides BB there is

Re: [R] help about solving the equations

2009-10-04 Thread Berend Hasselman
dahuang wrote: i wanna get x from the equations: Ax=x, given A is a matrix. How can i apply it in R? thanks ?solve -- View this message in context: http://www.nabble.com/help-about-solving-the-equations-tp25738073p25738401.html Sent from the R help mailing list archive at Nabble.com.

[R] help about solving the equations

2009-10-04 Thread dahuang
i wanna get x from the equations: Ax=x, given A is a matrix. How can i apply it in R? thanks -- View this message in context: http://www.nabble.com/help-about-solving-the-equations-tp25738073p25738073.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] help about solving the equations

2009-10-04 Thread Gabor Grothendieck
x is the eigenvector corresponding to eigenvalue 1. See ?eigen. On Sun, Oct 4, 2009 at 9:31 AM, dahuang tsyell...@hotmail.com wrote: i wanna get x from the equations: Ax=x, given A is a matrix. How can i apply it in R? thanks -- View this message in context:

Re: [R] help about solving the equations

2009-10-04 Thread Berend Hasselman
Gabor Grothendieck wrote: x is the eigenvector corresponding to eigenvalue 1. See ?eigen. Correct. I should have looked better. Berend -- View this message in context: http://www.nabble.com/help-about-solving-the-equations-tp25738073p25740459.html Sent from the R help mailing list