Recent SAD Mails


Send any comments to ICFA@kekvax.kek.jp

SAD back to SAD Home Page



4-NOV-1998 07:34:13.25
From:   KEKVAX::OIDE
To:     @SADUSERS.
CC:     OIDE
Subj:   SAD Update.   V1.0.7.9.2b.   SetElement, Element.

   Dear Users:

1. SetElement[element, type, key->value,...] now assigns values of keys to
the working buffer of the element, when the element exists in the current beam
line.   Before this change it only changed the saved buffer, and was confusing.

2. Setting numbers to Element now accepts lists as the arguments.

   Element[{keya, keyb, ..}, element] = {va, vb, ..}
   Element[key, {element1, element2, ..}] = {v1, v2, ..}
   Element[{keya, keyb, ..} {element1, element2, ..}] =
     {{va1, va2, ..}, {vb1, vb2, ..}}

are all valid.

K. Oide

15-OCT-1998 16:31:41.18 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.7.8.15b. Option Inverse in SingularValues. Dear Users: 1. An option Inverse has been added to SingularValues. Usage: {u,w,v} = SingularValues[a, Tolerance->e, Inverse->inv] where e is a real number to determine the tolerance of SVD (default: 1e-8), and inv is either True or False. The matrix a is expressed as a = Transpose[u].DiagonalMatrix[W].v . If Inverse->True (default), w contains the vector W^-1. If Inverse->False, w contains the vector W, and e does not affect the result. K. Oide
5-OCT-1998 17:20:50.11 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: Erratum on the rotation angle and SKn of MULT. Dear Users: 1. The relation between the rotation angle and SKn of MULT was wrong again in the previous mail. The right one is: If a magnet with Kn = v and SKn = 0 is rotated around z-axis by -90/(n+1) degree, which is done by ROTATE = 90/(n+1) DEG, it is equivalent to a magnet with Kn = 0 and SKn = v . K. Oide
5-OCT-1998 17:14:34.31 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.7.8.7b. SK1 in MULT, etc. Dear Users: 1. Now MULT element accepts SK1 (skew quadrupole) as a keyword. It used to be expressed only by ROTATE, but now both SK1 and ROTATE are accepted. 2. The definition of the rotation angle of SKn of MULT written in the web page has been wrong. The right one is: If a magnet with Kn = v and SKn = 0 is rotated around z-axis by 90/(n+1) degree, it is equivalent to a magnet with Kn = 0 and SKn = v . K. Oide
22-SEP-1998 21:53:50.74 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.7.8.2b. Multi-variable function in Fit. Dear Users: 1. Fit now accepts multi variable functions. Usage: Fit[data, fun, {x, y, ...}, params] data is a list of { {{x1, y1, ...}, f1}, {{x2, y2, ...}, f2},...} . fun is a function containing variables x, y, ... {x, y, ...} is a list of variables. params is a sequence of fitting parameters. The usage with single variable function is unchanged. K. Oide
20-SEP-1998 12:37:26.39 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.7.8b. Bitwise operations, etc. Dear Users: 1. Functions BitwiseAnd, BitwiseOr, BitwiseXor have been added. They do bitwise operations after converting Real or Complex to integers. Now an integer is 32-bit. They are also Listable. 2. Scale->Date is added in plotting functions. It interpretes the axis as a number of seconds since 1/1/1900 0:0:0, which can be given by FromDate function. Scale->Date changes the tick label in an appropriate format to represent the time. (Note that if you want to apply this for x-axis, you should write Scale->{Date,Linear} or Scale->{Date,Log}. As the default, Scale->Date means Scale->{Linear, Date}). 3. Now we can get the Date with tick less than a second. By an option Tcik->tick. For instance, Date[Tick->0.001] returns {year,month,day,hour,minute,second}, but second has fraction down to milisecond. Also DateString[Tick->tick] converts the current date with fraction of seconds. 4. DateString accepts an argument either a real number of a list of {year,month,day,hour,minute,second}. In this case it returns a string to represent the date given by the argument. Otherwise it returns a string for the current date. 5. A bug in SelectCases has been fixed. 6. A bug in releasing the memory, which is used in SetPart, etc., has been fixed. K. Oide
24-AUG-1998 06:11:06.21 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.7.7.13b. HistoPlot, etc. Dear Users: 1. A new function HistoPlot has been introduced. Usage: HistoPlot[data, options, ...] plots a histogram using ColumnPlot(default) or ListPlot. Data can be a single list, or list of lists, which results in a multi-column histogram on a common axis. Besides options common for all plotting functions and ColumnPlot, it has its own options: Option Value Default Action --------------------------------------------------------------------------- Bins number Automatic number of bins BinRange {min,max} Automatic Range of bins PlotStyle ColumnPlot ColumnPlot plot function ListPlot Orientation Vertical Vertical orientation of columns Horizontal An example is in ~oide/WORK/oldsad/sad/histo.sad . 2. ColumnPlot accepts a new option ColumnLabel. Usage: ColumnPlot[data, options, ...] plots a column plot. 1) If data is a 1D vector, it makes a simple column plot. 2) If data is a 2D matrix, it makes a multiple-column plot. 3) If data is a 3D list, it makes a stacked, multiple-column plot. Besides options common for all plotting functions, ColumnPlot has its own options: Option Value Default Action --------------------------------------------------------------------------- ColumnOffset 0 21-AUG-1998 10:51:40.01 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.7.7.9b. InitialOrbits, WakeFunction, etc. Dear Users: 1. InitialOrbits now accepts all Twiss parameters, not only orbits. Usage: InitialOrbits={{ax1,bx1,nx1,ay1,by1,ny1, ex1,epx1,ey1,epy1,r11,r21,r31,r41, dx1,dpx1,dy1,dpy1,dz1,ddp1, 0,0,0,0,0,0,0}, ...} or InitialOrbits = {{dx1,dpx1,dy1,dpy1,dz1,ddp1}, ...} . The former is the new one. If you specify 27 components, you can set all initial conditions of each orbit. dx1,...ddp1 are given as the offset to the initial conds of MARK (DXI, etc.). 2. Routines for CAVI and MULT are changed. Now the number of division is 1+min(omega/c*L,Sqrt((VOLT/E)^2/3/EPS)), where EPS defaults 0.01. As the result the speed of optics calculation with them increased drastically, esp. for the case with WakeFunction. 3. A new variable NBUNCH is defined to mean number of bunches in a train. This is used in WakeFunction calculation. 3. A bug of Canvas not to draw tick marks was fixed. 4. Class now accepts UpValue definition (operator override). If A class method is given as This/:f:=g, it defines the UpValue for an instance. For example, This/:Times[This,a___]:=Times[val,a] defines c*x as c@val*a , giving val as an instance variable. K. Oide
6-AUG-1998 11:13:02.62 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.7.7b. Class, KEKBDatabase.BACK Dear Users: 1. An environment for an object-oriented programming in SADScript is given by a function Class: Usage: a = Class[ list of superclasses, list of class-variables, list of instance-variables, class-methods]; Example: a = Class[ {aa, bb}, (* aa and bb are superclasses *) {a1, a2}, (* class-variables *) {v1, v2}, (* instance-variables *) Constructor[arg] := (Print[arg]; v1 = Plus@@arg); sum[] := v1 + v2 (* defining Constructor and method "sum"*) ]; a1 = a[1, 2] (* creating an instance of a *) a1@v1 (* accessing an instance variable *) a1@v2 = 3 (* setting an instance variable *) a1@sum[] (* calling a method "sum" *) a1=. (* delete the instance *) Description: Class: The function to define a class. context: A class defines a context to define its all symbols for the variables and methods within the context. This automatically avoids conflicts of symbols between classes, Global, and System. When c = Class[ ... ] is done, a context c` is defined. members: Members of a class is a union of class variables, instance variables, and class methods of the class. operator @: A special operator to access class member. In a notation f@g, g's context defaults the class of the class of f. f@g@h[x] is recognized as ((f@g)@h)[x] , thus the context of h defaults the class of f. superclasses: A class inherits all class variables, instance variables, class methods from its superclasses which are give by the first argument of Class. If a null list is given, Object` is set as the default superclass. Multiple inheritance is allowed. class variable: Class variables are given by the second argument of Class as a list of symbols. They are unique in the class. They can be initialized by declaring in a way such as {a=1, {b, c} = {2, 3}} like Module. instance variable: Instance variables are given by the third argument of Class as a list of symbols. An instance have those symbols separately. They can be initialized by declaring in a way such as {a=1, {b, c} = {2, 3}} like Module. Also they are initialized at the creation of instance by rules as x = c[ a->1, b:> Print[d]], etc. class methods: Class methods are given by the fourth(last) argument of Class. They must be in the form of either f_[arg___] := g_; h_[f_[arg___], b___] ^:= g_; . where f is the symbol for the method to be defined. This: A symbol This in the definition of the method, it is translated to the object (the instance or the class) which refers the member. default reference: In the definition of the class methods, whenever a member of the class is appeared, it is recognized as This@member. When a symbol of the member conflicts the symbol in System`, the system symbol should be wrapped by Literal. reference of member of superclasses: Members of the superclasses (denote cc) are refered by cc`member in the definition of the method. Constructor: When an instance is defined, by x = c[arg], a method x@Constructor[arg] is always invoked. One can configure Constructor[] in the definition of the class. Destructor: An instance x is cleared by (x=.), which invokes x@Destructor[]. The default Destructor is Object`Destructor, but one can reconfigure it in the definition of the class. Short: When an instance x is returned as the result of expression for Out[], x@Short[] is invoked to show the result. The default Short is Object`Short, but one can reconfigure it in the definition of the class. other methods: Parents[] give the immediate superclasses. AllParents[] gives the all supreclasses. 2. An access to the KEKB database(Oracle) has become possible by data = KEKBDatabase[nameoftable] where nameoftable is the name of database table, and data is an instance of the class KEKBDatabase. Then data@Data contains the matrix of the data in the databese, and data@Description is a list of description of each column. Example: table = KEKBDatabase["BT.MAGNET"] 3. New functions BeginPackage, EndPackage, Begin, End have been defined. They are same as Mathematica's. Also $Context and $ContextPath have been introduced. All are used to define contexts of symbols. A full notation for a symbol is `context1`context2`...`symbol. All system symbols belongs to `Symbol, and users symbols are in ` , which is equivalent to Global`. As written above, a class defines a context under `. K. Oide
8-JUL-1998 23:36:08.69 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.7.6.11b. AccelerateParticles. Dear Users: 1. A new function AccelerateParticles has been introduced to simulate an acceleration in a storage ring. This is just the ver trial version, so please try it and send me your feedback about it. Usage: beam1 = AccelerateParticles[ beam, momentum, {n, nturn}, options]; where beam: initial particles data, in the same format as TrackParticles: {1, {{x1,..},{px1,..},{y1,..},{py1,..},{z1,..},{dp1,..},{flag1,..}}}. beam1: final beam data. momentum: an expression which contains n to give the MOMENTUM at the n-th turn. n: a symbol to represents the turn number. nturn: total number of turns. options: If Synchronize:>fun is specified, fun[n, beam] is called just before the n-th turn. This is useful to set various rf parameters or to monitor the particles at each turn. Remarks: 1. MOMENTUM is set to the new value at the beginning of line, in every turn. 2. Coordinates of particles are renormalized at the beginning of line. according to the new MOMENTUM. 3. MOMENTUM remains at the flat-top on exit of AccelerateParticles. Example: beam = AccelerateParticles[beam,1e9+n*1e7,{n,100}, Synchronize:>(Print[{#,#2[[2,{5,6},1]]}]&)]; K. Oide
3-JUL-1998 13:05:38.51 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.7.6.7b. Spline. Dear Users: 1. A new function Spline has been introduced for cubic-spline interpolation. Usage: sp = Spline[list] where list contains data in the form as {{x1,y1}, ..} or {{x1,{y11, y12, ..}}, ..}. Complex number can be allowed for y, but not for x. The resulting data of the spline is assigned sp as a SplineData object. Then one can calculate the interpolated data by sp[x] value of y at x. Derivative[1][sp][x] value of y' at x. Derivative[2][sp][x] value of y'' at x. This spline sets y''=0 at the boundary. K. Oide
27-JUN-1998 07:47:07.47 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.7.6.1b. Dear Users: 1. A bug was created about 10 days ago, in Append/Prepend to zero-length list. I caused a problem in KBFOpenDialog, etc. 2. The interrupt key now always kills SAD process. K. Oide
13-APR-1998 17:00:14.63 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.7.2.3b. GridLines. Dear Users: 1. A new option GridLines has been defined to draw grid line in all plotting functions. Usage: GridLines -> None : no grid lines GridLines -> Automatic : grid lines in x and y GridLines -> {Automatic, None} : grid lines in x GridLines -> {None, Automatic} : grid lines in y The location of glid lines are at the major ticks, and unchangeable in the current version. K. Oide
12-APR-1998 14:50:09.22 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.7.2.2b. EvenQ, OddQ, hexadecimal notation. Dear Users: 1. New functions EvenQ and OddQ are installed. 2. A notation that begins with "0x" means a hexdecimal number. You can also include a period to denote a hexadeciaml point, but no "E" notation for exponent is allowed. Examples: 0xabcde Out[4]:= 703710 0x2.8 Out[5]:= 2.5 K. Oide
31-MAR-1998 13:13:33.77 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.7.1b. RegExp, SetPart, etc. Dear Users: 1. A regular expression can be used in anywere instead of SAD's wild card. To use regexp, say $WildCard="RegExp"; To return to SAD's wild card, say $WildCard="SAD"; SAD's wild card is the default. 2. The l.h.s. of SetPart now can be multiple elements. Example: b=a={{1,2,3},{4,5,6}}; b[[1,{2,3}]]=0;b Out[4]:= {{1,0,0},{4,5,6}} b=a; a[[,2]]=0;a Out[5]:= {{1,0,3},{4,0,6}} b=a; a[[1,{2,3}]]={-1,-2};a Out[6]:= {{1,-1,-2},{4,0,6}} 3. The index for MapAt, ReplacePart, Insert, Delete can be Null, like as Part, to represent all possible indices at the column. Example: a={{1,2,3},{4,5,6}}; ReplacePart[a,0,{,2}] Out[4]:= {{1,0,3},{4,0,6}} K. Oide
26-MAR-1998 19:53:43.70 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.7b. Explicit dependences between keyword, D, etc. Dear Users: 1. Now we can specify relations between values of keywords of different elements or components using ElementValues. ElementValues is a symbol to assign rules to determine values of keywords of elements or components. This is used to give a dependence between keywords of different elements or components, or determine then by a parameteric expression. Useage: ElementValues = { key@elem :> expr, ...} where key: keyword to specify a value (string). elem: String to specify the elements or components, wildcards are allowed. expr: an expression which returs a real number to be set to the elements or components. Example: ElementValues = { "DX"@"QF1" :> "DX"@"QD1"-0.001, "DY"@"QF2.3" :> -"DY"@"QD1.2", "ROTATE"@"QF*" :> f[x] } Remarks: a) Iff elem contains ".", it is recognized as components, otherwise as elements. b) In the r.h.s. of thr rule, an expression like key@elem is evaluated as either LINE[key, elem] or Element[key, elem], depending on elem has ".". c) The expression expr can be any expression returing a real number. d) Later rules overrides the former, if many rules apply the same keyword of the same element. e) The rule given by ElementValues overrides the relations given by the COUP_LE command. f) a@b is always identical to a[b] (nothing to do with ElementValues). 2. New functions D and Derivative have been introduced. They should work as Mathematica's, though the applicable functions are limited and the speed is slow because it does not have any dedicated compiled codes. 3. Some problems related to fitting the initial conditions have been fixed. 4. Many features of KBFrame have been continuously updated. Please look at http://faraday.kek.jp/KEKBFrame/contents.html . K. Oide
14-MAR-1998 00:33:54.10 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.6.5b. Bug in Write and Print, etc. Dear Users: 1. A bug was found in allocation of internal string buffer. Functions Write, WriteString, and Print were affected so that the output strings were distructed for arguments except the last one, when the length of the output line is close to the value of PageWidth. 2. When two magnets of a smae type are placed without any other elements except DRIFT with zero length, MARK, or SOL, those magnets are recognized as a single unit of magnet. Then if a keyword of the first magnet is touched by a command as QF DX 0.005 , then the value of DX has been transferred to the next adjacent magnet automatically. This feature is somewhat convenient, but works in a very strange way when the keyword is none of DX, DY, ROTATE. (For instance E1 or E2 of BEND). Thus now we restrict this feature only to DX, DY, and ROTATE. Anyway such automatic dependences hiddle to user are very problematic and will be completely removed in near future, or replaced with a mothod to specify dependences explicitly. K. Oide
2-MAR-1998 14:01:01.93 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.6.2.7b. Change in SetElement. Dear Users: 1. SetElement has been changed so that the first value is taken when two values are specified for a same keyword. It used be the last value, but was a little bit confusing. K. Oide
27-FEB-1998 10:41:27.98 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.6.2.5b. MONI in TYPE. Dear Users: 1. MONI element is now recognized as a regular element, such as magnets, and can be output by TYPE commands, etc. Also a new keyword ROTATE is added to MONI, yet its roll is not defined. K. Oide
26-FEB-1998 18:54:50.30\ From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.6.2.2b. Fourier for any length. Dear Users: 1. Now Fourier and InverseFourier accepts a list of any length, not necessary to be 2^n. (Before now it padded zeros after data if it is not 2^n.) Now we use K. Yokoya's routine to generalize the length. Benchmark of Fourier on acsad2 (CPU time in msec): Length Type SAD Mathematica2.2 ------------------------------------------------- 1920 Real 2.20 33.2 1920 Complex 2.77 36.1 2048 Real 2.15 16.4 2048 Complex 2.70 19.6 2304 Real 2.58 42.6 2304 Complex 3.48 46.0 K. Oide
20-FEB-1998 14:31:41.22 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.6.2b. Bug in SetPart. Dear Users: 1. A bug in SetPart was corrected. This bug returned a wrong value as the result of SetPart. It was made last week, on 2/12. K. Oide
17-FEB-1998 12:37:06.65 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.6.1.3b. Bug in Depth. Dear Users: 1. A bug found in Depth. It returns a wrong value in most cases. This bug was created on 12/24/1997. K. Oide
12-FEB-1998 20:05:38.95 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.6.1.2b. New functions. Dear Users: 1. New functions Arg, Negative, NonNegative, Positive, RotateLeft, RotateRight are added. They should be same as Mathematica's. K. Oide
19-JAN-1998 20:30:03.56 From: KEKVAX::OIDE To: @SADUSERS. CC: OIDE Subj: SAD Update. V1.0.6b. Faster SADScript, etc. Dear Users: 1. The routines for SADScript interpreter have been widely updated to speed up by about 40%. (The CPU upgrade of acsad2 also accelerated SAD). 2. Bugs in Drop and Reverse, when applied to a real list, have been fixed. 3. Tkinter has been upgraded to show rotated texts, dashed lines, etc. K. Oide