Eikonal Blog

2010.02.15

Magnus’ Bracket Operator

Filed under: mathematics — Tags: — sandokan65 @ 22:46

Definition: Define z(x,y) via product of exponentials e^z :\equiv e^x e^y.

Properties:

  • z = x+y+\frac12 [x,y] + \frac1{12} (\{xy^2\} + \{yx^2\}) + \frac1{24}\{xy^2x\} + \cdots
  • e^{-y} e^x e^y = e^{x+\frac1{1!}[x,y] + \frac1{24}\{xy^2\}+\cdots} = e^{\{x e^y\}_M}

Definition: Here “the bracket operator” \{\cdots\}_M is defined by following properties:

  1. \{G\}_M = G if G is homogeneous of the first degree,
  2. \{r G\}_M = r \{G\}_M if r is a rational number,
  3. \{G_1 + G_2\}_M = \{G_1\}_M + \{G_2\}_M,
  4. \{G x\}_M = [\{G\}_M , x], \{G y\}_M = [\{G\}_M , y]

So:

  • \{x^2 G\}_M = \{y^2 G\}_M = 0,
  • \{x y^n\}_M = x y^n - \binom{n}{1} y x y^{n-1} + \cdots + (-)^k \binom{n}{k}^k y^k x y^{n-k} + \cdots + (-)^n y^n x.
  • \{\omega_n\}_M = n \omega_n for \omega_n homogeneous in x and y of degree n, i.e. \{\omega\}_M = \left(x D_x + y D_y\right) \omega.

Source: T1272 = W. Magnus “A Connection between the Baker-Hausdorff formula and a Problem of Burnside”; Annals of Mathematics; Vol 52, No 1, July 1950.


Related here: Magnus on matrix exponentials – https://eikonal.wordpress.com/2010/01/26/magnus-on-matrix-exponentials/

Lutzky’s expansion

Filed under: mathematics — Tags: — sandokan65 @ 22:16

\frac{d e^{z}}{dt} = e^z \left\{\frac{dz}{dt},\frac{e^z-1}{z}\right\}

e^{z(t)} :\equiv e^{x}e^{t y}

  • z(t) = \sum_{l=0}^\infty z_l t^l
  • z_0 = x
  • z_1 = \left\{ y , \frac{x}{e^x-1}\right\} = y - \frac1 [y,x] + \frac1{12} \{y,x^2\} - \frac1{720} \{y,x^4\} + \cdots

Here the expansion \frac{x}{e^x-1} = \sum_{k=0}^\infty \frac{B_k}{k!} x^k was used.

Calculating z_2

Definition:

  • \frac{x e^{\xi x}}{e^x-1} = \sum_{k=0}^\infty \varphi_k(\xi) x^k
  • \frac{e^{\xi x} -1}{e^x-1} = \sum_{k=0}^\infty \Psi_k(\xi) x^k
  • \varphi_k(\xi) = \frac1{k!} \sum_{m=0}^\infty \binom{k}{m} B_m \xi^{k-m}
  • \partial_\xi \varphi_{k+1}(\xi) = \varphi_k(\xi)
  • \varphi_k(0)= \frac1{k!}B_k,
  • \varphi_k(1)= \varphi_k(0) (for k\ne 1),
  • \varphi_0(\xi) \equiv 1
  • \int_0^1 \varphi_k(\xi) d\xi = \delta_{k,0},
  • \Psi_{k}(\xi) = \varphi_{k+1}(\xi) - \varphi_{k+1}(0),
  • \int_0^1 \varphi_k(\xi) \Psi_{l}(\xi)  d\xi = \delta_{k,0}\varphi_{l+1}(0) \theta(l) + \delta_{l,0}\varphi_{k+1}(0) \theta(k),

