Fun with Formulas ! Werner Joho Paul Scherrer Institute (PSI) CH5232 Villigen, Switzerland 4.July 2003 (updated 1.10.2010) 1 W.Joho Introduction Formulas can be fun. They often can be made to look simple, transparent and thus beautiful (in the spirit of Einstein and Chandrasekhar). This can be achieved with some simple rules and a few tricks of the trade. This paper is a sample of some simple formulas, collected during my career as a physicist. The following material was presented (but not published) at a seminar talk given at the CERN Accelerator School on Synchrotron Radiation and Free Electron Lasers, Brunnen, Switzerland, 2-9 July 2003 (this file is available on the WEB with google: „JOHO PSI“) 2 W.Joho Content • philosophy for formulas • capital growth • new interpretation of Ohm‘s law • logarithmic derivatives • the relativistic equations of Einstein • the magic triangle formed by the logarithmic derivatives of the relativistic parameters • Alternative Gradient Focusing, constructed by hand • binomial curves everywhere, approximation of a variety of functions, like beam profiles, the fringe field of magnets, the flux and brightness of synchrotron radiation etc. • simple representation of phase space ellipses • how to win money with statistics ! • design of beautiful tables with a Hamiltonian 3 W.Joho philosophy for formulas simplify formulas, they should look „beautiful“ formula should indicate the proper dimensions use units of 1'000 (cm should not exist in formulas!) choose right scales for plots (e.g. logarithmic) example: c = 3 ·108 m/s ?? better is: c = 0.3·109 m/s or 300 m/ms or 0.3 mm/ps !! for comparison of electric forces: q·Є (kV/mm) with magnetic forces: q·v·B = q·β·c·B c = 300 (kV/mm)/T !! m0 = 4p 10-7 Vs/Am ?? better is: m0 = 0.4p mH/m = 0.4p T/(kA/mm) 4 W.Joho how in in electro-dynamics how to toavoid avoidakward akwardnumbers numbers electrodynamics electron mass: m = 9.11·10-31 kg (?) => forget it ! use mc2 eUo , Uo = .511 MV o = 8.854·10-12 As/Vm (?) => forget it ! use mo o = 1/c2 with mo = 0.4 p mH/m introduce impedance Zo : Zo 1 m = 0 c = 30 4p 0 c 4p ( 29.9792458 ) Alfven current IA (used in space charge calculations): IA = 4pomc3/e (?) => forget it ! (similarly for "perveance") use instead “Ohms-law” : IA = Uo/Zo = 511 kV/30 = 17 kA charged particle in a magnetic field Bo => Larmor-frequency electron: o = e = 1.76·1011 C/kg (?) m e c2 use = = 28 GHz/T 2p m 2p U 0 e B0 m => forget it ! (15.25 MHz/T for protons) 5 W.Joho use logarithmic derivatives ! Example: Magnet Weight W of a Cyclotron: W W0 ( B )3max (W.Joho, Aarhus 1986, CERN Accelerator school) => for a plot : take logarithmic scale both for (B ) and W => take logarithm and then derivative dW d (B ) 3 W (B ) => 1% change in (B ) max gives 3% change in weight or pˆ = dp d d p 6 W.Joho Einstein Einstein triangle triangle in relativistic equations use dimensionless quantities for velocity, energy and momentum on a democratic basis! => Einstein triangle and magic triangles for logarithmic derivatives velocity: v=c total energy: E = E0 , E0 = mc2 = eU0 (0.511 MeV for electron) = (1-2)-1/2 , momentum: p = ~p E0/c = ~p mc ~p “Pythagoras”- connection: E2 = E02 + (pc)2 give the Einstein triangle and derivatives 1 ~p 2 2 ~p d~p d 1 2 1 d 3d 2 7 W.Joho „Magic Triangles” (W.Joho) with logarithmic derivatives of relativistic parameter , , ~p d~ p d d ~ p d~ p 2 d , ~ p d 2 d ~ p , d ~ d p 2 ~ p , , ~ p are treated equally democracy! d 2 d~ p ~ p ~ p2 multiplication factors form inverse triangle d 2 8 W.Joho trigonometric functions for relativistic formula ! 1 (1 2 ) 1 if sin , then cos ~ p tan (" momentum" ) 2) mildly relativistic case: use angle the following table gives some easy reference values for quick estimates or for calculations with a pocket calculator! (with use of Pythagoras triangle with sides 3,4,5) = sin cos 300 36.90 450 53.10 600 0.5 0.6 0.71 0.8 0.87 0.87 0.8 0.71 0.6 0.5 9 = 1/cos p = = tan 1.15 0.58 1.25 0.75 1.41 1 1.67 1.33 2 1.71 W.Joho highly relativistic case highly relativistic case >> 1 , 1 => use angle cos 1 – 2 / 2 1 1/ sin 1 2 2 ~p = 1/tan 1/ a) race to the moon between electron and photon: electron "looses" by L = (1 - ) L 1 L 2 2 SLS: ESRF: L 50m E 2 [GeV ] 2.4 GeV, L = 8 m 6 GeV, L = 1.4 m LEP II: 100 GeV, L = 5 mm b) race over one undulator period u : if electron is just one or n wavelengths behind photon (slippage) => positive interference L = = 1 2n 2 u (1 + K2 / 2) K = 0.0934 B[T] u [mm] detour due to slalom in B-field ! 10 W.Joho Undulator Radiation produced by an electron beam of energy E = mc2 K-edges * = 2‘500 mm * 2 ESRF SLS * = 1.5 mm u 2 K * 2 2 1 (property of undulator) 2n 2 11 W.Joho AG-focusing simple example of alternative gradient focusing: FODO-lattice with thin lenses (focal length f) if L = 2f => construction is possible by hand ! it takes 6 periods to get a 3600-oscillation i.e. the phase advance/period is = 600 exact solution with transfer matrices gives L sin 2 4f for L = 2f => = 600 (graphic example) for L = 4f => = 1800 (instability !) 12 W.Joho magnetic fringe field with binomial 1 x B( x) , u , N 1/ S (1 u ) xL xL gap , N 7 , S 3 , 3 free parameter origin of for fit x at x (80% field ) gap inverse : 1 u ( S 1)1/ N B magnet edge 1.0 B 0.8 N=7, S=-3 0.6 0.4 0.2 0.0 0 1 2 13 3 u 4 W.Joho Flux Spectrum of synchrotron radiation spectral flux F of electrons with energy E and current I from a bending magnet with magnetic field B. F = 2.46 ·1013 E[GeV] I[A] G1(x) (photons/(s ·mrad ·0.1% bandwidth) x=ε/εc , ε = photon energy , εc = critical photon energy G1 x = x x K5 3 x dx 1 G1 ~ 2.1x 1 3 0.1 c eV = 665 E 2 GeV B T 50% 0.01 ~ 1.3 x e – x 0.001 0.001 0.01 0.1 x = c x 14 1 10 W.Joho Flux-Spectrum of Synchrotron Radiation from Bending Magnet with Field B G1 x = x x K5 3 x dx 1 x g ( x ) [(1 ( ) N ] S xL Fit with G1(x) = A x1/3 g(x) , fit of binomial g(x) with 8 data points to ±1.5%: A = 2.11 , N = 0.848 , xL = 28.17 , S = 0.0513 G1 = normalized Flux 1 G1 0.1 0.01 0.001 0.001 0.01 0.1 15 1 x 10 W.Joho general binomial curves general binomial curves F(x) = Fmax y(u) , u x/xL , y(0) = 1 3 general cases : short range : s > 0 inverse (interchange n and s !): y (1 u n )1/ s , (0 u 1) u (1 y s )1/ n , (0 y 1) long range : s< 0 inverse : y (1 u n )1/ s , (0 u ) u ( y s 1)1/ n , (0 y 1) exponentials : (limit s = 0) inverse : y exp( u n ) , (0 u ) u ( ln y )1/ n , (0 y 1) 16 W.Joho Classification of binomial curves reference points for binomial curve Y 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 0.841 top mid 0.0625 0 bottom 0.5 1 Xtop 1.5 2 Xmid 2.5 Xbottom 3 X 1 x binomial : y ( x) [1 sign ( s) ( ) N ] S xL any 3 reference points will give a fit for N, S and xL. But the chosen points top, mid and bottom allow a convenient classification in the (A,B)-Diagram 1.0 square B Classifica tion of binomials in (A, B) - Diagram short range (s>0) y top 0.51/4 0.841 Gaussian 0.5 y mid 0.5 y bottom 0.54 0.0625 long range (s<0) exponentials (s=>0) 0.0 0 0.5 A 1 17 A x top x mid , B x mid x bottom W.Joho properties of of binomials properties binomials 1. y(u) = (1 un)1/s is monotonically decreasing, but transformations like F(x) = A x y(u) allow representations of functions which are not monotonic (e.g. Flux- or Brightness- curves) 2. inverse function exists : y u , n s 3. 4 free parameter: 1. Fmax gives scaling in y 2. xL gives scaling in x , (u=1) 3. n determines flatness at x = 0 4. s determines tail at large x 4. Fit to data using the 4 parameter with programs like MATLAB”, “IGOR” or “Excel” (insert , name , define) + (extras , solver) 5. (A , B) – diagram allows rough estimates of parameter n and s binomials.doc 18 W.Joho typical profiles y(u) in (A,B)-plot 1.0 13 =square 8 7 12 4 B 6 21 5 Gaussian 3 0.5 11 2 1 9 0.0 14 B=A4 16 0 0.5 1 y 1 u 13 2 y (1 u ) 2 parabola, convex 3 y 1 u triangle 4 y 1 u 5 y (1 u 2 ) 2 biquadrati c 6 y 1 u2 parabola, concave 7 y 1 u2 quarter circle 8 y 1 u4 9 10 y e 11 y e u 12 2 y e u A 1 y 1 square 1 1 u 1 15 y (1 u ) 2 1 16 y 1 u2 1 17 y Lorentzian 1 u2 1 18 y bi - Lorentzian (1 u 2 ) 2 1 19 y 1 u3 1 20 y magnetic fringe field (1 u 7 )1/ 3 1 21 y 1 u12 14 u y e u 20 17 10 15 19 18 exponentia l decay Gaussian 6 19 y W.Joho representations beam profiles binomials Representation ofofbeam profiles withwith binomials 1) Gaussian: y e1/ 2 ( x / s ) 2 2) Binomials : x y [(1 ( ) 2 ]m 1 / 2 , x xL , xL 2(m 1) s xL clipped tails at xL (e.g. m=3.5 => xL= 3s ; m=7 => xL= 4s) 1.0 y binom m=7 0.8 Gauss binom m=3.5 0.6 Profiles 0.4 0.2 0.0 -4 -3 -2 -1 0 1 2 x/s 3 4 0.20 y binom m=7 Tails of Profiles Gauss 0.15 binom m=3.5 (full width at 10% level : ≈ 4.4 σ for large range of m) 0.10 0.05 0.00 1.5 2 2.5 3 3.5 x/s 20 W.Joho clipped binomial phase space densities ( x, x ' ) (1 a 2 ) m 1 (a u v 1 , 2 2 2 projected profile : x u , xL x' v ' ) xL y ( x) (1 u 2 ) m 1/ 2 we get again a binomial with the exponent reduced by 1/2 big trick: plot fraction which is outside of ellipse! Sacherer, Lapostolle εp/ε for m1.5 the curves have a crossing point at εp ≈ ε and p ≈ 13%; i.e. ca. 87% of all particles are inside an ellipse with emittance ε=(2σ)·(2σ‘) , independent of m. For a Gaussian distribution we have p=exp(-2εp/ε), which gives a straight line in this diagram (m=). 21 W.Joho, 1980 PSI report TM 11-4 W.Joho correlations x y example: income and research for 50 US companies in 1976 (from journal „Physics Today“, march and september 1978 ) x = income / sales y = research budget / sales There are 3 possibilities to show a correlation: 1. linear fit of y(x) : income stimulates research ! 2. linear fit of x(y) : research stimulates income ! 3. correlation ellipse from <x y> : high income strong research Y= fit: y(x) fit: x(y) X= 22 W.Joho Representationofofrms-beam rms beam ellipse Representation ellipse in phase space in space (x, (x, x) x‘ ) For an arbitrary distribution of particles define the statistical values: => shift first origin such that <x> = <x> = 0 <x2> s2 , <x2> s2 , <x x> the rms-emittance is then defined as: <x2><x2> - <x x>2 the traditional representation of the rms-ellipse is given with the Courant-Snyder invariant : x2 + 2 x x + x2 = the parameter are defined by = s2/ , = s2/ , = - <x x>/ with the relation the graph representing this ellipse is akward to remember and not easy to plot! 23 W.Joho The parametric representation of the rms beam ellipse in phase space (x, x‘) use parametric representation of the rms-ellipse x = s cos (0 x = s sin ( +) 2p = "running parameter" ) but what is phase shift ? sin r12 xx' ss ' = correlation parameter (in a drift, is just the phase advance from the waist position) this representation of the rms-ellipse is easy to remember and easy to plot! ( = 0 gives a circle) s sin x s scos ssin 3 2 4 x 1 s s cos 24 W.Joho Dictionary for Beam Parameters Some useful quantities are easy to guess from the factors sin or cos ( is 0 at a waist!) and dimensional arguments (using m, mm and mrad) emittance: = ss cos [mm mrad] slope of envellope: ds/ds = s sin [mrad] virtual waist size: xw = s cos -function at virtual waist: min = (s/s) cos [mm] distance from virtual waist: Lw = (s/s) sin [m] [m] = min tan phase advance from virtual waist: = the dictionary between the 2 representations is: = - tan = - xx' ( = - x3/x1 = -x2/x4 ) 2 s =s = s ' cos ( = x2/x4 ) '2 s' =s = s cos ( = x3/x1 ) [1] [m] [m-1] (as a check : = 1/cos2 = 1 + tan2 = 1 + 2 ) 25 W.Joho Convolution of two ellipses Example: convolution of the electron beam ellipse (x1, x1), with parameter σ1,σ1’,1 and the diffraction limited photon beam (x2, x2), with parameter σ2,σ2’,2 from an undulator. Simple recipe: add variances and correlations linearly to form the combined ellipse (X,X’) with parameter , ’, <X2> = <x12> + <x22> <X2> = <x12> + <x22> <XX> = <x1x1> + <x2x2> or 2 = s12 + s22 2 = s12 + s22 sin = s1s1 sin1 + s2s2 sin2 the convoluted emittance is = cos ( 1 + 2) with the dictionary one can, if necessary, transform these values back to the Courand-Snyder values , , . 26 W.Joho e ip 1 This formula from Euler combines beautifully 3 fundamental numbers in mathematics another „gem“ from Euler is: 3 4 5 6 3 3 3 3 or from Ramanujan comes: 9 10 1 12 3 3 3 3 in the the same spirit one can write: 13 23 33 ... n3 (1 2 3 ... n)2 (n 1) 2 n 2 4 [ (n 1)n 2 ] 2 (I figured this out myself, but I am sure it exists somewhere in the literature, but I could not find yet the proper reference) 27 W.Joho treacherous predictions ! 1) If you see a series of numbers: 2, 4, 6, 8, 10, 12, … created by a formula F(n), for n=1, 2, 3, …6 you probably guess, that the next term is 14 !? Now give me the number Y, your year of birth. I give you below a formula F(n), where the next term in the series (for n=7) is not 14, but exactly Y ! F(n)=2n+ (Y-14)(n-1)(n-2)(n-3)(n-4)(n-5)(n-6)/6! -----------------------The above example was easy to construct. But what about the next treacherous example? 2) The following formula was constructed by the Swiss Physicist Leonard Euler: P(n)=n(n-1)+41 Believe it or not, but for n=1, 2, 3….up to 40 this formula gives a prime number ! It fails the first time at n=41, where P(41)=41*41=1‘681 (It then fails further at n=42, 45, 50, 57, 66 etc.) 28 W.Joho winning money with statistics ! throw simultaneously 6 dices: If all 6 dices show different numbers (1, 2, 3, 4, 5, 6) I give you 20 times your betting sum …..but chance is only 1.5% !! to be fair, I should offer you 65 times your betting sum! 5 4 3 2 1 5! 5 (p= = 5 = = 1.54% ) 6 6 6 6 6 6 324 29 W.Joho winning money with statistics ! what is the chance, that in a group of n persons, 2 people have the same birthday (disregarding the year of birth and the 29th february)? 364 363 362 (366 n) probability w 1 365 365 365 365 with 23 people the chance is already 50%, with 40 people it is 87% and with 80 people a double coincidence is a „sure bet“ and a triple coincidence has a 42% chance! Chance for double or triple birthday 1.0 0.9 0.8 double or more Chance [%] 0.7 0.6 triple or more 0.5 0.4 0.3 0.2 0.1 0.0 0 10 20 30 40 50 60 70 80 Persons 30 W.Joho exponential growth with compound interest With an interest rate of 2% it takes 35 years to double the income (50 years without compound interest) How can we get this result very quickly? For a quick estimate of exponential growth one can use: e7 ≈ 210 ≈ 103 example: With an interest rate of p(%) it takes T2 years to double an initial capital investment C0. T2 = 70 years/p(%) (70≈100 ln2) To have an increase by a factor of 1‘000 (≈210) it takes T1000 years: T1000 = 10 T2 = 700 years/p(%) 31 W.Joho Growth of Capital William Tell deposited 1 Fr. in a bank account, 700 years ago! => assume he gets 3% interest before taxes, and 2% netto after taxes The difference goes to the government (which does not pay taxes)!! after 700 years the government has 109 Fr. the descendents of William Tell „only“ 106 Fr. !? Growth of Capital 1,000,000,000 100,000,000 2% interest 10,000,000 3% interest 1,000,000 difference 100,000 value 10,000 1,000 100 10 1 0 0 100 200 300 400 500 600 700 year 32 W.Joho „Hamiltonian Table“ 5 You want to construct a nice table for your living room with 4this shape? 3 2 1 0 -5 -4 -3 -2 -1 0 1 2 3 4 -1 -2 -3 -4 -5 33 W.Joho „Hamiltonian“ Plots Try to plot a curve F(x,y)=const.=c , where F(x,y) can be quite complex like x y F ( x, y ) ( ) n ( )n S x S y x y a b x y G exp[ ( ) 2 ] G exp[ ( ) 2 ] x y L L x y One method is to choosea certain x and then solve the corresponding nonlinear equation for y with iterative methods. Then repeat thi s procedure for the next choice of x. A more elegant method is the following : 1) Pretend that the function f(x, y) is a Hamilton ian H(x(t), y(t)) 2) Solve the equations of motion (e.g. with the Euler - Cauchy integratio n or the Runge - Kutta method . x H , y y H , x To get some initial conditions one can choosee.g. y0 0 and then solve f(x ,0) c to get the corresponding x0 . 0 The beauty of this method : For a given integratio n step dt the points x(t), y(t) move smoothly along the desired function F(x, y). 34 W.Joho Example of „Hamiltonian“ Plots with F(x,y)=const. x y x y F ( x, y) ( )n ( )n S x x S y y Gx exp[( )2 ] G y exp[( ) 2 ] a b Lx Ly 5 5 4 4 3 3 2 2 1 1 0 -5 -4 -3 -2 -1 0 1 2 3 4 5 0 -5 -4 -3 -2 -1 0 1 2 3 4 5 -1 -1 -2 -2 5 -3 4 -4 3 -5 -3 -4 -5 2 1 1 0 -4 -3 -2 -1 4 3 2 -5 5 0 1 2 3 4 5 0 -1 -5 -4 -3 -2 -1 0 -2 -1 -3 -2 -4 -3 -5 -4 1 2 3 4 5 You want to construct a nice table for your living room with one of these shapes? I give you the corresponding parameters for a modest royalty! -5 35 W.Joho „real fun“ with formulas ! two very famous equations are: a2 + b2 = c2 Pythagoras (500 BC) E = mc2 Einstein (1905) with some easy Algebra we get: a2 + b2 = E/m Pythagoras–Einstein-Joho (2008) The Swiss physicist Paul Scherrer gave a beautiful analogy for the famous Einstein equation: „This energy E (=mc2) is deposited on a blocked bank account“! (this analogy is mentioned by the author Max Frisch in his book „Stiller“) 36 W.Joho Varia 37 W.Joho photon energy wavelength use of magic numbers to memorize the relation = 1240 eV nm (=hc) trick => take square root ! VUV-region 35 eV 35 nm soft X-rays 1.1 keV 1.1 nm „old fashioned“ 3.5 keV 3.5 Å „infrared-people“ use wavenumber k in [cm-1] 100 cm 100 mm -1 (correlations for arbitrary numbers are then quickly estimated by multiplication resp. division) 38 W.Joho Graphical solution of the lens equation the lens equation (Newton) solved for a thin lens with focal length f 1 1 1 = + f u v symmetric case: u = v = 2f same graph for resistances in parallel, capacitances in series etc.! 39 W.Joho Brightness of Synchrotron Radiation from Bending Magnet with Field B x H 2 ( x) x K ( ) , 2 2 2 2/3 h( x ) exp[ ( Fit with H2(x) = A x2/3 h(x) , x N ) ] xL fit of binomial h(x) with 8 data points to ±2%: A = 2.95 , N = 1.11 , xL = 1.336 H2 = normalized Brightness 10.000 H2 1.000 0.100 0.010 0.001 0.001 0.01 0.1 1 10 x 40 W.Joho binomials short range binomials (s>0) N 1/S Y = (1-u ) Y short range binomials (s>0) , u = x/xL 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 Y = (1-uN)1/S , u = x/xL Y case 1, N=0.5, S=1 case 2, N=1, S=0.5 case 3, N=1, S=1 case 4, N=1, S=2 0 0.5 1 1.5 2 2.5 3 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 case 5, N=2, S=0.5 case 6, N=2, S=1 case 7, N=2, S=2 case 8, N=4, S=2 0 3.5 x 4 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 X 2 exponentials (s=0) Y Y =exp (-uN) , u = x/xL 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 case 9, N=0.5 case 10, N=1 case 11, N=2 case 12, N=6 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 x Y 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 long range binomials (s<0) long range binomials (s<0) N 1/S Y = (1+uN)1/S , u = x/x L Y = (1+u ) , u = x/xL Y case 14, N=1, S= -1 case 15, N=1, S= -0.5 case 16, N=2, S= -2 case 17, N=2, S= -1 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 x 41 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 case 18, N=2, S= -0.5 case 19, N=3, S= -1 case 20, N=7, S= -3 case 21, N=12, S= -2 0 0.5 1 1.5 2 2.5 3 3.5 x 4 W.Joho Heart Motor Who is more reliable, your heart or the motor of your car ? Assumptions: • a car makes about 200’000 km with an average speed of 40km/h => runs for about 5’000 h or 300’000 min. • the motor runs at an average of 2’000 cycles/min => the motor makes about 0.6 ·109 cycles, If you live 80 years, your heart has made about 2.5 ·109 heart beats => your heart will make about a factor 4 more cycles than the motor of a car!! by the way: during your life you experience some special dates: after ≈ 11 years and 41 weeks you lived 100’000 h after ≈ 27 years and 20 weeks you lived 10’000 days after ≈ 31 years and 36 weeks you lived 109 s 42 W.Joho