[Cfp-interest 2864] Re: CFP review of TS-4 and TS-5 revisions
Jim Thomas
jaswthomas at sbcglobal.net
Fri Aug 25 12:45:33 PDT 2023
I think this has a good amount of detail for the TS example.
- Jim Thomas
Sent from my iPhone
> On Aug 25, 2023, at 10:01 AM, David Hough CFP <pcfp at oakapple.net> wrote:
>
> There's always one more typo. This version declares den1p
>
>
>
> EXAMPLE
>
> The scaled reduction functions support computing quantities of modest
> magnitudes whose intermediate results might well overflow and underflow.
>
> One example is the computation of Clebsch-Gordan coefficients
> used to add angular momentum in quantum mechanics.
> Expressions for these quantities involve quotients of products of factorials,
> and so are prone to intermediate overflow.
>
> As a simplified illustration, consider computing n1!n2!/n3! -
>
> int n1, n2, n3 ;
>
> int i ;
> double num1, num2, den1, quot ;
>
> double num1p[n1}, num2p[n2}, den1p[n3] ;
> long long num1e, num2e, den1e ;
>
> for ( i := 2 ; i <= n1 ; i++ ) {
> num1p[i-2] = i ; }
> num1 = scaled_prod( n1-1, num1p, &num1e ) ;
>
> for ( i := 2 ; i <= n2 ; i++ ) {
> num2p[i-2] = i ; }
> num2 = scaled_prod( n2-1, num2p, &num2e ) ;
>
> for ( i := 2 ; i <= n3 ; i++ ) {
> den1p[i-2] = i ; }
> den1 = scaled_prod( n3-1, den1p, &den1e ) ;
>
> quot = scalb( num1 * num2 / den1, num1e + num2e - den1e) ;
>
> This small part of the Clebsch-Gordan/Wigner computation
> is fairly easy to understand as an example.
> The other scaled_prodsum and scaled_proddiff functions
> accommodate more complicated factors like (x[i]+y[i]) and (x[i]-y[i])
> respectively.
>
>
More information about the Cfp-interest
mailing list