public static bool operator==(Shiki s1, Shiki s2) { Shiki s = s1 - s2; s.Normalize(); return(s.list.Count == 0); }
public static Shiki operator+(Kou k1, Kou k2) { Shiki shiki = new Shiki(); shiki.AddKou(k1.Clone()); shiki.AddKou(k2.Clone()); return(shiki); }
public static Shiki Poisson(Shiki s1, Shiki s2) { Shiki pois = new Shiki(); pois += (s1 >> 1) * (s2 >> 4) - (s1 >> 4) * (s2 >> 1); pois += (s1 >> 2) * (s2 >> 5) - (s1 >> 5) * (s2 >> 2); pois += (s1 >> 3) * (s2 >> 6) - (s1 >> 6) * (s2 >> 3); return(pois); }
public static Shiki operator*(int v, Shiki s) { Shiki ret = new Shiki(); foreach (Kou k2 in s.list) { ret.AddKou(v * k2); } return(ret); }
public static Shiki operator*(Kou k1, Shiki s2) { Shiki ret = new Shiki(); foreach (Kou k2 in s2.list) { ret.AddKou(k1 * k2); } return(ret); }
/// <summary> /// 偏微分 /// </summary> /// <param name="s1"></param> /// <param name="index"></param> /// <returns></returns> public static Shiki operator>>(Shiki s1, int index) { Shiki ret = new Shiki(); foreach (Kou k in s1.list) { k.Henbi(ret, index); } return(ret); }
public static Shiki operator-(Shiki s1, Kou k2) { Shiki ret = new Shiki(); foreach (Kou k1 in s1.list) { ret.AddKou(k1.Clone()); } ret.AddKou((-1) * k2); return(ret); }
public static Shiki operator+(Shiki s1, Shiki s2) { Shiki ret = new Shiki(); foreach (Kou k1 in s1.list) { ret.AddKou(k1.Clone()); } foreach (Kou k2 in s2.list) { ret.AddKou(k2.Clone()); } return(ret); }
public void Henbi(Shiki shiki, int index) { if (index <= 0 || 6 < index) { throw new System.Exception("そんな偏微分には対応していないよ"); } Kou ret = this.Clone(); ret.keisu *= ret.inshi[index]--; shiki.AddKou(ret); if (index > 3 || this.inshi[0] == 0) { return; } ret = this.Clone(); ret.keisu *= -ret.inshi[0]; ret.inshi[0] += 2; ret.inshi[index]++; shiki.AddKou(ret); }
public static void Calculate() { Vector vec_L = vec_r * vec_p; Vector vec_pL = vec_p * vec_L; Vector vec_rL = vec_r * vec_L; Vector vec_F = -mk * r_inv * vec_r; Vector vec_A = vec_pL + vec_F; Shiki L1 = vec_L.x; Shiki L2 = vec_L.y; Shiki L3 = vec_L.z; Shiki pXL1 = vec_pL.x; Shiki pXL2 = vec_pL.y; Shiki pXL3 = vec_pL.z; Shiki rXL1 = vec_rL.x; Shiki rXL2 = vec_rL.y; Shiki rXL3 = vec_rL.z; Shiki F1 = vec_F.x; Shiki F2 = vec_F.y; Shiki F3 = vec_F.z; Shiki A1 = vec_A.x; Shiki A2 = vec_A.y; Shiki A3 = vec_A.z; Shiki _2mH = (vec_p & vec_p) - 2 * mk * r_inv; //System.Console.WriteLine(L1); //System.Console.WriteLine(L2); //System.Console.WriteLine(L3); //=========================================================== // 1) //=========================================================== //* System.Console.WriteLine("[Ax,2mH] == {0}", Poisson(A1, _2mH)); System.Console.WriteLine("[Ay,2mH] == {0}", Poisson(A2, _2mH)); System.Console.WriteLine("[Az,2mH] == {0}", Poisson(A3, _2mH)); //*/ //=========================================================== // 2) //=========================================================== // [L,****] //----------------------------------------------------------- /* * System.Console.WriteLine(Poisson(L1,r2)==r3); * System.Console.WriteLine(Poisson(L2,r3)==r1); * System.Console.WriteLine(Poisson(L3,r1)==r2); * System.Console.WriteLine(Poisson(L1,p2)==p3); * System.Console.WriteLine(Poisson(L2,p3)==p1); * System.Console.WriteLine(Poisson(L3,p1)==p2); * System.Console.WriteLine(Poisson(L1,L2)==L3); * System.Console.WriteLine(Poisson(L2,L3)==L1); * System.Console.WriteLine(Poisson(L3,L1)==L2); * //*/ //----------------------------------------------------------- // [p×L,****] //----------------------------------------------------------- /* * Shiki r_p=r1*p1+r2*p2+r3*p3; * Shiki p_p=p1*p1+p2*p2+p3*p3; * * System.Console.WriteLine(Poisson(pXL1,r1)==1*r_p-r1*p1); * System.Console.WriteLine(Poisson(pXL2,r2)==1*r_p-r2*p2); * System.Console.WriteLine(Poisson(pXL3,r3)==1*r_p-r3*p3); * System.Console.WriteLine(Poisson(pXL1,r2)==0*r_p+p1*r2-2*r1*p2); * System.Console.WriteLine(Poisson(pXL2,r3)==0*r_p+p2*r3-2*r2*p3); * System.Console.WriteLine(Poisson(pXL3,r1)==0*r_p+p3*r1-2*r3*p1); * * System.Console.WriteLine(Poisson(pXL1,p1)==1*p_p-p1*p1); * System.Console.WriteLine(Poisson(pXL2,p2)==1*p_p-p2*p2); * System.Console.WriteLine(Poisson(pXL3,p3)==1*p_p-p3*p3); * System.Console.WriteLine(Poisson(pXL1,p2)==0*p_p-p1*p2); * System.Console.WriteLine(Poisson(pXL2,p3)==0*p_p-p2*p3); * System.Console.WriteLine(Poisson(pXL3,p1)==0*p_p-p3*p1); * * System.Console.WriteLine(Poisson(pXL1,r_inv)==rXL1*(r_inv*r_inv*r_inv)); * System.Console.WriteLine(Poisson(pXL2,r_inv)==rXL2*(r_inv*r_inv*r_inv)); * System.Console.WriteLine(Poisson(pXL3,r_inv)==rXL3*(r_inv*r_inv*r_inv)); * * System.Console.WriteLine(Poisson(pXL1,L2)==pXL3); * System.Console.WriteLine(Poisson(pXL2,L3)==pXL1); * System.Console.WriteLine(Poisson(pXL3,L1)==pXL2); * //*/ //----------------------------------------------------------- // [Ax,Ay] //----------------------------------------------------------- /* * System.Console.WriteLine(Poisson(F1,F2)==0*_1); * System.Console.WriteLine(Poisson(pXL1,F2)+Poisson(F1,pXL2)==2*mk*r_inv*L3); * System.Console.WriteLine(Poisson(pXL1,pXL2)==-L3*(vec_p&vec_p)); * //*///* System.Console.WriteLine("[Ax,Ay] == -2mH Lz : {0}", Poisson(A1, A2) == -L3 * _2mH); System.Console.WriteLine("[Ay,Az] == -2mH Lx : {0}", Poisson(A2, A3) == -L1 * _2mH); System.Console.WriteLine("[Az,Ax] == -2mH Ly : {0}", Poisson(A3, A1) == -L2 * _2mH); //*/ //=========================================================== // 3) //=========================================================== System.Console.WriteLine("A・L == 0 : {0}", (vec_A & vec_L) == 0 * _1); System.Console.WriteLine("A・A == (mk)^2 + 2mH L・L : {0}", (vec_A & vec_A) == mk * mk * _1 + _2mH * (vec_L & vec_L)); }
internal Vector() { this.x = this.y = this.z = null; }
public Vector(Shiki x, Shiki y, Shiki z) { this.x = x; this.y = y; this.z = z; }