The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Quantum::ClebschGordan - Calculate/list Clebsch-Gordan Coefficients

VERSION

Version 0.01

SYNOPSIS

Calculate Clebsch-Gordan coefficients.

Commandline utility:

    [davidrw@devbox davidrw]$ cg-j1j2 1 1/2

From perl:

    use Quantum::ClebschGordan;

    print Quantum::ClebschGordan->new( j1=>1, j2=>'1/2', m=>'3/2', m1=>'1', m2=>'1/2', j=>'3/2' )->coeff;

    my $foo = Quantum::ClebschGordan->new();
    ...
    printf "%6s %6s %6s %6s %6s %6s %6s, %s\n", Quantum::ClebschGordan->state_names, 'N', 'c';
    printf "%6s %6s %6s %6s %6s %6s %6s, %s\n", $_->state_nums, $_->coeff, $_->coeff_value
      for Quantum::ClebschGordan->new( j1 => 1, j2 => '1/2' )->explode;

INTRODUCTION

Some references:

Calculation of the coefficients: http://string.howard.edu/~tristan/QM2/QM2WE.pdf

Table of the coefficients: http://pdg.lbl.gov/2002/clebrpp.pdf

Wiki Page: http://en.wikipedia.org/wiki/Clebsch-Gordan_coefficients

Another table of the coefficients (warning--may be inaccurate): http://en.wikipedia.org/wiki/Table_of_Clebsch-Gordan_coefficients

Wigner 3-j Symbol calculation:

http://wwwasdoc.web.cern.ch/wwwasdoc/shortwrupsdir/u111/top.html

http://bbs.sachina.pku.edu.cn/Stat/Math_World/math/w/w120.htm

METHODS

new

Constructor -- can take named arguments of j1, j2, m, m1, m2, j

coeff

Returns the Clebsch-Gordan coefficient for the object's (j1,j2,m,m1,m2,j) values. undef unless all the values are set. NOTE: THIS IS NOT THE ACTUAL VALUE. It is in the notation +-N where N is non-negative integer or fraction, and the real value is +-sqrt(abs(N)). To get this directly, use the coeff_value method.

coeff_value

Returns the actual Clebsch-Gordan coefficient (as a real decimal number) for the object's (j1,j2,m,m1,m2,j) values. undef unless all the values are set. For an abbreviated notation, use the coeff method.

wigner3j

Returns the actual Wigner 3-j symbol for the object's (j1,j2,m,m1,m2,j) values. undef unless all the values are set. This is in the same notation as the coeff method.

wigner3j_value

Returns the actual Wigner 3-j symbol (as a real decimal number) for the object's (j1,j2,m,m1,m2,j) values. undef unless all the values are set. For an abbreviated notation, use the wigner3j method.

explode

Use this method if you only have some of the (j1,j2,m,m1,m2,j) values;

Returns a list of Quantum::ClebschGordan objects based on the given (j1,j2,m,m1,m2,j) values for the current object. If any of those values are unset, then there will be an object in the list for each of the possible combinations, given the rules governing m and j values. Each of the returned Quantum::ClebschGordan objects will have all of the (j1,j2,m,m1,m2,j) values set, and thus the coeff, coeff_value, wigner3j, and wigner3j_value will all have values.

state_names

Returns the list of names of the state variables -- based on a constant and will return ('j1', 'j2', 'm', 'm1', 'm2', 'j').

state_nums

Returns the list of the (j1,j2,m,m1,m2,j) values as Number::Fraction objects.

state_values

Returns the list of the (j1,j2,m,m1,m2,j) values as real decimal values.

PRIVATE METHODS

set

Overload of Class::Accessor's set() method. Same functionality, plus the following if setting on of the 'state' variables:

  • Attempts to converts the value into a Number::Fraction object. This allows for values such as '1/2' to be used.

  • Performs validation (via __check_state()) that this new value is consistent w/the other state values.

  • Attempts to auto-calculate the coefficient (only succeeds if all vars are set; otherwise coeff is cleared).

__set_coeff

Attempts to calculate the Clebsch-Gordan coffectient for the object and sets the __coeff attribute (which is what the coeff and coeff_value methods are based upon).

__check_state

Audits the (j1,j2,m,m1,m2,j) values to make sure that they are valid and consistent with each other. Returns undef (and throws a warning) if there is an error. Returns 1 if all values are set and valid. Returns -1 if only some of the values are set, but the ones that are set are valid.

FUNCTIONS

__seq

Quick & dirty helper function that's bascially like the unix 'seq' command.

factorial

Returns n! for a given integer n. Uses Memoize for caching.

notation2real

Converts a value from the form returned by coeff to a real number.

real2notation

Attempts to convert a real number in the form returned by coeff.

AUTHOR

David Westbrook, <dwestbrook at gmail.com>

PREREQUISITES

Quantum::ClebschGordan requires the following modules:

Number::Fraction

Memoize

Class::Accessor

Carp

BUGS

Please report any bugs or feature requests to bug-quantum-clebschgordan at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Quantum-ClebschGordan. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

I'm also available by email or via '/msg davidrw' on <http://perlmonks.org>.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Quantum::ClebschGordan

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2006 David Westbrook, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.