BE Beams GTPSA in a nutshell Department ๏ Generalised Truncated Power Series Algebra ➡ Multivariate Taylor polynomials of order n in ℝ & ℂ . TPSA coefficients ➡ Powerful tool for solving differential equations (e.g. motion equations). 1 variable x at order n in the neighbourhood of the point a in the domain of the function f : n f ( k ) 2! ( x − a ) 2 + … + f ( n ) ( a ) f ( x ; a ) = f ( a ) + f ′ � ( a )( x − a ) + f ′ � ′ � ( a ) ( x − a ) n = ∑ a T n k ! ( x − a ) k n ! k =0 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch convergence of the remainder (i.e. truncation error): f(x) is an analytic function, is a polynomial approximation T n n →∞ R n n →∞ f ( x ) − T n f ( x ; a ) lim f ( x ; a ) = lim f ( x ; a ) = 0 nearby a with radius of convergence h : n →∞ R n f ( a ± h ; a ) ≠ 0. min h >0 lim � 36
BE Beams GTPSA in a nutshell Department ๏ Generalised Truncated Power Series Algebra ➡ Multivariate Taylor polynomials of order n in ℝ & ℂ . TPSA coefficients ➡ Powerful tool for solving differential equations (e.g. motion equations). 1 variable x at order n in the neighbourhood of the point a in the domain of the function f : n f ( k ) 2! ( x − a ) 2 + … + f ( n ) ( a ) f ( x ; a ) = f ( a ) + f ′ � ( a )( x − a ) + f ′ � ′ � ( a ) ( x − a ) n = ∑ a T n k ! ( x − a ) k n ! k =0 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch convergence of the remainder (i.e. truncation error): f(x) is an analytic function, is a polynomial approximation T n n →∞ R n n →∞ f ( x ) − T n f ( x ; a ) lim f ( x ; a ) = lim f ( x ; a ) = 0 nearby a with radius of convergence h : n →∞ R n f ( a ± h ; a ) ≠ 0. min h >0 lim 2 variables ( x , y ) at order 2 nearby ( a , b ) : f ( x , y ; a , b ) = f ( a , b ) + ∂ f ( x − a ) + ∂ f T 2 ( y − b ) + … ∂ x ∂ y ( a , b ) ( a , b ) � 36
BE Beams GTPSA in a nutshell Department ๏ Generalised Truncated Power Series Algebra ➡ Multivariate Taylor polynomials of order n in ℝ & ℂ . TPSA coefficients ➡ Powerful tool for solving differential equations (e.g. motion equations). 1 variable x at order n in the neighbourhood of the point a in the domain of the function f : n f ( k ) 2! ( x − a ) 2 + … + f ( n ) ( a ) f ( x ; a ) = f ( a ) + f ′ � ( a )( x − a ) + f ′ � ′ � ( a ) ( x − a ) n = ∑ a T n k ! ( x − a ) k n ! k =0 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch convergence of the remainder (i.e. truncation error): f(x) is an analytic function, is a polynomial approximation T n n →∞ R n n →∞ f ( x ) − T n f ( x ; a ) lim f ( x ; a ) = lim f ( x ; a ) = 0 nearby a with radius of convergence h : n →∞ R n f ( a ± h ; a ) ≠ 0. min h >0 lim 2 variables ( x , y ) at order 2 nearby ( a , b ) : = f (1) ( a , b ) ( x − a , y − b ) f ( x , y ; a , b ) = f ( a , b ) + ∂ f ( x − a ) + ∂ f T 2 ( y − b ) + … ∂ x ∂ y ( a , b ) ( a , b ) � 36
BE Beams GTPSA in a nutshell Department ๏ Generalised Truncated Power Series Algebra ➡ Multivariate Taylor polynomials of order n in ℝ & ℂ . TPSA coefficients ➡ Powerful tool for solving differential equations (e.g. motion equations). 1 variable x at order n in the neighbourhood of the point a in the domain of the function f : n f ( k ) 2! ( x − a ) 2 + … + f ( n ) ( a ) f ( x ; a ) = f ( a ) + f ′ � ( a )( x − a ) + f ′ � ′ � ( a ) ( x − a ) n = ∑ a T n k ! ( x − a ) k n ! k =0 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch convergence of the remainder (i.e. truncation error): f(x) is an analytic function, is a polynomial approximation T n n →∞ R n n →∞ f ( x ) − T n f ( x ; a ) lim f ( x ; a ) = lim f ( x ; a ) = 0 nearby a with radius of convergence h : n →∞ R n f ( a ± h ; a ) ≠ 0. min h >0 lim 2 variables ( x , y ) at order 2 nearby ( a , b ) : = f (1) ( a , b ) ( x − a , y − b ) f ( x , y ; a , b ) = f ( a , b ) + ∂ f ( x − a ) + ∂ f T 2 ( y − b ) + … ∂ x ∂ y ( a , b ) ( a , b ) ∂ 2 f ( x − a ) 2 + 2 ∂ 2 f ( x − a )( y − b ) + ∂ 2 f + 1 ( y − b ) 2 ∂ x 2 ∂ x ∂ y ∂ y 2 2! ( a , b ) ( a , b ) ( a , b ) � 36
BE Beams GTPSA in a nutshell Department ๏ Generalised Truncated Power Series Algebra ➡ Multivariate Taylor polynomials of order n in ℝ & ℂ . TPSA coefficients ➡ Powerful tool for solving differential equations (e.g. motion equations). 1 variable x at order n in the neighbourhood of the point a in the domain of the function f : n f ( k ) 2! ( x − a ) 2 + … + f ( n ) ( a ) f ( x ; a ) = f ( a ) + f ′ � ( a )( x − a ) + f ′ � ′ � ( a ) ( x − a ) n = ∑ a T n k ! ( x − a ) k n ! k =0 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch convergence of the remainder (i.e. truncation error): f(x) is an analytic function, is a polynomial approximation T n n →∞ R n n →∞ f ( x ) − T n f ( x ; a ) lim f ( x ; a ) = lim f ( x ; a ) = 0 nearby a with radius of convergence h : n →∞ R n f ( a ± h ; a ) ≠ 0. min h >0 lim 2 variables ( x , y ) at order 2 nearby ( a , b ) : = f (1) ( a , b ) ( x − a , y − b ) f ( x , y ; a , b ) = f ( a , b ) + ∂ f ( x − a ) + ∂ f T 2 ( y − b ) + … ∂ x ∂ y ( a , b ) ( a , b ) ∂ 2 f ( x − a ) 2 + 2 ∂ 2 f ( x − a )( y − b ) + ∂ 2 f + 1 ( y − b ) 2 ∂ x 2 ∂ x ∂ y ∂ y 2 2! ( a , b ) ( a , b ) ( a , b ) = f (2) ( a , b ) ( x − a , y − b ) � 36
BE Beams GTPSA in a nutshell Department ๏ Generalised Truncated Power Series Algebra ➡ Multivariate Taylor polynomials of order n in ℝ & ℂ . TPSA coefficients ➡ Powerful tool for solving differential equations (e.g. motion equations). 1 variable x at order n in the neighbourhood of the point a in the domain of the function f : n f ( k ) 2! ( x − a ) 2 + … + f ( n ) ( a ) f ( x ; a ) = f ( a ) + f ′ � ( a )( x − a ) + f ′ � ′ � ( a ) ( x − a ) n = ∑ a T n k ! ( x − a ) k n ! k =0 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch convergence of the remainder (i.e. truncation error): f(x) is an analytic function, is a polynomial approximation T n n →∞ R n n →∞ f ( x ) − T n f ( x ; a ) lim f ( x ; a ) = lim f ( x ; a ) = 0 nearby a with radius of convergence h : n →∞ R n f ( a ± h ; a ) ≠ 0. min h >0 lim 2 variables ( x , y ) at order 2 nearby ( a , b ) : = f (1) ( a , b ) ( x − a , y − b ) f ( x , y ; a , b ) = f ( a , b ) + ∂ f ( x − a ) + ∂ f T 2 ( y − b ) + … ∂ x ∂ y homogeneous ( a , b ) ( a , b ) polynomials ∂ 2 f ( x − a ) 2 + 2 ∂ 2 f ( x − a )( y − b ) + ∂ 2 f + 1 ( y − b ) 2 ∂ x 2 ∂ x ∂ y ∂ y 2 2! ( a , b ) ( a , b ) ( a , b ) = f (2) ( a , b ) ( x − a , y − b ) � 36
BE Beams GTPSA in a nutshell Department ๏ Generalised Truncated Power Series Algebra ➡ Multivariate Taylor polynomials of order n in ℝ & ℂ . TPSA coefficients ➡ Powerful tool for solving differential equations (e.g. motion equations). 1 variable x at order n in the neighbourhood of the point a in the domain of the function f : n f ( k ) 2! ( x − a ) 2 + … + f ( n ) ( a ) f ( x ; a ) = f ( a ) + f ′ � ( a )( x − a ) + f ′ � ′ � ( a ) ( x − a ) n = ∑ a T n k ! ( x − a ) k n ! k =0 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch convergence of the remainder (i.e. truncation error): f(x) is an analytic function, is a polynomial approximation T n n →∞ R n n →∞ f ( x ) − T n f ( x ; a ) lim f ( x ; a ) = lim f ( x ; a ) = 0 nearby a with radius of convergence h : n →∞ R n f ( a ± h ; a ) ≠ 0. min h >0 lim 2 variables ( x , y ) at order 2 nearby ( a , b ) : = f (1) ( a , b ) ( x − a , y − b ) f ( x , y ; a , b ) = f ( a , b ) + ∂ f ( x − a ) + ∂ f f must not depend on the integration T 2 ( y − b ) + … path, i.e. must derive from a potential! ∂ x ∂ y homogeneous ( a , b ) ( a , b ) polynomials ∂ 2 f ( x − a ) 2 + 2 ∂ 2 f ( x − a )( y − b ) + ∂ 2 f + 1 ( y − b ) 2 ∂ x 2 ∂ x ∂ y ∂ y 2 2! ( a , b ) ( a , b ) ( a , b ) = f (2) ( a , b ) ( x − a , y − b ) � 36
⃗ ⃗ ⃗ ⃗ ⃗ BE Beams GTPSA in a nutshell Department ๏ Generalised Truncated Power Series Algebra ➡ Multivariate Taylor polynomials of order n in ℝ & ℂ . TPSA coefficients ➡ Powerful tool for solving differential equations (e.g. motion equations). 1 variable x at order n in the neighbourhood of the point a in the domain of the function f : n f ( k ) 2! ( x − a ) 2 + … + f ( n ) ( a ) f ( x ; a ) = f ( a ) + f ′ � ( a )( x − a ) + f ′ � ′ � ( a ) ( x − a ) n = ∑ a T n k ! ( x − a ) k n ! k =0 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch convergence of the remainder (i.e. truncation error): f(x) is an analytic function, is a polynomial approximation T n n →∞ R n n →∞ f ( x ) − T n f ( x ; a ) lim f ( x ; a ) = lim f ( x ; a ) = 0 nearby a with radius of convergence h : n →∞ R n f ( a ± h ; a ) ≠ 0. min h >0 lim 2 variables ( x , y ) at order 2 nearby ( a , b ) : = f (1) ( a , b ) ( x − a , y − b ) f ( x , y ; a , b ) = f ( a , b ) + ∂ f ( x − a ) + ∂ f f must not depend on the integration T 2 ( y − b ) + … path, i.e. must derive from a potential! ∂ x ∂ y homogeneous ( a , b ) ( a , b ) polynomials ∂ 2 f ( x − a ) 2 + 2 ∂ 2 f ( x − a )( y − b ) + ∂ 2 f + 1 ( y − b ) 2 ∂ x 2 ∂ x ∂ y ∂ y 2 2! ( a , b ) ( a , b ) ( a , b ) = f (2) ( a , b ) ( x − a , y − b ) v variables X at order n nearby A : m with ( f ( k ) n n ∂ k f m | = k ( m ) m ) = 1 k ! k k k ! ( X ; A ) k = ∑ A ∑ k ! ∑ T n f ( X ; A ) = ( X ; A ) ∂ X m c 1 ! c 2 ! . . . c v ! k =0 k =0 | A � 36
⃗ ⃗ ⃗ ⃗ ⃗ BE Beams GTPSA in a nutshell Department ๏ Generalised Truncated Power Series Algebra ➡ Multivariate Taylor polynomials of order n in ℝ & ℂ . TPSA coefficients ➡ Powerful tool for solving differential equations (e.g. motion equations). 1 variable x at order n in the neighbourhood of the point a in the domain of the function f : n f ( k ) 2! ( x − a ) 2 + … + f ( n ) ( a ) f ( x ; a ) = f ( a ) + f ′ � ( a )( x − a ) + f ′ � ′ � ( a ) ( x − a ) n = ∑ a T n k ! ( x − a ) k n ! k =0 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch convergence of the remainder (i.e. truncation error): f(x) is an analytic function, is a polynomial approximation T n n →∞ R n n →∞ f ( x ) − T n f ( x ; a ) lim f ( x ; a ) = lim f ( x ; a ) = 0 nearby a with radius of convergence h : n →∞ R n f ( a ± h ; a ) ≠ 0. min h >0 lim 2 variables ( x , y ) at order 2 nearby ( a , b ) : = f (1) ( a , b ) ( x − a , y − b ) f ( x , y ; a , b ) = f ( a , b ) + ∂ f ( x − a ) + ∂ f f must not depend on the integration T 2 ( y − b ) + … path, i.e. must derive from a potential! ∂ x ∂ y homogeneous ( a , b ) ( a , b ) polynomials ∂ 2 f ( x − a ) 2 + 2 ∂ 2 f ( x − a )( y − b ) + ∂ 2 f + 1 ( y − b ) 2 ∂ x 2 ∂ x ∂ y ∂ y 2 2! ( a , b ) ( a , b ) ( a , b ) = f (2) ( a , b ) ( x − a , y − b ) v variables X at order n nearby A : m with ( f ( k ) n n ∂ k f m | = k ( m ) m ) = 1 k ! k k k ! ( X ; A ) k = ∑ A ∑ k ! ∑ T n f ( X ; A ) = ( X ; A ) ∂ X m c 1 ! c 2 ! . . . c v ! k =0 k =0 | A monomials of order k � 36
⃗ ⃗ ⃗ ⃗ ⃗ BE Beams GTPSA in a nutshell Department ๏ Generalised Truncated Power Series Algebra ➡ Multivariate Taylor polynomials of order n in ℝ & ℂ . TPSA coefficients ➡ Powerful tool for solving differential equations (e.g. motion equations). 1 variable x at order n in the neighbourhood of the point a in the domain of the function f : n f ( k ) 2! ( x − a ) 2 + … + f ( n ) ( a ) f ( x ; a ) = f ( a ) + f ′ � ( a )( x − a ) + f ′ � ′ � ( a ) ( x − a ) n = ∑ a T n k ! ( x − a ) k n ! k =0 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch convergence of the remainder (i.e. truncation error): f(x) is an analytic function, is a polynomial approximation T n n →∞ R n n →∞ f ( x ) − T n f ( x ; a ) lim f ( x ; a ) = lim f ( x ; a ) = 0 nearby a with radius of convergence h : n →∞ R n f ( a ± h ; a ) ≠ 0. min h >0 lim 2 variables ( x , y ) at order 2 nearby ( a , b ) : = f (1) ( a , b ) ( x − a , y − b ) f ( x , y ; a , b ) = f ( a , b ) + ∂ f ( x − a ) + ∂ f f must not depend on the integration T 2 ( y − b ) + … path, i.e. must derive from a potential! ∂ x ∂ y homogeneous ( a , b ) ( a , b ) polynomials ∂ 2 f ( x − a ) 2 + 2 ∂ 2 f ( x − a )( y − b ) + ∂ 2 f + 1 ( y − b ) 2 ∂ x 2 ∂ x ∂ y ∂ y 2 2! ( a , b ) ( a , b ) ( a , b ) = f (2) ( a , b ) ( x − a , y − b ) v variables X at order n nearby A : m with ( f ( k ) n n ∂ k f m | = k ( m ) m ) = 1 k ! k k k ! ( X ; A ) k = ∑ A ∑ k ! ∑ T n f ( X ; A ) = ( X ; A ) ∂ X m c 1 ! c 2 ! . . . c v ! k =0 k =0 | A multinomial monomials of order k � 36
⃗ ⃗ ⃗ ⃗ ⃗ BE Beams GTPSA in a nutshell Department ๏ Generalised Truncated Power Series Algebra ➡ Multivariate Taylor polynomials of order n in ℝ & ℂ . TPSA coefficients ➡ Powerful tool for solving differential equations (e.g. motion equations). 1 variable x at order n in the neighbourhood of the point a in the domain of the function f : n f ( k ) 2! ( x − a ) 2 + … + f ( n ) ( a ) f ( x ; a ) = f ( a ) + f ′ � ( a )( x − a ) + f ′ � ′ � ( a ) ( x − a ) n = ∑ a T n k ! ( x − a ) k n ! k =0 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch convergence of the remainder (i.e. truncation error): f(x) is an analytic function, is a polynomial approximation T n n →∞ R n n →∞ f ( x ) − T n f ( x ; a ) lim f ( x ; a ) = lim f ( x ; a ) = 0 nearby a with radius of convergence h : n →∞ R n f ( a ± h ; a ) ≠ 0. min h >0 lim 2 variables ( x , y ) at order 2 nearby ( a , b ) : = f (1) ( a , b ) ( x − a , y − b ) f ( x , y ; a , b ) = f ( a , b ) + ∂ f ( x − a ) + ∂ f f must not depend on the integration T 2 ( y − b ) + … path, i.e. must derive from a potential! ∂ x ∂ y homogeneous ( a , b ) ( a , b ) polynomials ∂ 2 f ( x − a ) 2 + 2 ∂ 2 f ( x − a )( y − b ) + ∂ 2 f + 1 ( y − b ) 2 ∂ x 2 ∂ x ∂ y ∂ y 2 2! ( a , b ) ( a , b ) ( a , b ) TPSA coefficients = f (2) ( a , b ) ( x − a , y − b ) v variables X at order n nearby A : m with ( f ( k ) n n ∂ k f m | = k ( m ) m ) = 1 k ! k k k ! ( X ; A ) k = ∑ A ∑ k ! ∑ T n f ( X ; A ) = ( X ; A ) ∂ X m c 1 ! c 2 ! . . . c v ! k =0 k =0 | A multinomial monomials of order k � 36
⃗ ⃗ ⃗ ⃗ ⃗ BE Beams GTPSA in a nutshell Department IPAC 2015 ๏ Generalised Truncated Power Series Algebra ➡ Multivariate Taylor polynomials of order n in ℝ & ℂ . TPSA coefficients ➡ Powerful tool for solving differential equations (e.g. motion equations). 1 variable x at order n in the neighbourhood of the point a in the domain of the function f : n f ( k ) 2! ( x − a ) 2 + … + f ( n ) ( a ) f ( x ; a ) = f ( a ) + f ′ � ( a )( x − a ) + f ′ � ′ � ( a ) ( x − a ) n = ∑ a T n k ! ( x − a ) k n ! k =0 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch convergence of the remainder (i.e. truncation error): f(x) is an analytic function, is a polynomial approximation T n n →∞ R n n →∞ f ( x ) − T n f ( x ; a ) lim f ( x ; a ) = lim f ( x ; a ) = 0 nearby a with radius of convergence h : n →∞ R n f ( a ± h ; a ) ≠ 0. min h >0 lim 2 variables ( x , y ) at order 2 nearby ( a , b ) : = f (1) ( a , b ) ( x − a , y − b ) f ( x , y ; a , b ) = f ( a , b ) + ∂ f ( x − a ) + ∂ f f must not depend on the integration T 2 ( y − b ) + … path, i.e. must derive from a potential! ∂ x ∂ y homogeneous ( a , b ) ( a , b ) polynomials ∂ 2 f ( x − a ) 2 + 2 ∂ 2 f ( x − a )( y − b ) + ∂ 2 f + 1 ( y − b ) 2 ∂ x 2 ∂ x ∂ y ∂ y 2 2! ( a , b ) ( a , b ) ( a , b ) TPSA coefficients = f (2) ( a , b ) ( x − a , y − b ) v variables X at order n nearby A : m with ( f ( k ) n n ∂ k f m | = k ( m ) m ) = 1 k ! k k k ! ( X ; A ) k = ∑ A ∑ k ! ∑ T n f ( X ; A ) = ( X ; A ) ∂ X m c 1 ! c 2 ! . . . c v ! k =0 k =0 | A multinomial monomials of order k � 36
⃗ ⃗ ⃗ ⃗ ⃗ BE Beams GTPSA in a nutshell Department Github MAD IPAC 2015 ๏ Generalised Truncated Power Series Algebra ➡ Multivariate Taylor polynomials of order n in ℝ & ℂ . TPSA coefficients ➡ Powerful tool for solving differential equations (e.g. motion equations). 1 variable x at order n in the neighbourhood of the point a in the domain of the function f : n f ( k ) 2! ( x − a ) 2 + … + f ( n ) ( a ) f ( x ; a ) = f ( a ) + f ′ � ( a )( x − a ) + f ′ � ′ � ( a ) ( x − a ) n = ∑ a T n k ! ( x − a ) k n ! k =0 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch convergence of the remainder (i.e. truncation error): f(x) is an analytic function, is a polynomial approximation T n n →∞ R n n →∞ f ( x ) − T n f ( x ; a ) lim f ( x ; a ) = lim f ( x ; a ) = 0 nearby a with radius of convergence h : n →∞ R n f ( a ± h ; a ) ≠ 0. min h >0 lim 2 variables ( x , y ) at order 2 nearby ( a , b ) : = f (1) ( a , b ) ( x − a , y − b ) f ( x , y ; a , b ) = f ( a , b ) + ∂ f ( x − a ) + ∂ f f must not depend on the integration T 2 ( y − b ) + … path, i.e. must derive from a potential! ∂ x ∂ y homogeneous ( a , b ) ( a , b ) polynomials ∂ 2 f ( x − a ) 2 + 2 ∂ 2 f ( x − a )( y − b ) + ∂ 2 f + 1 ( y − b ) 2 ∂ x 2 ∂ x ∂ y ∂ y 2 2! ( a , b ) ( a , b ) ( a , b ) TPSA coefficients = f (2) ( a , b ) ( x − a , y − b ) v variables X at order n nearby A : m with ( f ( k ) n n ∂ k f m | = k ( m ) m ) = 1 k ! k k k ! ( X ; A ) k = ∑ A ∑ k ! ∑ T n f ( X ; A ) = ( X ; A ) ∂ X m c 1 ! c 2 ! . . . c v ! k =0 k =0 | A multinomial monomials of order k � 36
⃗ ⃗ ⃗ ⃗ ⃗ BE Beams GTPSA in a nutshell Department Github MAD IPAC 2015 ๏ Generalised Truncated Power Series Algebra 2017-2018 ➡ Multivariate Taylor polynomials of order n in ℝ & ℂ . TPSA coefficients ➡ Powerful tool for solving differential equations (e.g. motion equations). 1 variable x at order n in the neighbourhood of the point a in the domain of the function f : n f ( k ) 2! ( x − a ) 2 + … + f ( n ) ( a ) f ( x ; a ) = f ( a ) + f ′ � ( a )( x − a ) + f ′ � ′ � ( a ) ( x − a ) n = ∑ a T n k ! ( x − a ) k n ! k =0 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch convergence of the remainder (i.e. truncation error): f(x) is an analytic function, is a polynomial approximation T n n →∞ R n n →∞ f ( x ) − T n f ( x ; a ) lim f ( x ; a ) = lim f ( x ; a ) = 0 nearby a with radius of convergence h : n →∞ R n f ( a ± h ; a ) ≠ 0. min h >0 lim 2 variables ( x , y ) at order 2 nearby ( a , b ) : = f (1) ( a , b ) ( x − a , y − b ) f ( x , y ; a , b ) = f ( a , b ) + ∂ f ( x − a ) + ∂ f f must not depend on the integration T 2 ( y − b ) + … path, i.e. must derive from a potential! ∂ x ∂ y homogeneous ( a , b ) ( a , b ) polynomials ∂ 2 f ( x − a ) 2 + 2 ∂ 2 f ( x − a )( y − b ) + ∂ 2 f + 1 ( y − b ) 2 ∂ x 2 ∂ x ∂ y ∂ y 2 2! ( a , b ) ( a , b ) ( a , b ) TPSA coefficients = f (2) ( a , b ) ( x − a , y − b ) v variables X at order n nearby A : m with ( f ( k ) n n ∂ k f m | = k ( m ) m ) = 1 k ! k k k ! ( X ; A ) k = ∑ A ∑ k ! ∑ T n f ( X ; A ) = ( X ; A ) ∂ X m c 1 ! c 2 ! . . . c v ! k =0 k =0 | A multinomial monomials of order k � 36
Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Accuracy of TPSA (myths and legends) BE Department Beams � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. ๏ MAD-NG includes a complete toolbox (i.e. module) to handle DA using AD… ➡ users have full access to GTPSA and DAmaps from the scripting language. � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. ๏ MAD-NG includes a complete toolbox (i.e. module) to handle DA using AD… ➡ users have full access to GTPSA and DAmaps from the scripting language. ➡ users can manipulate DAmaps stored in the MTable or the MFlow returned by Track. � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. ๏ MAD-NG includes a complete toolbox (i.e. module) to handle DA using AD… ➡ users have full access to GTPSA and DAmaps from the scripting language. ➡ users can manipulate DAmaps stored in the MTable or the MFlow returned by Track. ๏ So when DAmap/TPSA introduce errors? � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. ๏ MAD-NG includes a complete toolbox (i.e. module) to handle DA using AD… ➡ users have full access to GTPSA and DAmaps from the scripting language. ➡ users can manipulate DAmaps stored in the MTable or the MFlow returned by Track. ๏ So when DAmap/TPSA introduce errors? ➡ If they are used as functions (e.g. evaluated), instead of DA (e.g. track, twiss). � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. ๏ MAD-NG includes a complete toolbox (i.e. module) to handle DA using AD… ➡ users have full access to GTPSA and DAmaps from the scripting language. ➡ users can manipulate DAmaps stored in the MTable or the MFlow returned by Track. ๏ So when DAmap/TPSA introduce errors? ➡ If they are used as functions (e.g. evaluated), instead of DA (e.g. track, twiss). ➡ High orders of are used to interpolate at the new position by substitution. T n f ( x ; a ) � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. ๏ MAD-NG includes a complete toolbox (i.e. module) to handle DA using AD… ➡ users have full access to GTPSA and DAmaps from the scripting language. ➡ users can manipulate DAmaps stored in the MTable or the MFlow returned by Track. ๏ So when DAmap/TPSA introduce errors? ➡ If they are used as functions (e.g. evaluated), instead of DA (e.g. track, twiss). ➡ High orders of are used to interpolate at the new position by substitution. T n f ( x ; a ) f ( k ) n a + h ∑ T n k ! ( x − a − h ) k f ( x ; a + h ) = k =0 � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. ๏ MAD-NG includes a complete toolbox (i.e. module) to handle DA using AD… ➡ users have full access to GTPSA and DAmaps from the scripting language. ➡ users can manipulate DAmaps stored in the MTable or the MFlow returned by Track. ๏ So when DAmap/TPSA introduce errors? ➡ If they are used as functions (e.g. evaluated), instead of DA (e.g. track, twiss). ➡ High orders of are used to interpolate at the new position by substitution. T n f ( x ; a ) f ( k ) n n f ( k ) k ! ( x − a − h ) k ; a + h ∑ a ∑ T n k ! h k f ( a + h ) ≈ f ( x ; a + h ) = k =0 k =0 � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. ๏ MAD-NG includes a complete toolbox (i.e. module) to handle DA using AD… ➡ users have full access to GTPSA and DAmaps from the scripting language. ➡ users can manipulate DAmaps stored in the MTable or the MFlow returned by Track. ๏ So when DAmap/TPSA introduce errors? ➡ If they are used as functions (e.g. evaluated), instead of DA (e.g. track, twiss). ➡ High orders of are used to interpolate at the new position by substitution. T n f ( x ; a ) f ( k ) n n f ( k ) k ! ( x − a − h ) k ; a + h ∑ a ∑ T n k ! h k f ( a + h ) ≈ f ( x ; a + h ) = k =0 k =0 T n f ( a + h ; a ) � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. ๏ MAD-NG includes a complete toolbox (i.e. module) to handle DA using AD… ➡ users have full access to GTPSA and DAmaps from the scripting language. ➡ users can manipulate DAmaps stored in the MTable or the MFlow returned by Track. ๏ So when DAmap/TPSA introduce errors? ➡ If they are used as functions (e.g. evaluated), instead of DA (e.g. track, twiss). ➡ High orders of are used to interpolate at the new position by substitution. T n f ( x ; a ) f ( k ) n n f ( k ) k ! ( x − a − h ) k ; a + h ∑ a ∑ T n k ! h k f ( a + h ) ≈ f ( x ; a + h ) = k =0 k =0 T n f ( a + h ; a ) � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. ๏ MAD-NG includes a complete toolbox (i.e. module) to handle DA using AD… ➡ users have full access to GTPSA and DAmaps from the scripting language. ➡ users can manipulate DAmaps stored in the MTable or the MFlow returned by Track. ๏ So when DAmap/TPSA introduce errors? ➡ If they are used as functions (e.g. evaluated), instead of DA (e.g. track, twiss). ➡ High orders of are used to interpolate at the new position by substitution. T n f ( x ; a ) d k T n f ( k ) n n f ( k ) f ( x ; a ) k ! h k ; k ! ( x − a − h ) k ; a + h ∑ a ∑ f ( k ) T n f ( a + h ) ≈ a + h ≈ ( a + h ) f ( x ; a + h ) = d x k k =0 k =0 T n f ( a + h ; a ) � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. ๏ MAD-NG includes a complete toolbox (i.e. module) to handle DA using AD… ➡ users have full access to GTPSA and DAmaps from the scripting language. ➡ users can manipulate DAmaps stored in the MTable or the MFlow returned by Track. ๏ So when DAmap/TPSA introduce errors? ➡ If they are used as functions (e.g. evaluated), instead of DA (e.g. track, twiss). ➡ High orders of are used to interpolate at the new position by substitution. T n f ( x ; a ) d k T n f ( k ) n n f ( k ) f ( x ; a ) k ! h k ; k ! ( x − a − h ) k ; a + h ∑ a ∑ f ( k ) T n f ( a + h ) ≈ a + h ≈ ( a + h ) f ( x ; a + h ) = d x k k =0 k =0 T n f ( a + h ; a ) � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. ๏ MAD-NG includes a complete toolbox (i.e. module) to handle DA using AD… ➡ users have full access to GTPSA and DAmaps from the scripting language. ➡ users can manipulate DAmaps stored in the MTable or the MFlow returned by Track. ๏ So when DAmap/TPSA introduce errors? ➡ If they are used as functions (e.g. evaluated), instead of DA (e.g. track, twiss). ➡ High orders of are used to interpolate at the new position by substitution. T n f ( x ; a ) d k T n f ( k ) n n f ( k ) f ( x ; a ) k ! h k ; k ! ( x − a − h ) k ; a + h ∑ a ∑ f ( k ) T n f ( a + h ) ≈ a + h ≈ ( a + h ) f ( x ; a + h ) = d x k order n is constant k =0 k =0 order n-1 is linear in h T n f ( a + h ; a ) � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. ๏ MAD-NG includes a complete toolbox (i.e. module) to handle DA using AD… ➡ users have full access to GTPSA and DAmaps from the scripting language. ➡ users can manipulate DAmaps stored in the MTable or the MFlow returned by Track. ๏ So when DAmap/TPSA introduce errors? ➡ If they are used as functions (e.g. evaluated), instead of DA (e.g. track, twiss). ➡ High orders of are used to interpolate at the new position by substitution. T n f ( x ; a ) d k T n f ( k ) n n f ( k ) f ( x ; a ) k ! h k ; k ! ( x − a − h ) k ; a + h ∑ a ∑ f ( k ) T n f ( a + h ) ≈ a + h ≈ ( a + h ) f ( x ; a + h ) = d x k Matrix codes order n is constant k =0 k =0 order n-1 is linear in h don’t do better! T n f ( a + h ; a ) � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. ๏ MAD-NG includes a complete toolbox (i.e. module) to handle DA using AD… ➡ users have full access to GTPSA and DAmaps from the scripting language. ➡ users can manipulate DAmaps stored in the MTable or the MFlow returned by Track. ๏ So when DAmap/TPSA introduce errors? sin x and its Taylor approximations nearby 0 by ➡ If they are used as functions (e.g. evaluated), instead of DA (e.g. track, twiss). polynomials of degree 1 , 3 , 5 , 7 , 9 , 11 and 13 . ➡ High orders of are used to interpolate at the new position by substitution. T n f ( x ; a ) d k T n f ( k ) n n f ( k ) f ( x ; a ) k ! h k ; k ! ( x − a − h ) k ; a + h ∑ a ∑ f ( k ) T n f ( a + h ) ≈ a + h ≈ ( a + h ) f ( x ; a + h ) = d x k Matrix codes order n is constant k =0 k =0 order n-1 is linear in h don’t do better! T n f ( a + h ; a ) � 37
BE Beams Accuracy of TPSA (myths and legends) Department ๏ GTPSA are exact to machine precision, no approximation for orders 0..n ➡ derivatives are computed using automatic differentiation (AD). from Wikipedia AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, multiplication, division, etc.) and elementary Functions of TPSAs ≠ TPSAs as functions functions (exp, log, sin, cos, etc.). By applying the chain rule repeatedly to these operations, derivatives of arbitrary order can be computed automatically, accurately to working precision , and using at exact ≠ approximate most a small constant factor more arithmetic operations than the original program. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Symbolic differentiation can lead to inefficient code and faces the difficulty of converting a computer program into a single expression, while numerical differentiation can introduce round-off errors in the discretization process and cancellation. Both classical methods have problems with calculating higher derivatives, where complexity and errors increase. ๏ MAD-NG includes a complete toolbox (i.e. module) to handle DA using AD… ➡ users have full access to GTPSA and DAmaps from the scripting language. ➡ users can manipulate DAmaps stored in the MTable or the MFlow returned by Track. ๏ So when DAmap/TPSA introduce errors? sin x and its Taylor approximations nearby 0 by ➡ If they are used as functions (e.g. evaluated), instead of DA (e.g. track, twiss). polynomials of degree 1 , 3 , 5 , 7 , 9 , 11 and 13 . ➡ High orders of are used to interpolate at the new position by substitution. T n f ( x ; a ) d k T n f ( k ) n n f ( k ) f ( x ; a ) k ! h k ; k ! ( x − a − h ) k ; a + h ∑ a ∑ f ( k ) T n f ( a + h ) ≈ a + h ≈ ( a + h ) f ( x ; a + h ) = d x k Matrix codes order n is constant k =0 k =0 order n-1 is linear in h don’t do better! T n f ( a + h ; a ) � 37
Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch DA map BE Department Beams � 38
Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch ๏ Differential Algebra maps DA map BE Department Beams � 38
BE Beams DA map Department ๏ Differential Algebra maps ➡ Tuple of GTPSA, e.g. 6D phase space uses 6 GTPSA. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch � 38
BE Beams DA map Department ๏ Differential Algebra maps ➡ Tuple of GTPSA, e.g. 6D phase space uses 6 GTPSA. ➡ Handles user defined knobs. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch � 38
BE Beams DA map Department ๏ Differential Algebra maps ➡ Tuple of GTPSA, e.g. 6D phase space uses 6 GTPSA. ➡ Handles user defined knobs. ➡ Behaves like particles for the scalar part (orbit). Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch � 38
BE Beams DA map Department ๏ Differential Algebra maps ➡ Tuple of GTPSA, e.g. 6D phase space uses 6 GTPSA. ➡ Handles user defined knobs. ➡ Behaves like particles for the scalar part (orbit). DA map of 6 variables at order 2 (e.g. MAD-X twiss) Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch x px y py t pt � 38
BE Beams DA map Department ๏ Differential Algebra maps ➡ Tuple of GTPSA, e.g. 6D phase space uses 6 GTPSA. ➡ Handles user defined knobs. ➡ Behaves like particles for the scalar part (orbit). DA map of 6 variables at order 2 (e.g. MAD-X twiss) GTPSA Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch x px y py t pt � 38
BE Beams DA map Department ๏ Differential Algebra maps ➡ Tuple of GTPSA, e.g. 6D phase space uses 6 GTPSA. ➡ Handles user defined knobs. ➡ Behaves like particles for the scalar part (orbit). DA map of 6 variables at order 2 (e.g. MAD-X twiss) GTPSA Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch x px y py t pt � 38
BE Beams DA map Department ๏ Differential Algebra maps ➡ Tuple of GTPSA, e.g. 6D phase space uses 6 GTPSA. ➡ Handles user defined knobs. ➡ Behaves like particles for the scalar part (orbit). DA map of 6 variables at order 2 (e.g. MAD-X twiss) f (0) A : E (orbit) GTPSA Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch x px y py t pt � 38
BE Beams DA map Department ๏ Differential Algebra maps ➡ Tuple of GTPSA, e.g. 6D phase space uses 6 GTPSA. ➡ Handles user defined knobs. ➡ Behaves like particles for the scalar part (orbit). DA map of 6 variables at order 2 (e.g. MAD-X twiss) f (0) A : E (orbit) GTPSA Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch x px y py t pt � 38
BE Beams DA map Department ๏ Differential Algebra maps ➡ Tuple of GTPSA, e.g. 6D phase space uses 6 GTPSA. ➡ Handles user defined knobs. ➡ Behaves like particles for the scalar part (orbit). DA map of 6 variables at order 2 (e.g. MAD-X twiss) f (1) f (0) A : E (orbit) A : R (matrix) GTPSA Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch x px y py t pt � 38
BE Beams DA map Department ๏ Differential Algebra maps ➡ Tuple of GTPSA, e.g. 6D phase space uses 6 GTPSA. ➡ Handles user defined knobs. ➡ Behaves like particles for the scalar part (orbit). DA map of 6 variables at order 2 (e.g. MAD-X twiss) f (1) f (0) A : E (orbit) A : R (matrix) GTPSA Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch x px y py t pt � 38
BE Beams DA map Department ๏ Differential Algebra maps ➡ Tuple of GTPSA, e.g. 6D phase space uses 6 GTPSA. ➡ Handles user defined knobs. ➡ Behaves like particles for the scalar part (orbit). DA map of 6 variables at order 2 (e.g. MAD-X twiss) f (1) f (2) f (0) A : E (orbit) A : R (matrix) A : T* (folded tensor) GTPSA Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch x px y py t pt � 38
BE Beams DA map Department ๏ Differential Algebra maps ➡ Tuple of GTPSA, e.g. 6D phase space uses 6 GTPSA. ➡ Handles user defined knobs. ➡ Behaves like particles for the scalar part (orbit). DA map of 6 variables at order 2 (e.g. MAD-X twiss) f (1) f (2) f (0) A : E (orbit) A : R (matrix) A : T* (folded tensor) GTPSA Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch x ∂ p x px ∂ k 1 y knobs py t pt � 38
BE Beams DA map Department ๏ Differential Algebra maps ➡ Tuple of GTPSA, e.g. 6D phase space uses 6 GTPSA. ➡ Handles user defined knobs. ➡ Behaves like particles for the scalar part (orbit). DA map of 6 variables at order 2 (e.g. MAD-X twiss) f (1) f (2) f (0) A : E (orbit) A : R (matrix) A : T* (folded tensor) GTPSA Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch x ∂ p x ∂ 2 p x ∂ 2 p x px ∂ k 1 ∂ x ∂ k 1 ∂ k 2 1 y knobs py t pt � 38
BE Beams DA map Department ๏ Differential Algebra maps ➡ Tuple of GTPSA, e.g. 6D phase space uses 6 GTPSA. ➡ Handles user defined knobs. ➡ Behaves like particles for the scalar part (orbit). DA map of 6 variables at order 2 (e.g. MAD-X twiss) f (1) f (2) f (0) A : E (orbit) A : R (matrix) A : T* (folded tensor) GTPSA Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch x ∂ p x ∂ 2 p x ∂ 2 p x px ∂ k 1 ∂ x ∂ k 1 ∂ k 2 1 y knobs py t pt k 1 0 0 0 0 0 0 1 knob k 1 in “user scope” � 38
BE Beams DA map Department ๏ Differential Algebra maps ➡ Tuple of GTPSA, e.g. 6D phase space uses 6 GTPSA. ➡ Handles user defined knobs. ➡ Behaves like particles for the scalar part (orbit). DA map of 6 variables at order 2 (e.g. MAD-X twiss) f (1) f (2) f (0) A : E (orbit) A : R (matrix) A : T* (folded tensor) GTPSA Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch x ∂ p x ∂ 2 p x ∂ 2 p x px ∂ k 1 ∂ x ∂ k 1 ∂ k 2 1 y knobs TPSA: homogeneous polynomials are dense (i.e. R is squared) py GTPSA: homogeneous polynomials are NOT dense or include knobs t pt k 1 0 0 0 0 0 0 1 knob k 1 in “user scope” � 38
Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch DAmap vs. Matrix sizes BE Department Beams � 39
BE Beams DAmap vs. Matrix sizes Department ) = ( n + v )! ( n + v TPSA: homogeneous polynomials are dense with coefficients v n ! v ! Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch � 39
BE Beams DAmap vs. Matrix sizes Department ) = ( n + v )! ( n + v TPSA: homogeneous polynomials are dense with coefficients v n ! v ! GTPSA: homogeneous polynomials are NOT dense (no direct formula, only upper bound) Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch � 39
BE Beams DAmap vs. Matrix sizes Department ) = ( n + v )! ( n + v TPSA: homogeneous polynomials are dense with coefficients v n ! v ! GTPSA: homogeneous polynomials are NOT dense (no direct formula, only upper bound) v \ n 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 13 2 6 12 20 30 42 56 72 90 110 132 156 182 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch 3 12 30 60 105 168 252 360 495 660 858 1092 1365 4 20 60 140 280 504 840 1320 1980 2860 4004 5460 7280 5 30 105 280 630 1260 2310 3960 6435 10010 15015 21840 30940 6 42 168 504 1260 2772 5544 10296 18018 30030 48048 74256 111384 7 56 252 840 2310 5544 12012 24024 45045 80080 136136 222768 352716 8 72 360 1320 3960 10296 24024 51480 102960 194480 350064 604656 1007760 � 39
BE Beams DAmap vs. Matrix sizes Department ) = ( n + v )! ( n + v TPSA: homogeneous polynomials are dense with coefficients v n ! v ! GTPSA: homogeneous polynomials are NOT dense (no direct formula, only upper bound) DA map: v ( n + v ) v \ n 1 2 3 4 5 6 7 8 9 10 11 12 v 1 2 3 4 5 6 7 8 9 10 11 12 13 2 6 12 20 30 42 56 72 90 110 132 156 182 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch 3 12 30 60 105 168 252 360 495 660 858 1092 1365 4 20 60 140 280 504 840 1320 1980 2860 4004 5460 7280 5 30 105 280 630 1260 2310 3960 6435 10010 15015 21840 30940 6 42 168 504 1260 2772 5544 10296 18018 30030 48048 74256 111384 7 56 252 840 2310 5544 12012 24024 45045 80080 136136 222768 352716 8 72 360 1320 3960 10296 24024 51480 102960 194480 350064 604656 1007760 � 39
BE Beams DAmap vs. Matrix sizes Department ) = ( n + v )! ( n + v TPSA: homogeneous polynomials are dense with coefficients v n ! v ! GTPSA: homogeneous polynomials are NOT dense (no direct formula, only upper bound) DA map: v ( n + v ) v \ n 1 2 3 4 5 6 7 8 9 10 11 12 v 1 2 3 4 5 6 7 8 9 10 11 12 13 2 6 12 20 30 42 56 72 90 110 132 156 182 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch 3 12 30 60 105 168 252 360 495 660 858 1092 1365 4 20 60 140 280 504 840 1320 1980 2860 4004 5460 7280 5 30 105 280 630 1260 2310 3960 6435 10010 15015 21840 30940 6 42 168 504 1260 2772 5544 10296 18018 30030 48048 74256 111384 7 56 252 840 2310 5544 12012 24024 45045 80080 136136 222768 352716 8 72 360 1320 3960 10296 24024 51480 102960 194480 350064 604656 1007760 v \ n 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 13 2 6 14 30 62 126 254 510 1022 2046 4094 8190 16382 3 12 39 120 363 1092 3279 9840 29523 88572 265719 797160 2391483 4 20 84 340 1364 5460 21844 87380 349524 1398100 5592404 22369620 89478484 5 30 155 780 3905 19530 97655 488280 2441405 12207030 61035155 305175780 1525878905 6 42 258 1554 9330 55986 335922 2015538 12093234 72559410 435356466 2612138802 15672832818 7 56 399 2800 19607 137256 960799 6725600 47079207 329554456 2306881199 16148168400 113037178807 8 72 584 4680 37448 299592 2396744 19173960 153391688 1227133512 9817068104 78536544840 628292358728 � 39
BE Beams DAmap vs. Matrix sizes Department ) = ( n + v )! ( n + v TPSA: homogeneous polynomials are dense with coefficients v n ! v ! GTPSA: homogeneous polynomials are NOT dense (no direct formula, only upper bound) DA map: v ( n + v ) v \ n 1 2 3 4 5 6 7 8 9 10 11 12 v 1 2 3 4 5 6 7 8 9 10 11 12 13 2 6 12 20 30 42 56 72 90 110 132 156 182 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch 3 12 30 60 105 168 252 360 495 660 858 1092 1365 4 20 60 140 280 504 840 1320 1980 2860 4004 5460 7280 5 30 105 280 630 1260 2310 3960 6435 10010 15015 21840 30940 6 42 168 504 1260 2772 5544 10296 18018 30030 48048 74256 111384 7 56 252 840 2310 5544 12012 24024 45045 80080 136136 222768 352716 n v k +1 = v ( v n +1 − 1) ∑ Matrix: 8 72 360 1320 3960 10296 24024 51480 102960 194480 350064 604656 1007760 v − 1 k =0 v \ n 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 13 2 6 14 30 62 126 254 510 1022 2046 4094 8190 16382 3 12 39 120 363 1092 3279 9840 29523 88572 265719 797160 2391483 4 20 84 340 1364 5460 21844 87380 349524 1398100 5592404 22369620 89478484 5 30 155 780 3905 19530 97655 488280 2441405 12207030 61035155 305175780 1525878905 6 42 258 1554 9330 55986 335922 2015538 12093234 72559410 435356466 2612138802 15672832818 7 56 399 2800 19607 137256 960799 6725600 47079207 329554456 2306881199 16148168400 113037178807 8 72 584 4680 37448 299592 2396744 19173960 153391688 1227133512 9817068104 78536544840 628292358728 � 39
BE Beams DAmap vs. Matrix sizes Department ) = ( n + v )! ( n + v TPSA: homogeneous polynomials are dense with coefficients v n ! v ! GTPSA: homogeneous polynomials are NOT dense (no direct formula, only upper bound) DA map: v ( n + v ) v \ n 1 2 3 4 5 6 7 8 9 10 11 12 v 1 2 3 4 5 6 7 8 9 10 11 12 13 2 6 12 20 30 42 56 72 90 110 132 156 182 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch 3 12 30 60 105 168 252 360 495 660 858 1092 1365 4 20 60 140 280 504 840 1320 1980 2860 4004 5460 7280 5 30 105 280 630 1260 2310 3960 6435 10010 15015 21840 30940 6 42 168 504 1260 2772 5544 10296 18018 30030 48048 74256 111384 7 56 252 840 2310 5544 12012 24024 45045 80080 136136 222768 352716 n v k +1 = v ( v n +1 − 1) ∑ Matrix: 8 72 360 1320 3960 10296 24024 51480 102960 194480 350064 604656 1007760 v − 1 k =0 v \ n 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 13 2 6 14 30 62 126 254 510 1022 2046 4094 8190 16382 3 12 39 120 363 1092 3279 9840 29523 88572 265719 797160 2391483 4 20 84 340 1364 5460 21844 87380 349524 1398100 5592404 22369620 89478484 5 30 155 780 3905 19530 97655 488280 2441405 12207030 61035155 305175780 1525878905 6 42 258 1554 9330 55986 335922 2015538 12093234 72559410 435356466 2612138802 15672832818 7 56 399 2800 19607 137256 960799 6725600 47079207 329554456 2306881199 16148168400 113037178807 8 72 584 4680 37448 299592 2396744 19173960 153391688 1227133512 9817068104 78536544840 628292358728 � 39
BE Beams DAmap vs. Matrix sizes Department ) = ( n + v )! ( n + v TPSA: homogeneous polynomials are dense with coefficients v n ! v ! GTPSA: homogeneous polynomials are NOT dense (no direct formula, only upper bound) DA map: v ( n + v ) v \ n 1 2 3 4 5 6 7 8 9 10 11 12 v 1 2 3 4 5 6 7 8 9 10 11 12 13 2 6 12 20 30 42 56 72 90 110 132 156 182 Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch 3 12 30 60 105 168 252 360 495 660 858 1092 1365 4 20 60 140 280 504 840 1320 1980 2860 4004 5460 7280 5 30 105 280 630 1260 2310 3960 6435 10010 15015 21840 30940 6 42 168 504 1260 2772 5544 10296 18018 30030 48048 74256 111384 7 56 252 840 2310 5544 12012 24024 45045 80080 136136 222768 352716 n v k +1 = v ( v n +1 − 1) ∑ Matrix: 8 72 360 1320 3960 10296 24024 51480 102960 194480 350064 604656 1007760 v − 1 k =0 v \ n 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 13 2 6 14 30 62 126 254 510 1022 2046 4094 8190 16382 3 12 39 120 363 1092 3279 9840 29523 88572 265719 797160 2391483 4 20 84 340 1364 5460 21844 87380 349524 1398100 5592404 22369620 89478484 5 30 155 780 3905 19530 97655 488280 2441405 12207030 61035155 305175780 1525878905 6 42 258 1554 9330 55986 335922 2015538 12093234 72559410 435356466 2612138802 15672832818 7 56 399 2800 19607 137256 960799 6725600 47079207 329554456 2306881199 16148168400 113037178807 8 72 584 4680 37448 299592 2396744 19173960 153391688 1227133512 9817068104 78536544840 628292358728 � 39
BE Beams DAmap vs. Matrix sizes Department ) = ( n + v )! ( n + v TPSA: homogeneous polynomials are dense with coefficients v n ! v ! GTPSA: homogeneous polynomials are NOT dense (no direct formula, only upper bound) DA map: v ( n + v ) v \ n 1 2 3 4 5 6 7 8 9 10 11 12 v 1 2 3 4 5 6 7 8 9 10 11 12 13 TPSA manipulate 2 6 12 20 30 42 56 72 90 110 132 156 182 only numbers! Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch 3 12 30 60 105 168 252 360 495 660 858 1092 1365 4 20 60 140 280 504 840 1320 1980 2860 4004 5460 7280 5 30 105 280 630 1260 2310 3960 6435 10010 15015 21840 30940 6 42 168 504 1260 2772 5544 10296 18018 30030 48048 74256 111384 7 56 252 840 2310 5544 12012 24024 45045 80080 136136 222768 352716 n v k +1 = v ( v n +1 − 1) ∑ Matrix: 8 72 360 1320 3960 10296 24024 51480 102960 194480 350064 604656 1007760 v − 1 k =0 v \ n 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 13 2 6 14 30 62 126 254 510 1022 2046 4094 8190 16382 3 12 39 120 363 1092 3279 9840 29523 88572 265719 797160 2391483 4 20 84 340 1364 5460 21844 87380 349524 1398100 5592404 22369620 89478484 5 30 155 780 3905 19530 97655 488280 2441405 12207030 61035155 305175780 1525878905 6 42 258 1554 9330 55986 335922 2015538 12093234 72559410 435356466 2612138802 15672832818 7 56 399 2800 19607 137256 960799 6725600 47079207 329554456 2306881199 16148168400 113037178807 8 72 584 4680 37448 299592 2396744 19173960 153391688 1227133512 9817068104 78536544840 628292358728 � 39
BE Beams DAmap vs. Matrix sizes Department ) = ( n + v )! ( n + v TPSA: homogeneous polynomials are dense with coefficients v n ! v ! GTPSA: homogeneous polynomials are NOT dense (no direct formula, only upper bound) DA map: v ( n + v ) v \ n 1 2 3 4 5 6 7 8 9 10 11 12 v 1 2 3 4 5 6 7 8 9 10 11 12 13 TPSA manipulate 2 6 12 20 30 42 56 72 90 110 132 156 182 only numbers! Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch 3 12 30 60 105 168 252 360 495 660 858 1092 1365 4 20 60 140 280 504 840 1320 1980 2860 4004 5460 7280 TPSA are the only suitable solutions for high orders! 5 30 105 280 630 1260 2310 3960 6435 10010 15015 21840 30940 6 42 168 504 1260 2772 5544 10296 18018 30030 48048 74256 111384 7 56 252 840 2310 5544 12012 24024 45045 80080 136136 222768 352716 n v k +1 = v ( v n +1 − 1) ∑ Matrix: 8 72 360 1320 3960 10296 24024 51480 102960 194480 350064 604656 1007760 v − 1 k =0 v \ n 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 13 2 6 14 30 62 126 254 510 1022 2046 4094 8190 16382 3 12 39 120 363 1092 3279 9840 29523 88572 265719 797160 2391483 4 20 84 340 1364 5460 21844 87380 349524 1398100 5592404 22369620 89478484 5 30 155 780 3905 19530 97655 488280 2441405 12207030 61035155 305175780 1525878905 6 42 258 1554 9330 55986 335922 2015538 12093234 72559410 435356466 2612138802 15672832818 7 56 399 2800 19607 137256 960799 6725600 47079207 329554456 2306881199 16148168400 113037178807 8 72 584 4680 37448 299592 2396744 19173960 153391688 1227133512 9817068104 78536544840 628292358728 � 39
Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch DAmap settings BE Department Beams � 40
BE Beams DAmap settings Department damap with planes settings damap { .nv=nv or 6, -- number of map variables .xy=no or 2, -- order for xy planes .pt=no or xy, -- order for pt plane .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} -- variables names } damap{ } ⟺ damap{.nv=6, .xy=2, .pt=2} damap{.xy=3} ⟺ damap{.nv=6, .xy=3, .pt=3} Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch damap{.pt=5} ⟺ damap{.nv=6, .xy=2, .pt=5} .nv=6 ⟺ .mo={xy,xy,xy,xy,pt,pt} .nv=5 ⟺ .mo={xy,xy,xy,xy}, .ko={pt} .nv=4 ⟺ .mo={xy,xy,xy,xy} � 40
BE Beams DAmap settings Department damap with planes settings damap with variables settings damap { damap { .nv=nv or 6, -- number of map variables .nv=nv -- number of mvars (replaced by #mo if array or string) .xy=no or 2, -- order for xy planes .mo=mo -- mvars orders (number, string or array) .pt=no or xy, -- order for pt plane .nk=nk -- number of knobs (replaced by #ko if array or string) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} .ko=ko -- knobs orders (number, string or array) -- variables names .dk=dk -- knobs max Xorder (number) } .vo=vo -- variables orders (string or array, variables orders) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} -- variables names } damap{ } ⟺ damap{.nv=6, .xy=2, .pt=2} damap{.xy=3} ⟺ damap{.nv=6, .xy=3, .pt=3} .mo={3,4} .ko={1,2} .dk=2 .vn={‘x’,’y’,’k1’,’k2’} Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch damap{.pt=5} ⟺ damap{.nv=6, .xy=2, .pt=5} .vo={2,3} .nv=6 ⟺ .mo={xy,xy,xy,xy,pt,pt} .nv=5 ⟺ .mo={xy,xy,xy,xy}, .ko={pt} .nv=4 ⟺ .mo={xy,xy,xy,xy} � 40
BE Beams DAmap settings Department damap with planes settings damap with variables settings damap { damap { .nv=nv or 6, -- number of map variables .nv=nv -- number of mvars (replaced by #mo if array or string) .xy=no or 2, -- order for xy planes .mo=mo -- mvars orders (number, string or array) .pt=no or xy, -- order for pt plane .nk=nk -- number of knobs (replaced by #ko if array or string) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} .ko=ko -- knobs orders (number, string or array) -- variables names .dk=dk -- knobs max Xorder (number) } .vo=vo -- variables orders (string or array, variables orders) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} -- variables names } damap{ } ⟺ damap{.nv=6, .xy=2, .pt=2} damap{.xy=3} ⟺ damap{.nv=6, .xy=3, .pt=3} .mo={3,4} .ko={1,2} .dk=2 .vn={‘x’,’y’,’k1’,’k2’} Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch damap{.pt=5} ⟺ damap{.nv=6, .xy=2, .pt=5} .vo={2,3} .nv=6 ⟺ .mo={xy,xy,xy,xy,pt,pt} .nv=5 ⟺ .mo={xy,xy,xy,xy}, .ko={pt} .nv=4 ⟺ .mo={xy,xy,xy,xy} f (0) f (1) f (2) A A A GTPSA x px NV y knobs NV MO py t NV+NK pt k 1 0 0 0 0 0 0 1 � 40
BE Beams DAmap settings Department damap with planes settings damap with variables settings damap { damap { .nv=nv or 6, -- number of map variables .nv=nv -- number of mvars (replaced by #mo if array or string) .xy=no or 2, -- order for xy planes .mo=mo -- mvars orders (number, string or array) .pt=no or xy, -- order for pt plane .nk=nk -- number of knobs (replaced by #ko if array or string) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} .ko=ko -- knobs orders (number, string or array) -- variables names .dk=dk -- knobs max Xorder (number) } .vo=vo -- variables orders (string or array, variables orders) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} -- variables names } damap{ } ⟺ damap{.nv=6, .xy=2, .pt=2} .mo .ko damap{.xy=3} ⟺ damap{.nv=6, .xy=3, .pt=3} .mo={3,4} .ko={1,2} .dk=2 .vn={‘x’,’y’,’k1’,’k2’} Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch damap{.pt=5} ⟺ damap{.nv=6, .xy=2, .pt=5} .vo={2,3} ∂ 4 f y ∂ 3 f y .nv=6 ⟺ .mo={xy,xy,xy,xy,pt,pt} ∂ 3 f x ∂ 3 f x ∂ 3 f x ∂ x 3 , ∂ 2 f x ∂ 3 f x , ∂ f x yes : no : ∂ y 3 , , , ; , ∂ a . .nv=5 ⟺ .mo={xy,xy,xy,xy}, .ko={pt} ∂ x 2 ∂ k 1 ∂ x 2 ∂ k 2 ∂ x ∂ k 1 ∂ k 2 ∂ k 2 ∂ k 1 ∂ k 2 2 1 2 .nv=4 ⟺ .mo={xy,xy,xy,xy} f (0) f (1) f (2) A A A GTPSA x px NV y knobs NV MO py t NV+NK pt k 1 0 0 0 0 0 0 1 � 40
BE Beams DAmap settings Department damap with planes settings damap with variables settings damap { damap { .nv=nv or 6, -- number of map variables .nv=nv -- number of mvars (replaced by #mo if array or string) .xy=no or 2, -- order for xy planes .mo=mo -- mvars orders (number, string or array) .pt=no or xy, -- order for pt plane .nk=nk -- number of knobs (replaced by #ko if array or string) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} .ko=ko -- knobs orders (number, string or array) -- variables names .dk=dk -- knobs max Xorder (number) } .vo=vo -- variables orders (string or array, variables orders) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} -- variables names } damap{ } ⟺ damap{.nv=6, .xy=2, .pt=2} .mo .ko damap{.xy=3} ⟺ damap{.nv=6, .xy=3, .pt=3} .mo={3,4} .ko={1,2} .dk=2 .vn={‘x’,’y’,’k1’,’k2’} Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch damap{.pt=5} ⟺ damap{.nv=6, .xy=2, .pt=5} .vo={2,3} ∂ 4 f y ∂ 3 f y .nv=6 ⟺ .mo={xy,xy,xy,xy,pt,pt} ∂ 3 f x ∂ 3 f x ∂ 3 f x ∂ x 3 , ∂ 2 f x ∂ 3 f x , ∂ f x yes : no : ∂ y 3 , , , ; , ∂ a . .nv=5 ⟺ .mo={xy,xy,xy,xy}, .ko={pt} ∂ x 2 ∂ k 1 ∂ x 2 ∂ k 2 ∂ x ∂ k 1 ∂ k 2 ∂ k 2 ∂ k 1 ∂ k 2 2 1 2 .nv=4 ⟺ .mo={xy,xy,xy,xy} f (0) f (1) f (2) A A A GTPSA x px NV y knobs NV MO py t NV+NK pt k 1 0 0 0 0 0 0 1 � 40
BE Beams DAmap settings Department damap with planes settings damap with variables settings damap { damap { .nv=nv or 6, -- number of map variables .nv=nv -- number of mvars (replaced by #mo if array or string) .xy=no or 2, -- order for xy planes .mo=mo -- mvars orders (number, string or array) .pt=no or xy, -- order for pt plane .nk=nk -- number of knobs (replaced by #ko if array or string) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} .ko=ko -- knobs orders (number, string or array) -- variables names .dk=dk -- knobs max Xorder (number) } .vo=vo -- variables orders (string or array, variables orders) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} -- variables names } damap{ } ⟺ damap{.nv=6, .xy=2, .pt=2} .mo .ko damap{.xy=3} ⟺ damap{.nv=6, .xy=3, .pt=3} .mo={3,4} .ko={1,2} .dk=2 .vn={‘x’,’y’,’k1’,’k2’} Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch damap{.pt=5} ⟺ damap{.nv=6, .xy=2, .pt=5} .vo={2,3} ∂ 4 f y ∂ 3 f y .nv=6 ⟺ .mo={xy,xy,xy,xy,pt,pt} ∂ 3 f x ∂ 3 f x ∂ 3 f x ∂ x 3 , ∂ 2 f x ∂ 3 f x , ∂ f x yes : no : ∂ y 3 , , , ; , ∂ a . .nv=5 ⟺ .mo={xy,xy,xy,xy}, .ko={pt} ∂ x 2 ∂ k 1 ∂ x 2 ∂ k 2 ∂ x ∂ k 1 ∂ k 2 ∂ k 2 ∂ k 1 ∂ k 2 2 1 2 .nv=4 ⟺ .mo={xy,xy,xy,xy} f (0) f (1) f (2) A A A GTPSA x px NV y knobs NV MO py t NV+NK pt k 1 0 0 0 0 0 0 1 � 40
BE Beams DAmap settings Department damap with planes settings damap with variables settings damap { damap { .nv=nv or 6, -- number of map variables .nv=nv -- number of mvars (replaced by #mo if array or string) .xy=no or 2, -- order for xy planes .mo=mo -- mvars orders (number, string or array) .pt=no or xy, -- order for pt plane .nk=nk -- number of knobs (replaced by #ko if array or string) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} .ko=ko -- knobs orders (number, string or array) -- variables names .dk=dk -- knobs max Xorder (number) } .vo=vo -- variables orders (string or array, variables orders) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} -- variables names } damap{ } ⟺ damap{.nv=6, .xy=2, .pt=2} .mo .ko damap{.xy=3} ⟺ damap{.nv=6, .xy=3, .pt=3} .mo={3,4} .ko={1,2} .dk=2 .vn={‘x’,’y’,’k1’,’k2’} Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch damap{.pt=5} ⟺ damap{.nv=6, .xy=2, .pt=5} .vo={2,3} ∂ 4 f y ∂ 3 f y .nv=6 ⟺ .mo={xy,xy,xy,xy,pt,pt} ∂ 3 f x ∂ 3 f x ∂ 3 f x ∂ x 3 , ∂ 2 f x ∂ 3 f x , ∂ f x yes : no : ∂ y 3 , , , ; , ∂ a . .nv=5 ⟺ .mo={xy,xy,xy,xy}, .ko={pt} ∂ x 2 ∂ k 1 ∂ x 2 ∂ k 2 ∂ x ∂ k 1 ∂ k 2 ∂ k 2 ∂ k 1 ∂ k 2 2 1 2 .nv=4 ⟺ .mo={xy,xy,xy,xy} f (0) f (1) f (2) A A A GTPSA x px NV y knobs NV MO py t NV+NK pt k 1 0 0 0 0 0 0 1 � 40
BE Beams DAmap settings Department damap with planes settings damap with variables settings damap { damap { .nv=nv or 6, -- number of map variables .nv=nv -- number of mvars (replaced by #mo if array or string) .xy=no or 2, -- order for xy planes .mo=mo -- mvars orders (number, string or array) .pt=no or xy, -- order for pt plane .nk=nk -- number of knobs (replaced by #ko if array or string) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} .ko=ko -- knobs orders (number, string or array) -- variables names .dk=dk -- knobs max Xorder (number) } .vo=vo -- variables orders (string or array, variables orders) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} -- variables names } damap{ } ⟺ damap{.nv=6, .xy=2, .pt=2} .mo .ko damap{.xy=3} ⟺ damap{.nv=6, .xy=3, .pt=3} .mo={3,4} .ko={1,2} .dk=2 .vn={‘x’,’y’,’k1’,’k2’} Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch damap{.pt=5} ⟺ damap{.nv=6, .xy=2, .pt=5} .vo={2,3} ∂ 4 f y ∂ 3 f y .nv=6 ⟺ .mo={xy,xy,xy,xy,pt,pt} ∂ 3 f x ∂ 3 f x ∂ 3 f x ∂ x 3 , ∂ 2 f x ∂ 3 f x , ∂ f x yes : no : ∂ y 3 , , , ; , ∂ a . .nv=5 ⟺ .mo={xy,xy,xy,xy}, .ko={pt} ∂ x 2 ∂ k 1 ∂ x 2 ∂ k 2 ∂ x ∂ k 1 ∂ k 2 ∂ k 2 ∂ k 1 ∂ k 2 2 1 2 .nv=4 ⟺ .mo={xy,xy,xy,xy} f (0) f (1) f (2) A A A GTPSA x px NV y knobs NV MO py t NV+NK pt k 1 0 0 0 0 0 0 1 � 40
BE Beams DAmap settings Department damap with planes settings damap with variables settings damap { damap { .nv=nv or 6, -- number of map variables .nv=nv -- number of mvars (replaced by #mo if array or string) .xy=no or 2, -- order for xy planes .mo=mo -- mvars orders (number, string or array) .pt=no or xy, -- order for pt plane .nk=nk -- number of knobs (replaced by #ko if array or string) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} .ko=ko -- knobs orders (number, string or array) -- variables names .dk=dk -- knobs max Xorder (number) } .vo=vo -- variables orders (string or array, variables orders) .vn=vn or {‘x’,’px’,’y’,’py’,’t’,’pt’} -- variables names } damap{ } ⟺ damap{.nv=6, .xy=2, .pt=2} .mo .ko damap{.xy=3} ⟺ damap{.nv=6, .xy=3, .pt=3} .mo={3,4} .ko={1,2} .dk=2 .vn={‘x’,’y’,’k1’,’k2’} Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch damap{.pt=5} ⟺ damap{.nv=6, .xy=2, .pt=5} .vo={2,3} ∂ 4 f y ∂ 3 f y .nv=6 ⟺ .mo={xy,xy,xy,xy,pt,pt} ∂ 3 f x ∂ 3 f x ∂ 3 f x ∂ x 3 , ∂ 2 f x ∂ 3 f x , ∂ f x yes : no : ∂ y 3 , , , ; , ∂ a . .nv=5 ⟺ .mo={xy,xy,xy,xy}, .ko={pt} ∂ x 2 ∂ k 1 ∂ x 2 ∂ k 2 ∂ x ∂ k 1 ∂ k 2 ∂ k 2 ∂ k 1 ∂ k 2 2 1 2 .nv=4 ⟺ .mo={xy,xy,xy,xy} f (0) f (1) f (2) A A A GTPSA x px NV y knobs NV MO py t NV+NK pt k 1 0 0 0 0 0 0 1 � 40
Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch GTPSA and DAmap operations BE Department Beams � 41
BE Beams GTPSA and DAmap operations Department ๏ GTPSA operations in ℝ & ℂ ➡ getter/setter: get0/set0, get/set, get_sparse/set_sparse, getvec/setvec, clear, etc… ➡ operators: +, − , × , ÷, ^, add, sub, mul , div, pow. ➡ linear: add, sub, real, imag, conj, abs, arg, nrm, acc, scl. ➡ functions: inv, sqrt, invsqrt, exp, log, pow, (a)cos(h), (a)sin(h), (a)tan(h), (a)cot(h), erf(c). ∂ y ∂ y ∂ x ∂ p i − ∂ x = [ x , y ] = ∑ n ➡ special: scalar , eval , deriv(atives), poisson ∂ q i . Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch ∂ q i ∂ p i i =1 ➡ high-level: axpb, axpbypc, axypb, axypbzpc, ax2pby2pcz2, axypbvwpc, = log ( = log ( ax + b + cx 2 ) , y ) . x axpsqrtbpcx2, logaxpsqrtbpcx2 logxdy ➡ I/O: read, write, print. ➡ monomial ⟺ index: get_idx, get_idx_sparse, get_mono. ✓ monomial module to manipulate monomials. � 41
BE Beams GTPSA and DAmap operations Department ๏ GTPSA operations in ℝ & ℂ ➡ getter/setter: get0/set0, get/set, get_sparse/set_sparse, getvec/setvec, clear, etc… ➡ operators: +, − , × , ÷, ^, add, sub, mul , div, pow. ➡ linear: add, sub, real, imag, conj, abs, arg, nrm, acc, scl. ➡ functions: inv, sqrt, invsqrt, exp, log, pow, (a)cos(h), (a)sin(h), (a)tan(h), (a)cot(h), erf(c). ∂ y ∂ y ∂ x ∂ p i − ∂ x = [ x , y ] = ∑ n ➡ special: scalar , eval , deriv(atives), poisson ∂ q i . Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch ∂ q i ∂ p i i =1 ➡ high-level: axpb, axpbypc, axypb, axypbzpc, ax2pby2pcz2, axypbvwpc, = log ( = log ( ax + b + cx 2 ) , y ) . x axpsqrtbpcx2, logaxpsqrtbpcx2 logxdy ➡ I/O: read, write, print. ➡ monomial ⟺ index: get_idx, get_idx_sparse, get_mono. ✓ monomial module to manipulate monomials. ๏ DAmap operations in ℝ & ℂ ➡ getter/setter: get0/set0 (vector), get1/set1 (matrix). ➡ operators: + , − , × , ÷, ^, add, sub, mul, div, pow(n). ➡ special: setvar (vector+Id), eval , translate (+, − ), compose ( × ), inv (÷), pinv (partial ÷). ➡ I/O: read, write, print. � 41
BE Beams GTPSA and DAmap operations Department ๏ GTPSA operations in ℝ & ℂ ➡ getter/setter: get0/set0, get/set, get_sparse/set_sparse, getvec/setvec, clear, etc… ➡ operators: +, − , × , ÷, ^, add, sub, mul , div, pow. ➡ linear: add, sub, real, imag, conj, abs, arg, nrm, acc, scl. ➡ functions: inv, sqrt, invsqrt, exp, log, pow, (a)cos(h), (a)sin(h), (a)tan(h), (a)cot(h), erf(c). ∂ y ∂ y ∂ x ∂ p i − ∂ x = [ x , y ] = ∑ n ➡ special: scalar , eval , deriv(atives), poisson ∂ q i . Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch ∂ q i ∂ p i i =1 ➡ high-level: axpb, axpbypc, axypb, axypbzpc, ax2pby2pcz2, axypbvwpc, = log ( = log ( ax + b + cx 2 ) , y ) . x axpsqrtbpcx2, logaxpsqrtbpcx2 logxdy ➡ I/O: read, write, print. ➡ monomial ⟺ index: get_idx, get_idx_sparse, get_mono. ✓ monomial module to manipulate monomials. ~6000 lines in C ~2500 lines in MAD ๏ DAmap operations in ℝ & ℂ ➡ getter/setter: get0/set0 (vector), get1/set1 (matrix). ➡ operators: + , − , × , ÷, ^, add, sub, mul, div, pow(n). ➡ special: setvar (vector+Id), eval , translate (+, − ), compose ( × ), inv (÷), pinv (partial ÷). ➡ I/O: read, write, print. � 41
BE Beams GTPSA performance (vs. Berz and Yang) Department Fig. 6: Relative performance of the compositions. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Fig. 5: Relative performance of the multiplications. Fig. 4: Relative performance of multiplication at or- Fig. 2: Relative performance of indexing functions. der 2 when using GTPSA with 6 variables and many knobs vs. homogeneous TPSA. � 42
BE Beams GTPSA performance (vs. Berz and Yang) Department Fig. 6: Relative performance of the compositions. Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, laurent.deniau@cern.ch Fig. 5: Relative performance of the multiplications. The smaller the better! Fig. 4: Relative performance of multiplication at or- Fig. 2: Relative performance of indexing functions. der 2 when using GTPSA with 6 variables and many knobs vs. homogeneous TPSA. � 42
BE Beams MAD ecosystem Department Legend A exposes B A is-a B A uses B Objects Commands Geo/LinAlg Dyn/DiffAlg Done Dev Todo A B A B A B Algorithms MAD-NG Solvers, Eigen, Core Unit Tests FFT, Optimisers (VM+JIT+FFI) Plot MTable Linear ToolBox Match Real & Complex Laurent Deniau, CERN BE/ABP, 1211 Geneva, laurent.deniau@cern.ch Vector & Matrix Survey MADX Env Object Model COCorrect Commands Geometric Elements 2019 3D Maps Beam COFind Symplectic Sequence Integrators DA Toolbox Emit Track Real & Complex Dynamic Twiss GTPSA 6D Maps 2020 IBS 2020 Spin Maps DA Map Normal form Radiation Aperture Optical Funs 2020? 2019? 2019 � 43
BE Beams Department Legend A exposes B A is-a B A uses B Objects Commands Geo/LinAlg Dyn/DiffAlg Done Dev Todo A B A B A B Algorithms MAD-NG Solvers, Eigen, Core Unit Tests FFT, Optimisers (VM+JIT+FFI) Plot MTable Linear ToolBox Match Real & Complex Laurent Deniau, CERN BE/ABP, 1211 Geneva, laurent.deniau@cern.ch Vector & Matrix Survey MADX Env Object Model COCorrect THE END Commands Geometric Elements 2019 3D Maps Beam COFind Symplectic Sequence Integrators DA Toolbox Emit Track Real & Complex Dynamic Twiss GTPSA 6D Maps 2020 IBS 2020 Spin Maps DA Map Normal form Radiation Aperture Optical Funs 2020? 2019? 2019 � 44
Recommend
More recommend