Computation of Taylor Maps and Applications to Accelerator Physics

16
Computation of Taylor Maps and Computation of Taylor Maps and Applications to Accelerator Applications to Accelerator Physics Physics ctures with emphasis on examples and their computer implement Etienne Forest Soken Dai December 2004/January 2005

description

Computation of Taylor Maps and Applications to Accelerator Physics. Six lectures with emphasis on examples and their computer implementations Etienne Forest Soken Dai December 2004/January 2005. A TPSA Package. Computes approximate Taylor maps. Makes Taylor Code look ordinary. - PowerPoint PPT Presentation

Transcript of Computation of Taylor Maps and Applications to Accelerator Physics

Page 1: Computation of Taylor Maps and Applications to Accelerator Physics

Computation of Taylor Maps and Computation of Taylor Maps and Applications to Accelerator PhysicsApplications to Accelerator Physics

Six lectures with emphasis on examples and their computer implementations

Etienne ForestSoken Dai

December 2004/January 2005

Page 2: Computation of Taylor Maps and Applications to Accelerator Physics

► What is the original “DA” package? What is the original “DA” package? ► What does it do? Why is it useful?What does it do? Why is it useful?► What is “Operator Overloading”?What is “Operator Overloading”?► Taylor Polymorphism?Taylor Polymorphism?► ““Lie/Differential Algebra”? Lie/Differential Algebra”? ► Normal Forms? Normal Forms? ► What is a integrator based code?What is a integrator based code?► What is a matrix based code i.e. Cosy-Infinity?What is a matrix based code i.e. Cosy-Infinity?► What is the difference between polymorphism in a compile form What is the difference between polymorphism in a compile form

(my stuff) and interpreted code (Cosy language)?(my stuff) and interpreted code (Cosy language)?► And all these things, can I use in my own code?And all these things, can I use in my own code?

These are the questions which we will answer in the 6 lectures using examples as much as possible rather than theory!

A TPSA Package

Computes approximate Taylor maps

Makes Taylor Code look ordinary

Delays choice between Taylor and Real at execution time

Vector fields of the theory: allow perturbation theory

Various Canonical (i.e. special) forms of the map useful in periodic systems

Page 3: Computation of Taylor Maps and Applications to Accelerator Physics

Demystifying AD-DADemystifying AD-DA

Lecture 1Lecture 1Automatic Differentiation (AD) is based on a Truncated Automatic Differentiation (AD) is based on a Truncated

Power Series Algebra (TPSA) Power Series Algebra (TPSA) not on a Differential Algebra not on a Differential Algebra (DA)(DA)

DA which involves useful vector fields will be discussed in DA which involves useful vector fields will be discussed in future lectures. future lectures.

Page 4: Computation of Taylor Maps and Applications to Accelerator Physics

The Basic Questions of the first lecture:

These questions are not hard unless couched in the abstract mathematical lingo Berz loves.

• What is the original TPSA (i.e. DA) package?

• What does it do? Why is it useful?• What is “Operator Overloading”?

Page 5: Computation of Taylor Maps and Applications to Accelerator Physics

How do we cut through the nonsense?How do we cut through the nonsense?

1. Simple: we write a small fully functional toy TPSA package for this class!2. Only 400 lines of code including the blanks!3. Fully overloaded and fully automatic4. Restricted to 2 variables and third order

Of course, it is not Berz package and there are a lot of issues about overloading Berz’s package that can be neglected in the small example.

The purpose here is to demystify these techniques and not to bother you with ultimately nearly irrelevant technicalities.

Page 6: Computation of Taylor Maps and Applications to Accelerator Physics

Look at TPSA through our toy TPSA Look at TPSA through our toy TPSA PackagePackage

► A basic TPSA-package is a tool to expand A basic TPSA-package is a tool to expand what you what you computecompute on the computer in a Taylor Series in the on the computer in a Taylor Series in the variable you choosevariable you choose..

