Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
dai_yunhao <dai_yunhao@smail.hust.edu.cn> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: a question about equation solution |

Date |
Tue, 30 Aug 2011 09:10:42 -0700 (PDT) |

Hi, everybody, I don't know whether the mata program could solve the equation, and I run a program like this: clear all set obs 10 g a=1 g b=2 g c=_n g x=. order x a b c mata v=J(1,1,.) st_view(v,., "x a b c") function y(x,a,b,c) { return (-c+a+b+x) } for (i=1;i<=rows(v);i++) { r=mm_root(x=.,&y(),0,1,1e-9,1000,v[i,2],v[i,3],v[i,4]) v[i,1]=x } end l,noo gen d=c-a-b and the result is: +---------------------+ | x a b c d | |---------------------| 1. | 0 1 2 1 -2 | 2. | 0 1 2 2 -1 | 3. | 0 1 2 3 0 | 4. | 1 1 2 4 1 | 5. | 1 1 2 5 2 | |---------------------| 6. | 1 1 2 6 3 | 7. | 1 1 2 7 4 | 8. | 1 1 2 8 5 | 9. | 1 1 2 9 6 | 10. | 1 1 2 10 7 | +---------------------+ Shouldn't the x be the solution of the equation x+a+b=c ,and the value of x equal to the value of d ? -- View this message in context: http://statalist.1588530.n2.nabble.com/a-question-about-equation-solution-tp6742764p6742764.html Sent from the Statalist mailing list archive at Nabble.com. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: a question about equation solution***From:*Matthew Baker <matthew.baker@hunter.cuny.edu>

- Prev by Date:
**st: regression with categorical predictors** - Next by Date:
**st: Margins after xtprobit, re.** - Previous by thread:
**st: regression with categorical predictors** - Next by thread:
**Re: st: a question about equation solution** - Index(es):