[Back]
Block display

SAD Update V1.1.1.4k64 Operator form of functions, closed orbit finding NameFK. Oide DateF2018/04/27(Fri) 19:27:26 No.745

Changes:

1. Now "operator form" is implemented in the following functions:

Map, Apply, Append, Prepend, Extract, Insert, Delete, Position, Cases, Select, SwitchCases, SelectCases, ReplacePart.

It works as Mathematica's.

Examples:

a=-Range[10];
Map[Abs][a]
Out[1]:= {1,2,3,4,5,6,7,8,9,10}
Apply[Max][a]
Out[2]:= -1
Append[1][a]
Out[3]:= {-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,1}
Prepend[1][a]
Out[4]:= {1,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10}
Extract[{1}][a]
Out[5]:= -1
Insert[3,4][a]
Out[6]:= {-1,-2,-3,3,-4,-5,-6,-7,-8,-9,-10}
Delete[5][a]
Out[7]:= {-1,-2,-3,-4,-6,-7,-8,-9,-10}
Cases[-3][a]
Out[8]:= {-3}
Position[-3][a]
Out[9]:= {{3}}
Position[-3|-2|-5][a,1,1]
Out[10]:= {{2}}
Select[#<-5&][a]
Out[11]:= {-6,-7,-8,-9,-10}
SelectCases[{#<-5&}][a]
Out[12]:= {{-6,-7,-8,-9,-10}}
SwitchCases[{-1,-2}][a]
Out[13]:= {{-1},{-2}}
ReplacePart[1->{2}][a]
Out[14]:= {{2},-2,-3,-4,-5,-6,-7,-8,-9,-10}

2. ReplacePart can be called by 2 arguments, with the rule or list of rules as the second argument. This is same as Mathematica's and more convenient and efficient than before. Calling with 3 arguments as before is still OK.

Examples:
ReplacePart[a,{{5},{7}}->{1}]
Out[17]:= {-1,-2,-3,-4,{1},-6,{1},-8,-9,-10}
ReplacePart[a,{5->{1},7->{2}}]
Out[18]:= {-1,-2,-3,-4,{1},-6,{2},-8,-9,-10}
ReplacePart[a,{{5}->{1},{7}->{2}}]
Out[19]:= {-1,-2,-3,-4,{1},-6,{2},-8,-9,-10}
ReplacePart[a,{5,7}->{1}]
???General::toomany: Too many indices in ReplacePart[{-1,-2,-3,-4,-5,-6,-7,-8,-9,-10},{5,7}->{1}]
ReplacePart[a,{}]
Out[20]:= {-1,-2,-3,-4,-5,-6,-7,-8,-9,-10}
ReplacePart[a,{1},5]
Out[21]:= {-1,-2,-3,-4,{1},-6,-7,-8,-9,-10}
ReplacePart[a,{1},{{5},{7}}]
Out[22]:= {-1,-2,-3,-4,{1},-6,{1},-8,-9,-10}

3. The closed orbit finding in Emittance and CALC6D is modified in the case of RFSW+NORADCOD+NORADTAPER. Now it tries NORFSW first to guess the equilibrium DZ.

- WebForum -