► In Optics and Accelerators, it permits the computations In Optics and Accelerators, it permits the computations of maps for of maps for perturbative calculationsperturbative calculations and also and also sometimes simulations. sometimes simulations.

► Operator Overloading brings us closer to Operator Overloading brings us closer to Automatic Automatic DifferentiationDifferentiation rather than rather than Computational Computational DifferentiationDifferentiation: the code that computes the Taylor : the code that computes the Taylor expansion is expansion is almost identicalalmost identical to the code that to the code that computed the original quantity.computed the original quantity.

Perturbative calculationsPerturbative calculations : : Transfer Matrix, Lattice functions (Twiss), tunes, damTransfer Matrix, Lattice functions (Twiss), tunes, damping, amplitude dependent tune shifts, aberrations in optical systems, resonance ping, amplitude dependent tune shifts, aberrations in optical systems, resonance driving terms, synchrotron integrals, etc…driving terms, synchrotron integrals, etc…It is here that differential operators anIt is here that differential operators and hence Lie/Differential algebras (DA) will come into play.d hence Lie/Differential algebras (DA) will come into play.

Etienne Forest
Page 7: Computation of Taylor Maps and Applications to Accelerator Physics

Before we start, why do we want Taylor series?

Or perhaps accelerator physics?

卍 Download Toy TPSA and Gun/FODO cell application main program here!

H=1/2 py2 + gy

K=-pz=- v02-py

2-2gyg=10 m/s2 ; v0=800 m/s ; L=60 m .

Page 8: Computation of Taylor Maps and Applications to Accelerator Physics

K = - pz = - 1 -px2 + k Q

x2

2

One dimensional Quadrupole FODO Cells

Example 2: 10 FODO CellsExample 2: 10 FODO Cells

Page 9: Computation of Taylor Maps and Applications to Accelerator Physics

T1=a0+a1x1+a2x2+a3x12+a4x2

2+a5x1x2a0,a1,a2,a3,a4,a5

T2=b 0+b 1x1+b 2x2+b 3x12+b 4x2

2+b 5x1x2b 0,b 1,b 2,b 3,b 4,b 5

T3=T1±T2= a0±b 0,a1±b 1,a2±b 2,a3±b 3,a4±b 4,a5±b 5

=2 a0±b 0,a1±b 1,a2±b 2,a3±b 3,a4±b 4,a5±b 5

TPSA-Addition/SubtractionTPSA-Addition/Subtraction

Page 10: Computation of Taylor Maps and Applications to Accelerator Physics

MultiplicationMultiplication

T1=a0+a1x1+a2x2+a3x12+a4x2

2+a5x1x2a0,a1,a2,a3,a4,a5

T2=b 0+b 1x1+b 2x2+b 3x12+b 4x2

2+b 5x1x2b 0,b 1,b 2,b 3,b 4,b 5

T3=T1*T2= a0b 0,a0b 1+a1b 0,a0b 2+a2b 0,a0b 3+a3b 0+a1b 1,a0b 4+a4b 0+a2b 2,a0b 5+a5b 0+a1b 2+a2b 1 +O( x 3)

=2 a0b 0 , a0b 1+a1b 0 , a0b 2+a2b 0 , a0b 3+a3b 0+a1b 1 , a0b 4+a4b 0+a2b 2 , a0b 5+a5b 0+a1b 2+a2b 1

Page 11: Computation of Taylor Maps and Applications to Accelerator Physics

Inverse : Inverse : NilpotencyNilpotency comes in comes in

T1=a0+a1x1+a2x2+a3x12+a4x2

2+a5x1x2a0,a1,a2,a3,a4,a5

T2=1/T1=1

a0+a1x1+a2x2+a3x12+a4x2

2+a5x1x2

= 1/a0

1+ a1/a0 x1+ a2/a0 x2+ a3/a0 x12+ a4/a0 x2

