mathematica, 如何在结果中去掉括号{}?
发布网友
发布时间:2024-05-03 09:45
我来回答
共2个回答
热心网友
时间:2024-11-26 21:38
希望对你有所帮助:
输入:
result =
NDSolve[{h''[x]/(1 + (h'[x])^2)^(3/2) - h[x]/2 == 0, h[1] == 2,
h'[2] == 1}, h[x], {x, 1, 2}]; // Quiet
Column[Table[h[x] /. result[[1]], {x, 1, 2, 0.1}]]
输出(你自己执行以下就会发现中括号没了):
\!\(\*
TagBox[GridBox[{
{"2.`"},
{"1.9739365556714714`"},
{"1.9584205191082824`"},
{"1.9528880981568602`"},
{"1.9571482118965418`"},
{"1.9713475539047176`"},
{"1.995997270438247`"},
{"2.032073553928077`"},
{"2.0812443481187106`"},
{"2.1463719884166874`"},
{"2.2327706657483635`"}
},
GridBoxAlignment->{"Columns" -> {{Left}}},
GridBoxItemSize->{
"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}],
"Column"]\)
热心网友
时间:2024-11-26 21:38
修改成如下即可:
result = NDSolve[{h''[x]/(1 + (h'[x])^2)^(3/2) - h[x]/2 == 0,
h[1] == 2, h'[2] == 1}, h[x], {x, 1, 2}][[1]];
Column[Table[h[x] /. result, {x, 1, 2, 0.1}]]
多加了一个[[1]]代表取括号内的第一项,因为括号里只有一项,而且是数字,所以只会显示数字,不会有括号,对于括号的其它呈现形式都可以用此方法处理!