- 积分
- 0
- 注册时间
- 2008-6-5
- 仿真币
-
- 最后登录
- 1970-1-1
|
下面两段程序,感觉应该是同样的结果,但是却不同。请高手指点!
第一段程序:
\!\(\*
RowBox[{\(c\_11 = \((2.1`30)\)*10^11; c\_13 = \((1.05`30)\)*10^11;
c\_33 = \((2.11`30)\)*10^11; c\_44 = \((0.423`30)\)*10^11;\),
"\[IndentingNewLine]", \(e\_15 = \(-0.48`30\); e\_31 = \(-0.573`30\); \
e\_33 = 1.321`30;\), "\[IndentingNewLine]", \(pϵ\_11 = 8.55`30;
pϵ\_33 = 10.2`30;\), "\[IndentingNewLine]", \(pρ =
5670`30;\), "\[IndentingNewLine]",
RowBox[{\(FPiezo[GC_]\), ":=",
RowBox[{"Module", "[",
RowBox[{\({Tp, K, DK, a1, a2, a3, a4, b, de, V}\), ",",
RowBox[{\(V = GC\), ";", "\[IndentingNewLine]",
RowBox[{"K", "=",
RowBox[{"(", GridBox[{
{\(c\_11 + c\_44*b\^2 - pρ*
V\^2\), \(\((c\_13 + c\_44)\)*b\), \(\((e\_15 + e\_31)\)*b\)},
{\(\((c\_13 + c\_44)\)*b\), \(c\_44 + c\_33*b\^2 - pρ*
V\^2\), \(e\_15 + e\_33*b\^2\)},
{\(\((e\_15 + e\_31)\)*
b\), \(e\_15 + e\_33*b\^2\), \(-\((pϵ\_11 + pϵ\_33*b\^2)\)\)}
}], ")"}]}],
";", "\[IndentingNewLine]", \(DK = Det[K]\), ";",
"\[IndentingNewLine]", \(a1 = Coefficient[DK, b,
6]\), ";", \(a2 = Coefficient[DK, b, 4]\), ";", \(a3 = Coefficient[DK,
b, 2]\),
";", \(a4 = Coefficient[DK, b, 0]\),
";", "\[IndentingNewLine]", \(Tp =
Solve[a1\ x^6 +
a2\ x^4 + a3\ x^2 + a4 == 0, x]\), ";
", "\[IndentingNewLine]", \(pdecay =
Array[de, {1, 6}]\), ";
", "\[IndentingNewLine]", \(Do[pdecay[\([1, m]\)] = Tp[\([m, \
1, 2]\)], {m, 6}]\),
";", "\[IndentingNewLine]",
"pdecay"}]}], "]"}]}], "\[IndentingNewLine]", \(F1[GC_] :=
Module[{}, temp = FPiezo[GC];
Im[temp[\([1, 1]\)]]]\), "\[IndentingNewLine]", \(Plot[
F1[x], {x, 0, 2000}]\)}]\)
第二段程序:
\!\(\*
RowBox[{\(c\_11 = \((2.1`30)\)*10^11; c\_13 = \((1.05`30)\)*10^11;
c\_33 = \((2.11`30)\)*10^11; c\_44 = \((0.423`30)\)*10^11;\),
"\[IndentingNewLine]", \(e\_15 = \(-0.48`30\); e\_31 = \(-0.573`30\); \
e\_33 = 1.321`30;\), "\[IndentingNewLine]", \(pϵ\_11 = 8.55`30;
pϵ\_33 = 10.2`30;\), "\[IndentingNewLine]", \(pρ =
5670`30;\), "\[IndentingNewLine]",
RowBox[{\(FPiezo[GC_]\), ":=",
RowBox[{"Module", "[",
RowBox[{\({Tp, K, DK, a1, a2, a3, a4, b, de, V}\), ",",
RowBox[{\(V = GC\), ";", "\[IndentingNewLine]", \(Teq =
Solve[a1\ x^6 + a2\ x^4 +
a3\ x^2 + a4 == 0, x]\), ";", "\[IndentingNewLine]",
RowBox[{"K", "=",
RowBox[{"(", GridBox[{
{\(c\_11 +
c\_44*b\^2 - pρ*V\^2\), \(\((c\_13 + c\_44)\)*b\), \(\((e\_15 + e\_31)\)*
b\)},
{\(\((c\_13 + c\_44)\)*b\), \(c\_44 + c\_33*
b\^2 - pρ*V\^2\), \(e\_15 + e\_33*b\^2\)},
{\(\((e\_15 +
e\_31)\)*b\), \(e\_15 + e\_33*b\^2\), \(-\((pϵ\_11 + pϵ\_33*b\^2)\)\)}
}], ")"}]}], ";", "\[IndentingNewLine]", \(DK = Det[K]\),
";", "\[IndentingNewLine]", \(Tp = Teq //. {a1 -> Coefficient[DK,
b, 6], a2 -> Coefficient[DK, b, 4],
a3 -> Coefficient[DK, b, 2], a4 -> Coefficient[DK, b,
0]}\), ";",
"\[IndentingNewLine]", \(pdecay = Array[de, {1, 6}]\), ";",
"\[IndentingNewLine]", \(Do[pdecay[\([1, m]\)] = \
Tp[\([m, 1, 2]\)], {m, 6}]\),
";", "\[IndentingNewLine]", "pdecay"}]}], "]"}]}],
"\[IndentingNewLine]", \(F1[GC_] := Module[{}, temp =
FPiezo[GC]; Im[
temp[\([1, 1]\)]]]\), "\[IndentingNewLine]", \(Plot[F1[x], {x,
0, 2000}]\)}]\)
这两段程序的区别是,第一段程序直接求解了一个系数已经确定了的一员六次方程,儿第二段程序是先求解了一个系数待定的一员六次方程再将系数值代入。 |
|