求助
我用了四阶龙格库塔法求解了一个方程组,但为什么每次运行出来的数据不一样?
Clear["Global`*"]
q = 0; i = 0.6; j = -0.3;
m = 0; n = 0;
S[x_] := If[x < 0, -1, 0];
T[x_] := If[x > 0, 1, 0];
date2 = Table[Subscript[A, 1] = q;
Subscript[A, 2] = Subscript[A, 1] + Subscript[K, 1]*0.001/2;
Subscript[A, 3] = Subscript[A, 1] + Subscript[K, 2]*0.001/2;
Subscript[A, 4] = Subscript[A, 1] + Subscript[K, 3]*0.001;
Subscript[H, 1] = m;
Subscript[H, 2] = Subscript[H, 1] + Subscript[P, 1]*0.001/2;
Subscript[H, 3] = Subscript[H, 1] + Subscript[P, 2]*0.001/2;
Subscript[H, 4] = Subscript[H, 1] + Subscript[P, 3]*0.001;
Subscript[Z, 1] = n;
Subscript[Z, 2] = Subscript[Z, 1] + Subscript[L, 1]*0.001/2;
Subscript[Z, 3] = Subscript[Z, 1] + Subscript[L, 2]*0.001/2;
Subscript[Z, 4] = Subscript[Z, 1] + Subscript[L, 3]*0.001;
Subscript[K,
1] = -0.00065/(
0.8 - 0.0105625*Cos[i*57.3 \[Degree]]^2 -
0.0105625*
Cos[j*57.3 \[Degree]]^2)*(-Sin[i*57.3 \[Degree]]*(m + 0)^2 +
1/0.00004 (-0.006487*Sin[i*57.3 \[Degree]] +
0.0015*If[0.1 < i < 0.2, 1*S[m],
If[-0.2 < i < -0.1, 1*T[m], 0]] - 0.000015*Sign[m])*
Cos[i*57.3 \[Degree]] - Sin[j*57.3 \[Degree]]*(n + 0)^2 +
1/0.00004 (-0.006487*Sin[j*57.3 \[Degree]] +
0.0015*If[0.1 < j < 0.2, 1*S[n],
If[-0.2 < j < -0.1, 1*T[n], 0]] - 0.000015*Sign[n])*
Cos[j*57.3 \[Degree]]) -
0.00001/(
0.8 - 0.0105625*Cos[i*57.3 \[Degree]]^2 -
0.0105625*Cos[j*57.3 \[Degree]]^2)*Sign[q];
Subscript[K,
2] = ((-0.00065)/(0.8 -
0.0105625*
Cos[(i + Subscript[H, 1]*0.001/2)*57.3 \[Degree]]^2 -
0.0105625*
Cos[(j +
Subscript[Z, 1]*0.001/2)*57.3 \[Degree]]^2))*(-Sin[(i +
Subscript[H, 1]*0.001/2)*57.3 \[Degree]]*(m +
Subscript[P, 1]*0.001/2)^2 +
1/0.00004 (-0.006487*
Sin[(i + Subscript[H, 1]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (i + Subscript[H, 1]*0.001/2) < 0.2,
1*S[(m + Subscript[P, 1]*0.001/2)],
If[-0.2 < (i + Subscript[H, 1]*0.001/2) < -0.1,
1*T[(m + Subscript[P, 1]*0.001/2)], 0]] -
0.000015*Sign[(m + Subscript[P, 1]*0.001/2)])*
Cos[(i + Subscript[H, 1]*0.001/2)*57.3 \[Degree]] -
Sin[(j + Subscript[Z, 1]*0.001/2)*57.3 \[Degree]]*(n +
Subscript[L, 1]*0.001/2)^2 +
1/0.00004 (-0.006487*
Sin[(j + Subscript[Z, 1]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (j + Subscript[Z, 1]*0.001/2) < 0.2,
1*S[(n + Subscript[L, 1]*0.001/2)],
If[-0.2 < (j + Subscript[Z, 1]*0.001/2) < -0.1,
1*T[(n + Subscript[L, 1]*0.001/2)], 0]] -
0.000015*Sign[(n + Subscript[L, 1]*0.001/2)])*
Cos[(j + Subscript[Z, 1]*0.001/2)*57.3 \[Degree]]) -
0.00001/(
0.8 - 0.0105625*
Cos[(i + Subscript[H, 1]*0.001/2)*57.3 \[Degree]]^2 -
0.0105625*Cos[(j + Subscript[Z, 1]*0.001/2)*57.3 \[Degree]]^2)*
Sign[(q + 0.005*Subscript[K, 1])];
Subscript[K,
3] = -0.00065/(
0.8 - 0.0105625*
Cos[(i + Subscript[H, 2]*0.001/2)*57.3 \[Degree]]^2 -
0.0105625*
Cos[(j +
Subscript[Z, 2]*0.001/
2)*57.3 \[Degree]]^2)*(-Sin[(i +
Subscript[H, 2]*0.001/2)*57.3 \[Degree]]*(m +
Subscript[P, 2]*0.001/2)^2 +
1/0.00004 (-0.006487*
Sin[(i + Subscript[H, 2]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (i + Subscript[H, 2]*0.001/2) < 0.2,
1*S[(m + Subscript[P, 2]*0.001/2)],
If[-0.2 < (i + Subscript[H, 2]*0.001/2) < -0.1,
1*T[(m + Subscript[P, 2]*0.001/2)], 0]] -
0.000015*Sign[(m + Subscript[P, 2]*0.001/2)])*
Cos[(i + Subscript[H, 2]*0.001/2)*57.3 \[Degree]] -
Sin[(j + Subscript[Z, 2]*0.001/2)*57.3 \[Degree]]*(n +
Subscript[L, 2]*0.001/2)^2 +
1/0.00004 (-0.006487*
Sin[(j + Subscript[Z, 2]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (j + Subscript[Z, 2]*0.001/2) < 0.2,
1*S[(n + Subscript[L, 2]*0.001/2)],
If[-0.2 < (j + Subscript[Z, 2]*0.001/2) < -0.1,
1*T[(n + Subscript[L, 2]*0.001/2)], 0]] -
0.000015*Sign[(n + Subscript[L, 2]*0.001/2)])*
Cos[(j + Subscript[Z, 2]*0.001/2)*57.3 \[Degree]]) -
0.00001/(
0.8 - 0.0105625*
Cos[(i + Subscript[H, 2]*0.001/2)*57.3 \[Degree]]^2 -
0.0105625*Cos[(j + Subscript[Z, 2]*0.001/2)*57.3 \[Degree]]^2)*
Sign[(q + 0.005*Subscript[K, 2])];
Subscript[K,
4] = -0.00065/(
0.8 - 0.0105625*
Cos[(i + Subscript[H, 3]*0.001)*57.3 \[Degree]]^2 -
0.0105625*
Cos[(j +
Subscript[Z,
3]*0.001)*57.3 \[Degree]]^2)*(-Sin[(i +
Subscript[H, 3]*0.001)*57.3 \[Degree]]*(m +
Subscript[P, 3]*0.001)^2 +
1/0.00004 (-0.006487*
Sin[(i + Subscript[H, 3]*0.001)*57.3 \[Degree]] +
0.0015*If[0.1 < (i + Subscript[H, 3]*0.001) < 0.2,
1*S[(m + Subscript[P, 3]*0.001)],
If[-0.2 < (i + Subscript[H, 3]*0.001) < -0.1,
1*T[(m + Subscript[P, 3]*0.001)], 0]] -
0.000015*Sign[(m + Subscript[P, 3]*0.001)])*
Cos[(i + Subscript[H, 3]*0.001)*57.3 \[Degree]] -
Sin[(j + Subscript[Z, 3]*0.001)*57.3 \[Degree]]*(n +
Subscript[L, 3]*0.001)^2 +
1/0.00004 (-0.006487*
Sin[(j + Subscript[Z, 3]*0.001)*57.3 \[Degree]] +
0.0015*If[0.1 < (j + Subscript[Z, 3]*0.001) < 0.2,
1*S[(n + Subscript[L, 3]*0.001)],
If[-0.2 < (j + Subscript[Z, 3]*0.001) < -0.1,
1*T[(n + Subscript[L, 3]*0.001)], 0]] -
0.000015*Sign[(n + Subscript[L, 3]*0.001)])*
Cos[(j +
Subscript[Z,
3]*0.001)*57.3 \[Degree]]) - (0.00001/(0.8 -
0.0105625*
Cos[(i + Subscript[H, 3]*0.001)*57.3 \[Degree]]^2 -
0.0105625*
Cos[(j + Subscript[Z, 3]*0.001)*57.3 \[Degree]]^2))*
Sign[(q + 0.001*Subscript[K, 3])];
Subscript[L, 1] =
1/0.00004*(-0.006487*Sin[j*57.3 \[Degree]] +
0.0015*If[0.1 < j < 0.2, 1*S[n],
If[-0.2 < j < -0.1, 1*T[n], 0]] - 0.000015*Sign[n] -
0.00065*Cos[j*57.3 \[Degree]]*Subscript[K, 1]);
Subscript[L, 2] =
1/0.00004*(-0.006487*
Sin[(j + Subscript[Z, 1]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (j + Subscript[Z, 1]*0.001/2) < 0.2,
1*S[(n + Subscript[L, 1]*0.001/2)],
If[-0.2 < (j + Subscript[Z, 1]*0.001/2) < -0.1,
1*T[(n + Subscript[L, 1]*0.001/2)], 0]] -
0.000015*Sign[(n + Subscript[L, 1]*0.001/2)] -
0.00065*Cos[(j + Subscript[Z, 1]*0.001/2)*57.3 \[Degree]]*
Subscript[K, 2]);
Subscript[L, 3] =
1/0.00004*(-0.006487*
Sin[(j + Subscript[Z, 2]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (j + Subscript[Z, 2]*0.001/2) < 0.2,
1*S[(n + Subscript[L, 2]*0.001/2)],
If[-0.2 < (j + Subscript[Z, 2]*0.001/2) < -0.1,
1*T[(n + Subscript[L, 2]*0.001/2)], 0]] -
0.000015*Sign[(n + Subscript[L, 2]*0.001/2)] -
0.00065*Cos[(j + Subscript[Z, 2]*0.001/2)*57.3 \[Degree]]*
Subscript[K, 3]);
Subscript[L, 4] =
1/0.00004*(-0.006487*
Sin[(j + Subscript[Z, 3]*0.001)*57.3 \[Degree]] +
0.0015*If[0.1 < (j + Subscript[Z, 3]*0.001) < 0.2,
1*S[(n + Subscript[L, 3]*0.001)],
If[-0.2 < (j + Subscript[Z, 3]*0.001) < -0.1,
1*T[(n + Subscript[L, 3]*0.001)], 0]] -
0.000015*Sign[(n + Subscript[L, 3]*0.001)] -
0.00065*Cos[(j + Subscript[Z, 3]*0.001)*57.3 \[Degree]]*
Subscript[K, 4]);
Subscript[P, 1] =
1/0.00004*(-0.006487*Sin[i*57.3 \[Degree]] +
0.0015*If[0.1 < i < 0.2, 1*S[m],
If[-0.2 < i < -0.1, 1*T[m], 0]] - 0.000015*Sign[m] -
0.00065*Cos[i*57.3 \[Degree]]*Subscript[K, 1]);
Subscript[P, 2] =
1/0.00004*(-0.006487*
Sin[(i + Subscript[H, 1]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (i + Subscript[H, 1]*0.001/2) < 0.2,
1*S[(m + Subscript[P, 1]*0.001/2)],
If[-0.2 < (i + Subscript[H, 1]*0.001/2) < -0.1,
1*T[(m + Subscript[P, 1]*0.001/2)], 0]] -
0.000015*Sign[(m + Subscript[P, 1]*0.001/2)] -
0.00065*Cos[(i + Subscript[H, 1]*0.001/2)*57.3 \[Degree]]*
Subscript[K, 2]);
Subscript[P, 3] =
1/0.00004*(-0.006487*
Sin[(i + Subscript[H, 2]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (i + Subscript[H, 2]*0.001/2) < 0.2,
1*S[(m + Subscript[P, 2]*0.001/2)],
If[-0.2 < (i + Subscript[H, 2]*0.001/2) < -0.1,
1*T[(m + Subscript[P, 2]*0.001/2)], 0]] -
0.000015*Sign[(m + Subscript[P, 2]*0.001/2)] -
0.00065*Cos[(i + Subscript[H, 2]*0.001/2)*57.3 \[Degree]]*
Subscript[K, 3]);
Subscript[P, 4] =
1/0.00004*(-0.006487*
Sin[(i + Subscript[H, 3]*0.001)*57.3 \[Degree]] +
0.0015*If[0.1 < (i + Subscript[H, 3]*0.001) < 0.2,
1*S[(m + Subscript[P, 3]*0.001)],
If[-0.2 < (i + Subscript[H, 3]*0.001) < -0.1,
1*T[(m + Subscript[P, 3]*0.001)], 0]] -
0.000015*Sign[(m + Subscript[P, 3]*0.001)] -
0.00065*Cos[(i + Subscript[H, 3]*0.001)*57.3 \[Degree]]*
Subscript[K, 4]);
q = q +
0.001/6*(Subscript[K, 1] + 2 Subscript[K, 2] +
2 Subscript[K, 3] + Subscript[K, 4]);
m = m +
0.001/6*(Subscript[P, 1] + 2 Subscript[P, 2] +
2 Subscript[P, 3] + Subscript[P, 4]);
i = i +
0.001/6*(Subscript[H, 1] + 2 Subscript[H, 2] +
2 Subscript[H, 3] + Subscript[H, 4]);
n = n +
0.001/6*(Subscript[L, 1] + 2 Subscript[L, 2] +
2 Subscript[L, 3] + Subscript[L, 4]);
j = j +
0.001/6*(Subscript[Z, 1] + 2 Subscript[Z, 2] +
2 Subscript[Z, 3] + Subscript[Z, 4]);
{i, j}, {u, 0, 100, 0.001}] // Simplify
(代码其实比较简单,就是复制粘贴比较多)
一次结果为

另一次为

我用了四阶龙格库塔法求解了一个方程组,但为什么每次运行出来的数据不一样?
Clear["Global`*"]
q = 0; i = 0.6; j = -0.3;
m = 0; n = 0;
S[x_] := If[x < 0, -1, 0];
T[x_] := If[x > 0, 1, 0];
date2 = Table[Subscript[A, 1] = q;
Subscript[A, 2] = Subscript[A, 1] + Subscript[K, 1]*0.001/2;
Subscript[A, 3] = Subscript[A, 1] + Subscript[K, 2]*0.001/2;
Subscript[A, 4] = Subscript[A, 1] + Subscript[K, 3]*0.001;
Subscript[H, 1] = m;
Subscript[H, 2] = Subscript[H, 1] + Subscript[P, 1]*0.001/2;
Subscript[H, 3] = Subscript[H, 1] + Subscript[P, 2]*0.001/2;
Subscript[H, 4] = Subscript[H, 1] + Subscript[P, 3]*0.001;
Subscript[Z, 1] = n;
Subscript[Z, 2] = Subscript[Z, 1] + Subscript[L, 1]*0.001/2;
Subscript[Z, 3] = Subscript[Z, 1] + Subscript[L, 2]*0.001/2;
Subscript[Z, 4] = Subscript[Z, 1] + Subscript[L, 3]*0.001;
Subscript[K,
1] = -0.00065/(
0.8 - 0.0105625*Cos[i*57.3 \[Degree]]^2 -
0.0105625*
Cos[j*57.3 \[Degree]]^2)*(-Sin[i*57.3 \[Degree]]*(m + 0)^2 +
1/0.00004 (-0.006487*Sin[i*57.3 \[Degree]] +
0.0015*If[0.1 < i < 0.2, 1*S[m],
If[-0.2 < i < -0.1, 1*T[m], 0]] - 0.000015*Sign[m])*
Cos[i*57.3 \[Degree]] - Sin[j*57.3 \[Degree]]*(n + 0)^2 +
1/0.00004 (-0.006487*Sin[j*57.3 \[Degree]] +
0.0015*If[0.1 < j < 0.2, 1*S[n],
If[-0.2 < j < -0.1, 1*T[n], 0]] - 0.000015*Sign[n])*
Cos[j*57.3 \[Degree]]) -
0.00001/(
0.8 - 0.0105625*Cos[i*57.3 \[Degree]]^2 -
0.0105625*Cos[j*57.3 \[Degree]]^2)*Sign[q];
Subscript[K,
2] = ((-0.00065)/(0.8 -
0.0105625*
Cos[(i + Subscript[H, 1]*0.001/2)*57.3 \[Degree]]^2 -
0.0105625*
Cos[(j +
Subscript[Z, 1]*0.001/2)*57.3 \[Degree]]^2))*(-Sin[(i +
Subscript[H, 1]*0.001/2)*57.3 \[Degree]]*(m +
Subscript[P, 1]*0.001/2)^2 +
1/0.00004 (-0.006487*
Sin[(i + Subscript[H, 1]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (i + Subscript[H, 1]*0.001/2) < 0.2,
1*S[(m + Subscript[P, 1]*0.001/2)],
If[-0.2 < (i + Subscript[H, 1]*0.001/2) < -0.1,
1*T[(m + Subscript[P, 1]*0.001/2)], 0]] -
0.000015*Sign[(m + Subscript[P, 1]*0.001/2)])*
Cos[(i + Subscript[H, 1]*0.001/2)*57.3 \[Degree]] -
Sin[(j + Subscript[Z, 1]*0.001/2)*57.3 \[Degree]]*(n +
Subscript[L, 1]*0.001/2)^2 +
1/0.00004 (-0.006487*
Sin[(j + Subscript[Z, 1]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (j + Subscript[Z, 1]*0.001/2) < 0.2,
1*S[(n + Subscript[L, 1]*0.001/2)],
If[-0.2 < (j + Subscript[Z, 1]*0.001/2) < -0.1,
1*T[(n + Subscript[L, 1]*0.001/2)], 0]] -
0.000015*Sign[(n + Subscript[L, 1]*0.001/2)])*
Cos[(j + Subscript[Z, 1]*0.001/2)*57.3 \[Degree]]) -
0.00001/(
0.8 - 0.0105625*
Cos[(i + Subscript[H, 1]*0.001/2)*57.3 \[Degree]]^2 -
0.0105625*Cos[(j + Subscript[Z, 1]*0.001/2)*57.3 \[Degree]]^2)*
Sign[(q + 0.005*Subscript[K, 1])];
Subscript[K,
3] = -0.00065/(
0.8 - 0.0105625*
Cos[(i + Subscript[H, 2]*0.001/2)*57.3 \[Degree]]^2 -
0.0105625*
Cos[(j +
Subscript[Z, 2]*0.001/
2)*57.3 \[Degree]]^2)*(-Sin[(i +
Subscript[H, 2]*0.001/2)*57.3 \[Degree]]*(m +
Subscript[P, 2]*0.001/2)^2 +
1/0.00004 (-0.006487*
Sin[(i + Subscript[H, 2]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (i + Subscript[H, 2]*0.001/2) < 0.2,
1*S[(m + Subscript[P, 2]*0.001/2)],
If[-0.2 < (i + Subscript[H, 2]*0.001/2) < -0.1,
1*T[(m + Subscript[P, 2]*0.001/2)], 0]] -
0.000015*Sign[(m + Subscript[P, 2]*0.001/2)])*
Cos[(i + Subscript[H, 2]*0.001/2)*57.3 \[Degree]] -
Sin[(j + Subscript[Z, 2]*0.001/2)*57.3 \[Degree]]*(n +
Subscript[L, 2]*0.001/2)^2 +
1/0.00004 (-0.006487*
Sin[(j + Subscript[Z, 2]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (j + Subscript[Z, 2]*0.001/2) < 0.2,
1*S[(n + Subscript[L, 2]*0.001/2)],
If[-0.2 < (j + Subscript[Z, 2]*0.001/2) < -0.1,
1*T[(n + Subscript[L, 2]*0.001/2)], 0]] -
0.000015*Sign[(n + Subscript[L, 2]*0.001/2)])*
Cos[(j + Subscript[Z, 2]*0.001/2)*57.3 \[Degree]]) -
0.00001/(
0.8 - 0.0105625*
Cos[(i + Subscript[H, 2]*0.001/2)*57.3 \[Degree]]^2 -
0.0105625*Cos[(j + Subscript[Z, 2]*0.001/2)*57.3 \[Degree]]^2)*
Sign[(q + 0.005*Subscript[K, 2])];
Subscript[K,
4] = -0.00065/(
0.8 - 0.0105625*
Cos[(i + Subscript[H, 3]*0.001)*57.3 \[Degree]]^2 -
0.0105625*
Cos[(j +
Subscript[Z,
3]*0.001)*57.3 \[Degree]]^2)*(-Sin[(i +
Subscript[H, 3]*0.001)*57.3 \[Degree]]*(m +
Subscript[P, 3]*0.001)^2 +
1/0.00004 (-0.006487*
Sin[(i + Subscript[H, 3]*0.001)*57.3 \[Degree]] +
0.0015*If[0.1 < (i + Subscript[H, 3]*0.001) < 0.2,
1*S[(m + Subscript[P, 3]*0.001)],
If[-0.2 < (i + Subscript[H, 3]*0.001) < -0.1,
1*T[(m + Subscript[P, 3]*0.001)], 0]] -
0.000015*Sign[(m + Subscript[P, 3]*0.001)])*
Cos[(i + Subscript[H, 3]*0.001)*57.3 \[Degree]] -
Sin[(j + Subscript[Z, 3]*0.001)*57.3 \[Degree]]*(n +
Subscript[L, 3]*0.001)^2 +
1/0.00004 (-0.006487*
Sin[(j + Subscript[Z, 3]*0.001)*57.3 \[Degree]] +
0.0015*If[0.1 < (j + Subscript[Z, 3]*0.001) < 0.2,
1*S[(n + Subscript[L, 3]*0.001)],
If[-0.2 < (j + Subscript[Z, 3]*0.001) < -0.1,
1*T[(n + Subscript[L, 3]*0.001)], 0]] -
0.000015*Sign[(n + Subscript[L, 3]*0.001)])*
Cos[(j +
Subscript[Z,
3]*0.001)*57.3 \[Degree]]) - (0.00001/(0.8 -
0.0105625*
Cos[(i + Subscript[H, 3]*0.001)*57.3 \[Degree]]^2 -
0.0105625*
Cos[(j + Subscript[Z, 3]*0.001)*57.3 \[Degree]]^2))*
Sign[(q + 0.001*Subscript[K, 3])];
Subscript[L, 1] =
1/0.00004*(-0.006487*Sin[j*57.3 \[Degree]] +
0.0015*If[0.1 < j < 0.2, 1*S[n],
If[-0.2 < j < -0.1, 1*T[n], 0]] - 0.000015*Sign[n] -
0.00065*Cos[j*57.3 \[Degree]]*Subscript[K, 1]);
Subscript[L, 2] =
1/0.00004*(-0.006487*
Sin[(j + Subscript[Z, 1]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (j + Subscript[Z, 1]*0.001/2) < 0.2,
1*S[(n + Subscript[L, 1]*0.001/2)],
If[-0.2 < (j + Subscript[Z, 1]*0.001/2) < -0.1,
1*T[(n + Subscript[L, 1]*0.001/2)], 0]] -
0.000015*Sign[(n + Subscript[L, 1]*0.001/2)] -
0.00065*Cos[(j + Subscript[Z, 1]*0.001/2)*57.3 \[Degree]]*
Subscript[K, 2]);
Subscript[L, 3] =
1/0.00004*(-0.006487*
Sin[(j + Subscript[Z, 2]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (j + Subscript[Z, 2]*0.001/2) < 0.2,
1*S[(n + Subscript[L, 2]*0.001/2)],
If[-0.2 < (j + Subscript[Z, 2]*0.001/2) < -0.1,
1*T[(n + Subscript[L, 2]*0.001/2)], 0]] -
0.000015*Sign[(n + Subscript[L, 2]*0.001/2)] -
0.00065*Cos[(j + Subscript[Z, 2]*0.001/2)*57.3 \[Degree]]*
Subscript[K, 3]);
Subscript[L, 4] =
1/0.00004*(-0.006487*
Sin[(j + Subscript[Z, 3]*0.001)*57.3 \[Degree]] +
0.0015*If[0.1 < (j + Subscript[Z, 3]*0.001) < 0.2,
1*S[(n + Subscript[L, 3]*0.001)],
If[-0.2 < (j + Subscript[Z, 3]*0.001) < -0.1,
1*T[(n + Subscript[L, 3]*0.001)], 0]] -
0.000015*Sign[(n + Subscript[L, 3]*0.001)] -
0.00065*Cos[(j + Subscript[Z, 3]*0.001)*57.3 \[Degree]]*
Subscript[K, 4]);
Subscript[P, 1] =
1/0.00004*(-0.006487*Sin[i*57.3 \[Degree]] +
0.0015*If[0.1 < i < 0.2, 1*S[m],
If[-0.2 < i < -0.1, 1*T[m], 0]] - 0.000015*Sign[m] -
0.00065*Cos[i*57.3 \[Degree]]*Subscript[K, 1]);
Subscript[P, 2] =
1/0.00004*(-0.006487*
Sin[(i + Subscript[H, 1]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (i + Subscript[H, 1]*0.001/2) < 0.2,
1*S[(m + Subscript[P, 1]*0.001/2)],
If[-0.2 < (i + Subscript[H, 1]*0.001/2) < -0.1,
1*T[(m + Subscript[P, 1]*0.001/2)], 0]] -
0.000015*Sign[(m + Subscript[P, 1]*0.001/2)] -
0.00065*Cos[(i + Subscript[H, 1]*0.001/2)*57.3 \[Degree]]*
Subscript[K, 2]);
Subscript[P, 3] =
1/0.00004*(-0.006487*
Sin[(i + Subscript[H, 2]*0.001/2)*57.3 \[Degree]] +
0.0015*If[0.1 < (i + Subscript[H, 2]*0.001/2) < 0.2,
1*S[(m + Subscript[P, 2]*0.001/2)],
If[-0.2 < (i + Subscript[H, 2]*0.001/2) < -0.1,
1*T[(m + Subscript[P, 2]*0.001/2)], 0]] -
0.000015*Sign[(m + Subscript[P, 2]*0.001/2)] -
0.00065*Cos[(i + Subscript[H, 2]*0.001/2)*57.3 \[Degree]]*
Subscript[K, 3]);
Subscript[P, 4] =
1/0.00004*(-0.006487*
Sin[(i + Subscript[H, 3]*0.001)*57.3 \[Degree]] +
0.0015*If[0.1 < (i + Subscript[H, 3]*0.001) < 0.2,
1*S[(m + Subscript[P, 3]*0.001)],
If[-0.2 < (i + Subscript[H, 3]*0.001) < -0.1,
1*T[(m + Subscript[P, 3]*0.001)], 0]] -
0.000015*Sign[(m + Subscript[P, 3]*0.001)] -
0.00065*Cos[(i + Subscript[H, 3]*0.001)*57.3 \[Degree]]*
Subscript[K, 4]);
q = q +
0.001/6*(Subscript[K, 1] + 2 Subscript[K, 2] +
2 Subscript[K, 3] + Subscript[K, 4]);
m = m +
0.001/6*(Subscript[P, 1] + 2 Subscript[P, 2] +
2 Subscript[P, 3] + Subscript[P, 4]);
i = i +
0.001/6*(Subscript[H, 1] + 2 Subscript[H, 2] +
2 Subscript[H, 3] + Subscript[H, 4]);
n = n +
0.001/6*(Subscript[L, 1] + 2 Subscript[L, 2] +
2 Subscript[L, 3] + Subscript[L, 4]);
j = j +
0.001/6*(Subscript[Z, 1] + 2 Subscript[Z, 2] +
2 Subscript[Z, 3] + Subscript[Z, 4]);
{i, j}, {u, 0, 100, 0.001}] // Simplify
(代码其实比较简单,就是复制粘贴比较多)
一次结果为
另一次为




