# st: RE: sum in nonlinear equations

 From "Nick Cox" <[email protected]> To <[email protected]> Subject st: RE: sum in nonlinear equations Date Tue, 30 Mar 2004 09:51:59 +0100

```Use -summarize, neanonly- before this and pick up -r(sum)-.

Nick
[email protected]

> -----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/
```