Re: [R] Roots of quadratic system.
Hi, I used polyroot() and it works fine. Sebastian On Monday 02 May 2005 02:51, John Janmaat wrote: > Hello Bill, > > I have used the optimization approach you suggest in past. I was hoping > that someone had written something specifically for solving a system of > nonlinear equations, as the fsolve function does in MatLab. The Octave > version is somewhat limited compared to the MatLab version, and I like > working in R. > > Thanks, > > John. > > ps: I would like the system to have a unique solution, but there is > nothing about the system that precludes multiple equilibria. Of course, > the L(x) = ... approach can search for multiple equilibria if I try > enough different starting points. > > [EMAIL PROTECTED] wrote: > > Are you looking for a unique solution or families of solutions? > > > > Can't you turn a root-finding problem for a system of equations > > with a unique solution into an optimisation problem, anyway? > > > > E.g. You want to solve > > > > f1(x) = g1 > > f2(x) = g2 > > ... > > > > Why not optimise L(x) = (f1(x) - g1)^2 + (f2(x) - g2)^2 + ... > > with respect to x? If the minimum value is zero, then you are > > done; if it is greater than zero your original system does not > > have a solution. > > > > If you are in the complex domain the changes needed are obvious. > > > > V. > > > > : -Original Message----- > > : From: [EMAIL PROTECTED] > > : [mailto:[EMAIL PROTECTED] On Behalf Of John Janmaat > > : Sent: Monday, 2 May 2005 12:48 AM > > : To: r-help@stat.math.ethz.ch > > : Subject: [R] Roots of quadratic system. > > : > > : > > : Hello, > > : > > : I have a system of quadratic equations (results of a > > : Hamiltonian optimization) > > : which I need to find the roots for. Is there a package > > : and/or function which > > : will find the roots for a quadratic system? Note that I am > > : not opimizing, but > > : rather solving the first order conditions which come from a > > : Hamiltonian. I am > > : basically looking for something in R that will do the same > > : thing as fsolve in > > : Matlab. > > : > > : Thanks, > > : > > : John. > > : > > : == > > : Dr. John Janmaat > > : Department of Economics > > : Acadia University > > : Tel: 902-585-1461 > > : > > : __ > > : R-help@stat.math.ethz.ch mailing list > > : https://stat.ethz.ch/mailman/listinfo/r-help > > : PLEASE do read the posting guide! > > : http://www.R-project.org/posting-guide.html -- Sebastian Leuzinger Institute of Botany, University of Basel Schönbeinstr. 6 CH-4056 Basel ph0041 (0) 61 2673511 fax 0041 (0) 61 2673504 email [EMAIL PROTECTED] web http://pages.unibas.ch/botschoen/leuzinger __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Roots of quadratic system.
Hello Bill, I have used the optimization approach you suggest in past. I was hoping that someone had written something specifically for solving a system of nonlinear equations, as the fsolve function does in MatLab. The Octave version is somewhat limited compared to the MatLab version, and I like working in R. Thanks, John. ps: I would like the system to have a unique solution, but there is nothing about the system that precludes multiple equilibria. Of course, the L(x) = ... approach can search for multiple equilibria if I try enough different starting points. [EMAIL PROTECTED] wrote: Are you looking for a unique solution or families of solutions? Can't you turn a root-finding problem for a system of equations with a unique solution into an optimisation problem, anyway? E.g. You want to solve f1(x) = g1 f2(x) = g2 ... Why not optimise L(x) = (f1(x) - g1)^2 + (f2(x) - g2)^2 + ... with respect to x? If the minimum value is zero, then you are done; if it is greater than zero your original system does not have a solution. If you are in the complex domain the changes needed are obvious. V. : -Original Message- : From: [EMAIL PROTECTED] : [mailto:[EMAIL PROTECTED] On Behalf Of John Janmaat : Sent: Monday, 2 May 2005 12:48 AM : To: r-help@stat.math.ethz.ch : Subject: [R] Roots of quadratic system. : : : Hello, : : I have a system of quadratic equations (results of a : Hamiltonian optimization) : which I need to find the roots for. Is there a package : and/or function which : will find the roots for a quadratic system? Note that I am : not opimizing, but : rather solving the first order conditions which come from a : Hamiltonian. I am : basically looking for something in R that will do the same : thing as fsolve in : Matlab. : : Thanks, : : John. : : == : Dr. John Janmaat : Department of Economics : Acadia University : Tel: 902-585-1461 : : __ : R-help@stat.math.ethz.ch mailing list : https://stat.ethz.ch/mailman/listinfo/r-help : PLEASE do read the posting guide! : http://www.R-project.org/posting-guide.html : -- == Dr. John Janmaat Department of Economics Acadia University Wolfville, Nova Scotia, Canada. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Roots of quadratic system.
Kjetil Brinchmann Halvorsen wrote: John Janmaat wrote: Hello, I have a system of quadratic equations (results of a Hamiltonian optimization) which I need to find the roots for. Is there a package and/or function which will find the roots for a quadratic system? Certainly you cxould use solve, see ?solve Alternatively you could go for a computer algebra system with an implemantation of groebner basis, and use an symbolic method. I have looked into using solve. However, solve works on a system of linear equations (at least that is how I read it). I have a system of quadratic equations. They can be written to equate to zero, so that a non-linear system solver should do the trick. John. Kjetil Note that I am not opimizing, but rather solving the first order conditions which come from a Hamiltonian. I am basically looking for something in R that will do the same thing as fsolve in Matlab. Thanks, John. == Dr. John Janmaat Department of Economics Acadia University Tel: 902-585-1461 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- == Dr. John Janmaat Department of Economics Acadia University Wolfville, Nova Scotia, Canada. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Roots of quadratic system.
Are you looking for a unique solution or families of solutions? Can't you turn a root-finding problem for a system of equations with a unique solution into an optimisation problem, anyway? E.g. You want to solve f1(x) = g1 f2(x) = g2 ... Why not optimise L(x) = (f1(x) - g1)^2 + (f2(x) - g2)^2 + ... with respect to x? If the minimum value is zero, then you are done; if it is greater than zero your original system does not have a solution. If you are in the complex domain the changes needed are obvious. V. : -Original Message- : From: [EMAIL PROTECTED] : [mailto:[EMAIL PROTECTED] On Behalf Of John Janmaat : Sent: Monday, 2 May 2005 12:48 AM : To: r-help@stat.math.ethz.ch : Subject: [R] Roots of quadratic system. : : : Hello, : : I have a system of quadratic equations (results of a : Hamiltonian optimization) : which I need to find the roots for. Is there a package : and/or function which : will find the roots for a quadratic system? Note that I am : not opimizing, but : rather solving the first order conditions which come from a : Hamiltonian. I am : basically looking for something in R that will do the same : thing as fsolve in : Matlab. : : Thanks, : : John. : : == : Dr. John Janmaat : Department of Economics : Acadia University : Tel: 902-585-1461 : : __ : R-help@stat.math.ethz.ch mailing list : https://stat.ethz.ch/mailman/listinfo/r-help : PLEASE do read the posting guide! : http://www.R-project.org/posting-guide.html : __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Roots of quadratic system.
John Janmaat wrote: Hello, I have a system of quadratic equations (results of a Hamiltonian optimization) which I need to find the roots for. Is there a package and/or function which will find the roots for a quadratic system? Certainly you cxould use solve, see ?solve Alternatively you could go for a computer algebra system with an implemantation of groebner basis, and use an symbolic method. Kjetil Note that I am not opimizing, but rather solving the first order conditions which come from a Hamiltonian. I am basically looking for something in R that will do the same thing as fsolve in Matlab. Thanks, John. == Dr. John Janmaat Department of Economics Acadia University Tel: 902-585-1461 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra -- No virus found in this outgoing message. Checked by AVG Anti-Virus. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Roots of quadratic system.
Hello, I have a system of quadratic equations (results of a Hamiltonian optimization) which I need to find the roots for. Is there a package and/or function which will find the roots for a quadratic system? Note that I am not opimizing, but rather solving the first order conditions which come from a Hamiltonian. I am basically looking for something in R that will do the same thing as fsolve in Matlab. Thanks, John. == Dr. John Janmaat Department of Economics Acadia University Tel: 902-585-1461 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html