Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: equations-solution


From   "Andreas Aschbacher" <[email protected]>
To   [email protected]
Subject   st: equations-solution
Date   Tue, 30 Mar 2004 10:16:12 +0200 (MEST)

dear fellows !

maybe the following /I am sure that it is/ is useful for someone :
for version 8
I do:
  clear
  set obs 3
  input y
  1. 1
  2. 0
  3. 0
then I type do faq:

. capture program drop nlfaq

. program nlfaq
  1.    if "`1'" == "?" {
  2.       global S_1 " A B C"
  3.       global A=1
  4.       global B=1
  5.       global C=1
  6.       exit
  7.    }
  8.    tempvar yh  
  9.    gen `yh'= exp($A) + $B * $C + cos($B)+ tan($B) - 2 in 1
 10.    replace `yh'= $A/$B +$C^2-log($B) in 2
 11.    replace `yh'= $A/($A+$B+$C)- sin($C) in 3
 12.    replace `1' = `yh'
 13.    
. end

. nl faq y
(obs = 3)

Iteration 0:  residual SS =  12.18801
Iteration 1:  residual SS =  .5363988
Iteration 2:  residual SS =  .0919842
Iteration 3:  residual SS =  .0185061
Iteration 4:  residual SS =   .016263
Iteration 5:  residual SS =  .0000506
Iteration 6:  residual SS =  7.04e-06
Iteration 7:  residual SS =  3.92e-06
Iteration 8:  residual SS =  3.07e-06
Iteration 9:  residual SS =  3.84e-10
Iteration 10:  residual SS =  2.26e-10
Iteration 11:  residual SS =  3.20e-14

      Source |       SS       df       MS            Number of obs =        
3
-------------+------------------------------         F(  3,     0) =        
.
       Model |           1     3  .333333333         Prob > F      =        
.
    Residual |  1.4211e-14     0           .         R-squared     =   
1.0000
-------------+------------------------------         Adj R-squared =        
.
       Total |           1     3  .333333333         Root MSE      =        
.
                                                     Res. dev.     =
-90.43652
(faq)
------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf.
Interval]
-------------+----------------------------------------------------------------
           A |  -.0212359          .        .       .            .          
.
           B |    .978015          .        .       .            .          
.
           C |  -.0227374          .        .       .            .          
.
------------------------------------------------------------------------------
 (SEs, P values, CIs, and correlations are asymptotic approximations)

. di $A/$B +$C^2,log($B)
-.02223023 -.02223023

. di $A/($A+$B+$C),sin($C)
-.02273546 -.02273546

. di "                " exp($A) + $B*$C,3-cos($B)-tan($B)
                .95675048 .95675034

as a solution of :
   A/B + C^2 = log(B)
   A/(A+B +C) = sin(C)
  exp(A) + B*C = 3 - cos(B) -tan(B)

andreas aschbacher

-- 
+++ NEU bei GMX und erstmalig in Deutschland: T�V-gepr�fter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index