トップ «前の日記(2008-03-31) 最新 次の日記(2008-04-02)» 編集

Orz日記 by Akio Morita

ToDo:

  • 15 SAD Fit[]回りの障害事例の解析
  • 10 smart pointer版PEGクラスの再実装(Left Recursionまわり)
2006|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|06|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|07|08|09|10|11|12|
2013|01|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|06|07|08|10|12|
2016|01|02|03|05|06|08|10|11|
2017|01|02|03|04|05|06|07|09|10|11|12|
2018|01|02|03|04|06|07|08|09|10|11|12|
2019|01|03|04|05|07|08|09|10|11|12|
2020|01|02|03|04|05|06|07|08|09|10|11|12|
2021|01|02|03|04|05|06|07|08|09|10|11|12|
2022|01|02|03|04|05|06|07|08|09|10|11|12|
2023|01|02|03|04|05|06|07|08|09|10|11|12|
2024|01|02|03|04|05|06|07|08|09|10|11|

2008-04-01 [長年日記]

_ [SAD]SlotSequenceバグ

Function[]に包まれないSlot[]は、

 In[1]:= {#}
???General::slot:  Undefined Slot #1:
{#}
   ^
 ???-FFS-Error-?Undefined command or element: {#}

のように、きちんとsemantics errorになるが、 Function[]に包まれないSlotSequence[]は、

 In[1]:= {##}
セグメントエラー(coreを出力しました)

のように、segmentation faultになる

_ [SAD]実数リテラルのIEEE754内部表現への変換精度

この結果は、あなたの予想通りですか?

FFS;
l = {
  11.11111111111,
  11.111111111111,
  11.1111111111111,
  11.11111111111111,
  11.111111111111111,
  11.1111111111111111,
  11.11111111111111111,
  11.111111111111111111,
  11.1111111111111111111,
  11.11111111111111111111,
  11.111111111111111111111,
  11.1111111111111111111111,
  11.11111111111111111111111,
  11.111111111111111111111111,
  11.1111111111111111111111111,
  11.11111111111111111111111111,
  11.111111111111111111111111111,
  11.1111111111111111111111111111,
  11.11111111111111111111111111111,
  11.111111111111111111111111111111,
  11.1111111111111111111111111111111,
  11.11111111111111111111111111111111,
  Null[]};
Scan[With[{a = #}, Print[Map[SameQ[a, #]&, l]]]&, l]; Exit[];
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
{0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
{0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
{0,0,0,1,0,0,0,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1}
{0,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0}
{0,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0}
{0,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0}
{0,0,0,1,0,0,0,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1}
{0,0,0,1,0,0,0,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1}
{0,0,0,1,0,0,0,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1}
{0,0,0,1,0,0,0,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1}
{0,0,0,1,0,0,0,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1}
{0,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0}
{0,0,0,1,0,0,0,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1}
{0,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0}
{0,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0}
{0,0,0,1,0,0,0,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1}
{0,0,0,1,0,0,0,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1}
{0,0,0,1,0,0,0,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1}
{0,0,0,1,0,0,0,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1}
{0,0,0,1,0,0,0,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1}
{0,0,0,1,0,0,0,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1}

何が問題か分からないかった人は次のサンプルをご覧有れ!

String2RealConvTest[max_Real:40] := Module[{reference, min, loop, s, i},
  reference = 1 / 11;
  s = "0.";
  loop = "09";
  min = 1;

  Table[(s = s//loop[1 + Mod[i - 1, StringLength[loop]]];
    Print[StringFill[s, " ", max + 2], " - 1 / 9 -> ",
      ToExpression[s] - reference]), {i, min, max}]];

String2RealConvTest[]; Exit[];
0.0                                        - 1 / 9 -> -.090909090909091
0.09                                       - 1 / 9 -> -9.090909090909E-4
0.090                                      - 1 / 9 -> -9.090909090909E-4
0.0909                                     - 1 / 9 -> -9.090909090917E-6
0.09090                                    - 1 / 9 -> -9.090909090917E-6
0.090909                                   - 1 / 9 -> -9.090909090792E-8
0.0909090                                  - 1 / 9 -> -9.090909090792E-8
0.09090909                                 - 1 / 9 -> -9.09090913659E-10
0.090909090                                - 1 / 9 -> -9.09090913659E-10
0.0909090909                               - 1 / 9 -> -9.09090858148E-12
0.09090909090                              - 1 / 9 -> -9.09090858148E-12
0.090909090909                             - 1 / 9 -> -9.0913387929E-14
0.0909090909090                            - 1 / 9 -> -9.0913387929E-14
0.09090909090909                           - 1 / 9 -> -9.15933995316E-16
0.090909090909090                          - 1 / 9 -> -9.15933995316E-16
0.0909090909090909                         - 1 / 9 -> -1.38777878078E-17
0.09090909090909090                        - 1 / 9 -> -1.38777878078E-17
0.090909090909090909                       - 1 / 9 -> 0
0.0909090909090909090                      - 1 / 9 -> 0
0.09090909090909090909                     - 1 / 9 -> 0
0.090909090909090909090                    - 1 / 9 -> 1.387778780781E-17
0.0909090909090909090909                   - 1 / 9 -> 1.387778780781E-17
0.09090909090909090909090                  - 1 / 9 -> 1.387778780781E-17
0.090909090909090909090909                 - 1 / 9 -> 1.387778780781E-17
0.0909090909090909090909090                - 1 / 9 -> 2.775557561563E-17
0.09090909090909090909090909               - 1 / 9 -> 2.775557561563E-17
0.090909090909090909090909090              - 1 / 9 -> 2.775557561563E-17
0.0909090909090909090909090909             - 1 / 9 -> 1.387778780781E-17
0.09090909090909090909090909090            - 1 / 9 -> 2.775557561563E-17
0.090909090909090909090909090909           - 1 / 9 -> 2.775557561563E-17
0.0909090909090909090909090909090          - 1 / 9 -> 2.775557561563E-17
0.09090909090909090909090909090909         - 1 / 9 -> 2.775557561563E-17
0.090909090909090909090909090909090        - 1 / 9 -> 1.387778780781E-17
0.0909090909090909090909090909090909       - 1 / 9 -> 1.387778780781E-17
0.09090909090909090909090909090909090      - 1 / 9 -> 1.387778780781E-17
0.090909090909090909090909090909090909     - 1 / 9 -> 2.775557561563E-17
0.0909090909090909090909090909090909090    - 1 / 9 -> 1.387778780781E-17
0.09090909090909090909090909090909090909   - 1 / 9 -> 2.775557561563E-17
0.090909090909090909090909090909090909090  - 1 / 9 -> 2.775557561563E-17
0.0909090909090909090909090909090909090909 - 1 / 9 -> 1.387778780781E-17

つまり、十進数で記述の精度を真の値に向けて増大させたときに、 SAD内部表現であるReal型の値が真の値に収束するわけではない ということ

_ [SAD]ToStringの結果をToExpressionで復元できない

例えば、実数のデータ列をWrite[]で書き出した結果をRead[]してくると Real型としては元の値との同一性が保証されないということ。 実例は以下のサンプル参照のこと。

例えば、数値計算の精度をテストするユニットテストの記述時に 標準値をユニットテスト内に記述した段階で、その値が 元の計算値から変化する可能性が有ります。

String2RealConvTest[max_Real:10] := Module[{x, s, i}, StandardForm[
  x = 1 - 1e-3;
  Table[(x = (1 + x) / 2;
    s = ToString[x];
    Print[("   "//ToString[i])[-3,-1],
      ": x=", x, " s=", s, " diff=", ToExpression[s] - x];
    ), {i, 1, max}];
  ]];
String2RealConvTest[45]; Exit[0];
 1: x=.9995 s=".9995" diff=0
 2: x=.99975 s=".99975" diff=0
 3: x=.999875 s=".999875" diff=-1.11022302463E-16
 4: x=.9999375 s=".9999375" diff=0
 5: x=.99996875 s=".99996875" diff=-1.11022302463E-16
 6: x=.999984375 s=".999984375" diff=0
 7: x=.9999921875 s=".9999921875" diff=0
 8: x=.99999609375 s=".99999609375" diff=0
 9: x=.999998046875 s=".999998046875" diff=0
10: x=.9999990234375 s=".9999990234375" diff=0
11: x=.99999951171875 s=".99999951171875" diff=0
12: x=.999999755859375 s=".999999755859375" diff=0
13: x=.999999877929688 s=".999999877929688" diff=5.551115123126E-16
14: x=.999999938964844 s=".999999938964844" diff=2.22044604925E-16
15: x=.999999969482422 s=".999999969482422" diff=1.110223024625E-16
16: x=.999999984741211 s=".999999984741211" diff=1.110223024625E-16
17: x=.999999992370605 s=".999999992370605" diff=-4.4408920985E-16
18: x=.999999996185303 s=".999999996185303" diff=2.22044604925E-16
19: x=.999999998092651 s=".999999998092651" diff=-3.33066907388E-16
20: x=.999999999046326 s=".999999999046326" diff=2.22044604925E-16
21: x=.999999999523163 s=".999999999523163" diff=1.110223024625E-16
22: x=.999999999761581 s=".999999999761581" diff=-3.33066907388E-16
23: x=.999999999880791 s=".999999999880791" diff=3.330669073875E-16
24: x=.999999999940395 s=".999999999940395" diff=-3.33066907388E-16
25: x=.999999999970198 s=".999999999970198" diff=3.330669073875E-16
26: x=.999999999985099 s=".999999999985099" diff=2.22044604925E-16
27: x=.999999999992549 s=".999999999992549" diff=-4.4408920985E-16
28: x=.999999999996275 s=".999999999996275" diff=2.22044604925E-16
29: x=.999999999998137 s=".999999999998137" diff=-3.33066907388E-16
30: x=.999999999999069 s=".999999999999069" diff=2.22044604925E-16
31: x=.999999999999534 s=".999999999999534" diff=-3.33066907388E-16
32: x=.999999999999767 s=".999999999999767" diff=-2.22044604925E-16
33: x=.999999999999884 s=".999999999999884" diff=3.330669073875E-16
34: x=.999999999999942 s=".999999999999942" diff=2.22044604925E-16
35: x=.999999999999971 s=".999999999999971" diff=1.110223024625E-16
36: x=.999999999999985 s=".999999999999985" diff=-4.4408920985E-16
37: x=.999999999999993 s=".999999999999993" diff=3.330669073875E-16
38: x=.999999999999996 s=".999999999999996" diff=-3.33066907388E-16
39: x=.999999999999998 s=".999999999999998" diff=-2.22044604925E-16
40: x=.999999999999999 s=".999999999999999" diff=-1.11022302463E-16
41: x=1 s="1" diff=4.440892098501E-16
42: x=1 s="1" diff=2.22044604925E-16
43: x=1 s="1" diff=1.110223024625E-16
44: x=1 s="1" diff=0
45: x=1 s="1" diff=0

_ [SAD][LHC]IPのβノブが...

LHC Collision OpticsでHorizontal Dispersionを条件に入れると、 CELLモードでなんかうまくマッチングが取れない。

Corssing Angle無しのモデルだと問題なくできるので、 IPの Vertical Crossing Angleが諸悪の根源のようです。

IPの Vertical Bump付近に Couplingも残っているようなので それも含めると自由度足りないが、Couplingパラメータは拘束していない はずなのだが...

Couplingの変化がIRの外に伝搬して境界での Twissパラメータの拘束条件に 悪影響を与えてるのかな?


カテゴリー: Admin | Emacs | EPICS | Fortran | FreeBSD | GCC | hgsubversion | IPv6 | KEKB | LHC | Lisp | LLVM | MADX | Ryzen | SAD | samba | tDiary | unix | WWW | YaSAI | お仕事 | イベント | 出張 | 宴会 | 数学 | 艦これ | 買いもの | 追記 | 雑記