2+ a5/a0 x1x2

T

=2 1/a0 1-T+T2

Page 12: Computation of Taylor Maps and Applications to Accelerator Physics

Functions: ExponentialFunctions: Exponential

T1=a0+a1x1+a2x2+a3x12+a4x2

2+a5x1x2a0,a1,a2,a3,a4,a5

T2=exp T1 =exp a0+a1x1+a2x2+a3x12+a4x2

2+a5x1x2

=exp a0 exp a1x1+a2x2+a3x12+a4x2

2+a5x1x2

T

=2 exp a0 1+T+T2/2

Again one isolates the constant part to create a nilpotent T

Page 13: Computation of Taylor Maps and Applications to Accelerator Physics

Ignore Nilpotency? Sometimes OKIgnore Nilpotency? Sometimes OK

T1=a0+a1x1+a2x2+a3x12+a4x2

2+a5x1x2a0,a1,a2,a3,a4,a5

T2=exp T1 =exp a0+a1x1+a2x2+a3x12+a4x2

2+a5x1x2

limN

Tnn = 0

N

/n! =2 exp a0 1+T+T2/2

This is used in COSY-Infinity techniques where T is a vector field acting a polynomial. For this reason, please reflect carefully why this series works! It is implemented as TPSA_EXP in the toy TPSA and N=n_tpsa_exp.

Page 14: Computation of Taylor Maps and Applications to Accelerator Physics

ConclusionConclusion►We implemented a Truncated Series Algebra

on the Computer. The original “DA” package of Berz is only that.

►For the mathematically oriented people, this TPS Algebra is simply a ring ( 環 ).

►The concept of Differential Algebra does not enter in TPSA. It is of no relevance at this stage.

Page 15: Computation of Taylor Maps and Applications to Accelerator Physics

► Perturbation theory will be discussed from a very geometrical point of viePerturbation theory will be discussed from a very geometrical point of view: invariants, Twiss functions and nonlinear distortions.w: invariants, Twiss functions and nonlinear distortions.

► The geometrical picture will be translated into an operation derived from The geometrical picture will be translated into an operation derived from the Taylor map.the Taylor map.

► My own FPP library will used. In these lectures I will emphasize the “cannMy own FPP library will used. In these lectures I will emphasize the “canned library” aspect of FPP. We will not go into the mathematical details bued library” aspect of FPP. We will not go into the mathematical details but just assume that the library does what it advertises.t just assume that the library does what it advertises.

► We will see that FPP manipulates Vector Fields associated to the Taylor We will see that FPP manipulates Vector Fields associated to the Taylor map. These Vector Fields form a differential Lie algebra. But that is not tmap. These Vector Fields form a differential Lie algebra. But that is not too important: focus on the geometrical aspect please.oo important: focus on the geometrical aspect please.

► Lecture number 2 will start with some very traditional computations and Lecture number 2 will start with some very traditional computations and will end with an introduction to the Geometrical Point of View.will end with an introduction to the Geometrical Point of View.

► 注意 注意  Other mathematical objects in Berz’s lectures, such as Levi-CivitOther mathematical objects in Berz’s lectures, such as Levi-Civita fields (a fields ( 体体 ), non Archimedean fields, are interesting (but so is ancient ), non Archimedean fields, are interesting (but so is ancient Greek and classical Chinese), but really of virtually no relevance to our wGreek and classical Chinese), but really of virtually no relevance to our work. ork. Do not get distracted.Do not get distracted.

Future LecturesFuture Lectures

Page 16: Computation of Taylor Maps and Applications to Accelerator Physics

ProblemProblemThe function ArcSin(x) or asin(x) cannot be easily separated into a constant part and a nilpotent part.

Can you find an algorithm to evaluate asin(x) when x is a polynomial? Program this algorithm using the Toy TPSA routines.

Your algorithm should not be explicitly limited to cubic polynomials.