Now:
z_2 = - \sum_{l=1}^\infty \sum_{k=0}^\infty \{y,x^l,y,x^k\} \frac{B_{l+1}B_k}{(l+1)!k!} -\frac12 \sum_{k=1}^\infty \sum_{l=1}^\infty \sum_{j=0}^\infty I_{kl} \{\Delta_{kl}, x^j\}  \frac{B_j}{j!}
where:

  • \{y,x^k,y\} :\equiv [\{y,x^k\},y],
  • \{y,x^l,y,x^k\} :\equiv \{\{y,x^l,y\},x^k\},
  • \Delta_{kl} :\equiv [\{y,x^l,\{y,x^k\}] = - \Delta_{lk},
  • I_{kl} :\equiv \int_0^1 \varphi_k(\xi) \varphi_{l+1}(\xi), (I_{l+2,l}=0)

The more compact expression is:
z_2 = -\frac12 \left\{ J, \frac{x}{e^x-1}\right\}
where
J :\equiv \int_0^1 d\xi \left[\{z_1,e^{x\xi}\}, \left\{z_1,\frac{e^{x\xi}-1}{x}\right\}\right] = \int_0^1 d\xi \left[\{y,\frac{xe^{x\xi}}{e^x-1}\}, \left\{y,\frac{e^{x\xi}-1}{e^{x}-1}\right\}\right].

The Hausdorff recursion formula:
z_n = \frac1{n} \left(\left\{y, \frac{x}{e^x-1}\right\} D_x \right) z_{n-1}.


Source: T1265 = M. Lutzky “Parameter Differentiation of Exponential Operators and the Baker-Campbell-Hausdorff Formula”; Journal of Mathematics Physics, Vol 9, N 7, July 1968.

Perl online

Hashes

Files

Chomp()

Control structures

Tidbits

Rename files

Alex Batko says (at http://www.cs.mcgill.ca/~abatko/computers/programming/perl/):

Here is a brilliant program for renaming one or more files according to a specified Perl expression. I found it on page 706 of Programming Perl (3rd edition).

#!/usr/bin/perl
$op = shift;
for( @ARGV ) {
    $was = $_;
    eval $op;
    die if $@;
    rename( $was, $_ ) unless $was eq $_;
}

In the code above, the second last line calls the built-in function “rename”, not the program itself (which is named “rename.pl”). Below are a few examples of use.

% rename.pl 's/\.htm/\.html/' *.htm         # append an 'l'
% rename.pl '$_ .= ".old"' *.html           # append '.old'
% rename.pl 'tr/A-Z/a-z/' *.HTML            # lowercase
% rename.pl 'y/A-Z/a-z/ unless /^Make/' *   # lowercase

Printing hashes

Starting with an input file with data in two columns separated by coma (,):

#/bin/perl -t

my %TempHash = ();
my $InputFile = shift;
print "Input file = ",$InputFile,"\n";

my ($line,$column1,$column2,);

#reading input file to generate hash
open (INPUTSTREAM, '<',  $InputFile) || die ("Could not open $InputFile");
while ( $line =  ) {
	chomp;
        #print $line;
	($column1, $column2) = split ',', $line;
        $TempHash{$column1}=$column2;
        #print $column1," ==> ",$TempHash{$column1};
}
close (INPUTSTREAM);

## printing hash - way #1
print "The following are in the DB: ",join(', ',values %TempHash),"\n";

## printing hash - way #2
while (($key, $value) = each %TempHash)
{
     print "$key ==> $value";
}

## printing hash - way #3
foreach $key (sort keys %TempHash){
   print "$key ==> $TempHash{$key}";
}

Removing white spaces

Sources:

# Declare the subroutines
sub trim($);
sub ltrim($);
sub rtrim($);

# Perl trim function to remove whitespace from the start and end of the string
sub trim($)
{
	my $string = shift;
	$string =~ s/^\s+//;
	$string =~ s/\s+$//;
	return $string;
}
# Left trim function to remove leading whitespace
sub ltrim($)
{
	my $string = shift;
	$string =~ s/^\s+//;
	return $string;
}
# Right trim function to remove trailing whitespace
sub rtrim($)
{
	my $string = shift;
	$string =~ s/\s+$//;
	return $string;
}

# Here is how to output the trimmed text "Hello world!"
print trim($string)."\n";
print ltrim($string)."\n";
print rtrim($string)."\n";


Related: Regular Expressions – https://eikonal.wordpress.com/2010/04/02/regular-expressions/ | Command line based text replace – https://eikonal.wordpress.com/2010/07/13/command-line-based-text-replace/

Blog at WordPress.com.