92
W. Herr and E. Forest
When we push f (x) = (a, 1, 0, 0, 0 . . .) through the algorithm, using our rules,
we get all derivatives around a, i.e. we get the Taylor coefficients and can construct
the map!
What is needed is to replace the standard operations performed by the computer
on real numbers by the algebra defined above. The maps are provided with the
desired accuracy and to any order.
Given a Taylor series to high accuracy, the wanted information about stability of
the system, global behaviour and optical parameters can be derived more easily. It
should be stressed again that the origin is the underlying tracking code, just acting
on different data types with different operations.
3.7.6.7 Differential Algebra: Simple Example
A simple example is shown below where the original “tracking code” is shown
in the left column (DATEST1) and the corresponding modified code in the right
column (DATEST2). The operation is rather trivial to demonstrate the procedure
more easily. The code is written in standard FORTRAN 95 which allows operator
overloading, but an object oriented language such as C++ or Python are obviously
well suited for this purpose. Standard FORTRAN-95 is however more flexible
overloading arbitrary operations. The DA-package used for demonstration only is
loaded by the command use my ownda in the code. To make the program perform
the wanted operation we have to make two small modifications:
1. Replace the types real by the type my taylor (defined in the package).
2. Add the “differential unit” (0, 1), the monomial in this implementation to the
variable.
PROGRAM DATEST1
use my_own_da
real(8) x,z, dx
my_order=3
dx=0.0
x=3.141592653_8/6.0_8+dx
call track(x, z)
call print(z,6)
END PROGRAM DATEST1
SUBROUTINE TRACK(a, b)
use my_own_da
real(8) a,b
b = sin(a)
END SUBROUTINE TRACK
PROGRAM DATEST2
use my_own_da
type(my_taylor) x,z, dx
my_order=3
dx=1.0d0.mono.1 ! this is our (0,1)
x=3.141592653_8/6.0_8+dx
call track(x, z)
call print(z,6)
END PROGRAM DATEST2
SUBROUTINE TRACK(a, b)
use my_own_da
type(my_taylor) a,b
b = sin(a)
END SUBROUTINE TRACK
Running these two programs we get the results in the two columns below. In the
left column we get the expected result from the real calculation of the expression
W. Herr and E. Forest
When we push f (x) = (a, 1, 0, 0, 0 . . .) through the algorithm, using our rules,
we get all derivatives around a, i.e. we get the Taylor coefficients and can construct
the map!
What is needed is to replace the standard operations performed by the computer
on real numbers by the algebra defined above. The maps are provided with the
desired accuracy and to any order.
Given a Taylor series to high accuracy, the wanted information about stability of
the system, global behaviour and optical parameters can be derived more easily. It
should be stressed again that the origin is the underlying tracking code, just acting
on different data types with different operations.
3.7.6.7 Differential Algebra: Simple Example
A simple example is shown below where the original “tracking code” is shown
in the left column (DATEST1) and the corresponding modified code in the right
column (DATEST2). The operation is rather trivial to demonstrate the procedure
more easily. The code is written in standard FORTRAN 95 which allows operator
overloading, but an object oriented language such as C++ or Python are obviously
well suited for this purpose. Standard FORTRAN-95 is however more flexible
overloading arbitrary operations. The DA-package used for demonstration only is
loaded by the command use my ownda in the code. To make the program perform
the wanted operation we have to make two small modifications:
1. Replace the types real by the type my taylor (defined in the package).
2. Add the “differential unit” (0, 1), the monomial in this implementation to the
variable.
PROGRAM DATEST1
use my_own_da
real(8) x,z, dx
my_order=3
dx=0.0
x=3.141592653_8/6.0_8+dx
call track(x, z)
call print(z,6)
END PROGRAM DATEST1
SUBROUTINE TRACK(a, b)
use my_own_da
real(8) a,b
b = sin(a)
END SUBROUTINE TRACK
PROGRAM DATEST2
use my_own_da
type(my_taylor) x,z, dx
my_order=3
dx=1.0d0.mono.1 ! this is our (0,1)
x=3.141592653_8/6.0_8+dx
call track(x, z)
call print(z,6)
END PROGRAM DATEST2
SUBROUTINE TRACK(a, b)
use my_own_da
type(my_taylor) a,b
b = sin(a)
END SUBROUTINE TRACK
Running these two programs we get the results in the two columns below. In the
left column we get the expected result from the real calculation of the expression
