Lecture 2 How do we approach Perturbation theory with a Tracking Code equipped with a TPSA package?...

23
Lecture 2 How do we approach How do we approach Perturbation theory with Perturbation theory with a a Tracking Code Tracking Code equipped equipped with a TPSA package with a TPSA package ? ? a. Description of our goals b. Concept of a Hierarchical theory and its advantages c. Normal Form of an Accelerator d. Computation of Approximate Invariants: Lattice Functions e. Computation of Moments: Lattice Functions again f. Tracking the Canonical Transformation A g. Phase Advance: Map in the Normal Variables

Transcript of Lecture 2 How do we approach Perturbation theory with a Tracking Code equipped with a TPSA package?...

Lecture 2How do we approach Perturbation How do we approach Perturbation

theory with a theory with a Tracking CodeTracking Code equipped with a TPSA packageequipped with a TPSA package??

a. Description of our goals b. Concept of a Hierarchical theory and its advantagesc. Normal Form of an Acceleratord. Computation of Approximate Invariants: Lattice Functionse. Computation of Moments: Lattice Functions againf. Tracking the Canonical Transformation Ag. Phase Advance: Map in the Normal Variables

Question

• What was the quintessential ( 典型的な{てんけいてき ) message of Lecture 1?

Exercise Of Lectures 1

1. Use Complex Taylor series!

2. Use the anti-derivative

3. Use an inverse DAMAP

4. Use an inverse DAMAP and compute it with a vector field!

What is our goal?What is our goal?

• We want to be able to compute all the objeWe want to be able to compute all the objects which normally enter into the analysis octs which normally enter into the analysis of a repetitive (periodic) systemf a repetitive (periodic) system

• For example: Twiss functions, linear and nFor example: Twiss functions, linear and nonlinear resonance driving terms, tunes, etonlinear resonance driving terms, tunes, etc…c…

• We want a theory which relies on the We want a theory which relies on the objects computed by the tracking codeobjects computed by the tracking code

• So, what can we compute? Remember 1So, what can we compute? Remember 1stst l lecture?ecture?

only

So what is a Tracking Code?So what is a Tracking Code?

• A tracking code by definition is an algorithm to compute the ray, floating points numbers, for example, x,x’,y,y’,t,E.

• We have seen in Lecture 1, that the introduction of an overloaded TPSA package allows the extension of algorithm from floating to Truncated Power Series.

• So we write our own toy Tracking code for this lecture!

Therefore, we decree (Therefore, we decree ( 命令をする命令をする ), that a ), that a tracking tracking codecode is an algorithm to compute is an algorithm to compute rays and Taylor serirays and Taylor series expansions of that rayes expansions of that ray in variables chosen by the in variables chosen by the user/programmer.user/programmer.

Goal: to understand the output of a Tracking Code

• We will look at a system which is stable around some closed orbit.

• A system which is Hamiltonian (canonical)

• At first, we use a system in one degree of freedom, i.e. phase space is (x,p), in our example code.

• Time for our weekly lesson of English: Canonical

English Lesson!

Canonical   : 教会法上に従った ( したがった)Canon Law: 教会法律Canonical   theory :  正準理論Dogma: 教会の教義 Hierarchical Abstraction: 階層抽象化{かいそう ちゅうしょうか}

My lectures will be canonical in the Church sense as well!My lectures will be canonical in the Church sense as well!

I will describe a I will describe a hierarchical approachhierarchical approach. Hierarchical methods are well suited . Hierarchical methods are well suited for computer implementations because modern computers are highly hierarchfor computer implementations because modern computers are highly hierarchical in structure.ical in structure.

In addition, in a hierarchical system full understanding is not necessary. One In addition, in a hierarchical system full understanding is not necessary. One can stop at anywhere in the hierarchy without comprising the whole structure. can stop at anywhere in the hierarchy without comprising the whole structure. For example, one may know how to use Microsoft Word without knowledge of For example, one may know how to use Microsoft Word without knowledge of programming or computer architecture!programming or computer architecture!

Religious or Canonical Hierarchical Structure

Dogma

Derived Laws

Derived Mathematical Properties of the Laws

Mathematical Tools Derived from the Laws

Computer Implementations

Newton’s Laws: not subject to discussion at all!

Least Action, Lagrangian, Hamiltonian

Symplectic, determinant=1, Liouville, Invariants, etc..

Generating Functions, Lie Transformations, Canonical Transformations, etc…

Canonical Integrators, TPSA, DA, TPSA vector Fields, TPSA Poisson Brackets, etc…

User Manual Read code manual, if do not understand, it is OK! Just run the code!

Level 0

Level 1

Level 2

Level 3

Level 4

Level 5

My own library (FPP) is HierarchicalStructure of FPP

tp s a lie_ an aly s is . f 9 0

n ew lie lib . f 9 0L ie lib . f 9 0

tp s a lie .9 0

T p s a . f 9 0

d ef in it io n . f 9 0

d ab n ew . f 9 0

n ew d a . f 9 0Ber z 's T P S A P ac k ag e :p o ly n o m ia ls a r e r ep r es en tedb y in teg er p o in te r s .

N ew T P S A P ac k ag e

An aly s is R o u tin es

Bo th T P S A T ay lo r s e r ies a r e m er g ed h er e .A n ew ty p e c a lled tay lo r c o m b in es tay lo r lo wan d th e in teg er p o in te r o f Ber z 's T P S A. T h eco m ple x ta y lo r ty p e an d th e po ly m o rph icty pe s a r e a ls o d ef in ed th er e .

de f in e _ n e wda . f 9 0D ef in es a n ewty p e c a lled tay lo r lo w

Bas ic O p er a tio n s o f th e T P S A p ac k ag es in v o lv in g T ay lo r s e r ies a r e o v er lo ad ed h er e ,f o r ex am p le + , - , / , e tc . . . a s w ell a s o th er th in g s s u c has d er iv a t iv es . Her e w e r ea lly o v er lo ad d ab . f an dn ew d a . f 9 0

Her e o p er a tio n s o n m ap s a r e o v er lo ad ed . A n ew ty p ed am ap is in tr o d u c ed ( as w ell as o th er u s ef u l ty p es ) .M ap o p er a tio n s a r e o v er lo ad ed , f o r ex am p le ,c o n c a ten a tio n an d in v er s e .

F in a lly , a t th e to p , th is p ac k ag e o v er lo ad s v ar io u su s ef u l p ar am eter iza tio n s o f a m ap : D r ag t- F in n ,in v er s e D r ag t- F in n , v ec to r f ie ld s , v ec to r f ie ld sin r es o n an c e b as is , an d , o f c o u r s e , n o r m al f o r m s .

C o d e th a t o v er lo ad s th e T ay lo r p ac k ag es( in c lu d in g th a t o f Ber z) as w ell a s th ean a ly s is r o u tin es o f L ie lib

r ea l_ p o ly m o r p h . f 9 0

c o m p lex _ tay lo r .9 0Allo w s c o m p lex T P S A

Po ly m o rph ic ty pe s : C a n ch a n g e a t ru nt im e

C o m p lex _ p o ly m o r p h . f 9 0

C o m p lex ty p e is o v er lo ad ed . T h e c o m p lex ty p eis m ad e o f 2 tay lo r s : T Y P E c o m p le x t a y lo r

t y p e ( t a y lo r ) rt y p e ( t a y lo r ) iE N D T Y P E c o m p le x t a y lo r

F ile_ h an d ler

S c r a tc h _ s ize

b _ da _ a r r a y s_ a ll. f 9 0 O R b _ da _ a r r a y s_ f ix . f 9 0

a_ s c r a tc h _ s ize . f 9 0

N e w D y n a mic a l a llo c a t io n o f Be rz'sP a c ka g e

Our Starting Point

Tracking Rays using the code Producing a Taylor map, here linear, using the code equipped with TPSA.

M11 M12

M21

M22

Theory: a Level 2 Religious Result• For a stable accelerator there exists an

infinite number Canonical Transformation A such that:

Ms=As◦R◦As-1

• This result is exact for linear map and formal for nonlinear maps with irrational tunes.

• R is called the Normal Form of a stable accelerator. It represents the fact that the accelerator produces pseudo-harmonic oscillations around its orbit.

Formal = Only True in a TPSA sense around the design orbit. TPSA sense around the design orbit = DA sense.

How do we do this ?

My_map =

Type(damap) My_mapType(normalform) My_normal

My_normal = My_map

My_normal contains the normal form and the transformation As in My_normal%a_t

As-1 my_a_inv = (My_normal%a_t)**(-1)

**(-1) : Level 4 mystery

My_normal = My_map Is a Level 3 religious mystery

Code + TPSA

Code + TPSA + Analysis Library

my_a_inv =

Example Program available on WEB

Invariant εs

• Using As we can easily compute the invariant.

Obviously x2+p2=(x2+p2) ◦R

But, using the normal form Ms=As◦R◦As-1

x2+p2=(x2+p2)◦As-1◦Ms◦As

→ (x2+p2 )◦As-1◦Ms

= (x2+p2 )◦As-1

→ εs= (x2+p2 )◦As-1 is invariant of Ms

• ε= (x2+p2 )◦A-1

= {{A11-1}2 + {A21

-1}2 } x2 + { {A12-1}2 + {A22

-1}2 } p2

+ 2{ A11-1 A12

-1 + A21-1 A22

-1 } xp

Results for Linear Maps

α

γ β

Code In FPP for εs

This is the algorithm to compute the Invariant

! Here we compute the invariant in the space of circles! It is obviously a circle!

my_invariant=(1.d0.mono.1)**2+(1.d0.mono.2)**2

! Now we act with A**(-1) to compute the invariant in the normal space around the closed orbit

my_invariant=my_invariant*my_a_inv

注意 : Functions transform in an inverse manner from the rays!

my_invariant is of type TAYLOR and My_a_inv is of type DAMAP

Notice that the same results can bederived using

This comes from the Det(A)=1 or more generally the symplectic condition.

Lattice Functions as Averages of Quadratic Moments

• For example <xaxb> averaged for a single ray over many turns. Such averages can only depend on the initial conditions through the value of the invariant, and the coefficients of the invariant (i.e. () here)

<f>M limN

(1/N) f(Mn(z))n=0

N

<zazb>M = limN

(1/N) Maan Mbb

n z azbn=0

N

= limN

(1/N) A aA bRn R

n A a-1 A b

-1 z azbn=0

N

=A aA b limN

(1/N) Rn R

n n=0

N

where =A-1z

but limN

(1/N) Rn R

n n=0

N

= 0/2

<z azb>M = A a1A b1+A a2A b2 0/2

A -1=A 22 -A 12

-A 21 A 11

=A 112 +A 12

2

=A 212 +A 22

2

=- A 11A 21+A 12A 22

Tracking the Map A: Bs=M0s◦A0 (Theory)

• Suppose we have M0=A0◦R◦A0-1

• From the tracking code with TPSA, we can also get M0s , the map from position 0 to position s.

Let us obtain a map which diagonalize the one-turn map Ms at s.

• Ms=M0s◦M0◦M0s-1 → Ms=M0s◦A0◦R◦A0

-1 ◦M0s-1

• If Bs=M0s◦A0 then Ms=Bs◦R ◦Bs-1

Bs=M0s◦A0 is a fundamental result of the full nonlinear Normal form theory: the map A0 can be tracked.

!This is the algorithm to compute the lattice function

! Here we initialize the ray = Closed Orbit + A

my_y(1)=my_fix(1)+ my_normal%a_t%v(1)my_y(2)=my_fix(2)+ my_normal%a_t%v(2)my_y(3)=my_fix(3)

! Now let us do loop over lattice starting at position = pos do k = pos , pos+lattice%n-1 ! Beta function is computed here in front of magnet “k”

Beta = (my_y(1).sub.'1')**2+(my_y(1).sub.'01')**2 gamma = (my_y(2).sub.'1')**2+(my_y(2).sub.'01')**2 alpha = -((my_y(2).sub.'1')*(my_y(1).sub.'1')+(my_y(2).sub.'01')*(my_y(1).sub.'01')) call track(my_y,lattice,k,k+1) ! Bk+1 = Mk,k+1 Bk

end do

Tracking the Map A: Bs=M0s◦A0 (FPP Coding)

=A 112 +A 12

2

=A 212 +A 22

2

=- A 11A 21+A 12A 22

Phase Advance: Difference between As and Bs

• We know that a stable accelerator map M0 can be linearly exactly and nonlinearly formally put into a normal form i.e.

M0 = A0◦R◦A0-1

• Of course we can also do this at some position s: Ms = As◦R◦As

-1

• Finally we can also use the map from 0 to s and achieve the same result:

• Ms = Bs◦R◦Bs-1 where Bs=M0s◦A0

• The difference between As and Bs is a rotation called the phase advance.

Code Example: Phase Advance = Map in Normal Coordinates

Theory deduced from pictures

From above picture: M12 = A2◦R12◦A1

-1

thus A2

-1 ◦M12 ◦A1 = R12

A2-1 ◦ B2 = R12

Important Point:

As is really a function of the one-turn map at Ms and nothing else.

As = F[Ms] Usual in one degree of freedom, people follow the Courant-Snyder recipe. So As = FC-S[Ms]

Notice that F is periodic by construction: F[Ms+C] = F[Ms]

But, Bs+C=Ms ◦ Bs is not !

Code for Phase Advancemy_y(1)=my_fix(1)+ (1.d0.mono.1)my_y(2)=my_fix(2)+ (1.d0.mono.2)my_y(3)=my_fix(3) my_map1=my_map! We track one turn with our favourite codemy_a1=my_normal%a_tdphase=0.d0

k=pos4-1if(pos4==pos) k=k+lattice%n

do i=pos,k call track(my_y,lattice,i,i+1)

my_map12%v(1)=my_y(1); my_map12%v(2)=my_y(2);

my_map2=my_map12*my_map1*my_map12**(-1)

my_normal2=my_map2

my_a2=my_normal2%a_t my_r12=my_a2**(-1)*my_map12*my_a1

onelie12=my_r12 ! This is a single exponent Vector Field Representation h12=onelie12%vector ! H12 is a phasor representation

dphase=(h12%sin%v(2).k.2)/2.d0/pi +dphase

my_a1=my_a2 my_y(1)=(my_y(1).sub.'0')+(1.d0.mono.1) my_y(2)=(my_y(2).sub.'0')+(1.d0.mono.2) my_map1=my_map2enddo

M2=M12◦M1◦M12-1

As = F[Ms] A2

-1 ◦M12 ◦A1 = R12

This code contains a two “vector” field objects. It is time to describe in detail what these are and what purpose they serve.