>thanks Stephen and nick I 'll try with egen function
aa
How about something along the following lines? (untested!!)
>
> Instead of
>
> gen `yh'= exp($A) + sum(from n =1 to 34)[n*cos($B)+ (n-1)*tan($B)] -2 in
> 1
>
> try
>
> tempvar X
> egen `X' = (_n<=34)*sum( _n*cos($B) + _n-1*tan($B) )
> gen `yh'= exp($A) + `X' -2 in 1
>
> Assuming your data set has at least 34 obs in it, the idea is to use the
> egen to calculate the sum
>
> Stephen
> -------------------------------------------------------------
> Professor Stephen P. Jenkins <[email protected]>
> Institute for Social and Economic Research
> <a
href="http://www.ntsearch.com/search.php?q=University&v=55">University</a> of Essex, Colchester CO4 3SQ, U.K.
> Tel: +44 1206 873374. Fax: +44 1206 873151.
> http://www.iser.essex.ac.uk
>
>
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]] On Behalf Of
> > Andreas Aschbacher
> > Sent: 30 March 2004 09:37
> > To: [email protected]
> > Subject: st: sum in nonlinear equations
> >
> >
> > Dear fellows !
> > is there apossibility to write line *9* in Stata-code -
> > I have written it in pseudocode,please look at line 9
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > . 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) + sum(from n =1 to 34)[n*cos($B)+
> > (n-1)*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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > this would be very necessary for me because I could
> > deconvolute with Stata using modified Simpsonrule for
> > computing integrals. using LevenbergMarquardt with Stata is
> > possible in physics,convolution- computing is very easy
> > too,the way back namely deconvolution would be possible too
> > if I could compute this sum
> >
> > any help would be appreciated very much
> > andreas aschbacher,greetings to all fanatic Stata users in the world
> >
> > --
> > +++ 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/
> >
>
>
> *
> * 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/
>
--
+++ 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/