Mathematica 结果输出文件的换行???
如何修改下面的程序,是的每次输出一个h的值后,都换行一次,谢谢fname=FileNameJoin[{"out.txt"}];s=OpenWrite[fname]Writ...
如何修改下面的程序,是的每次输出一个h的值后,都换行一次,谢谢
fname = FileNameJoin[{"out.txt"}];
s = OpenWrite[fname]
Write[s, Table[FindRoot[h*h == a, {h, 1}], {a, 0, 10, 1}]]
Close[s]
FilePrint[FileNameJoin[{"out.txt"}]] 展开
fname = FileNameJoin[{"out.txt"}];
s = OpenWrite[fname]
Write[s, Table[FindRoot[h*h == a, {h, 1}], {a, 0, 10, 1}]]
Close[s]
FilePrint[FileNameJoin[{"out.txt"}]] 展开
1个回答
展开全部
fname = FileNameJoin[{"out.txt"}];
s = OpenWrite[fname]
Write[s, #] & /@ Table[FindRoot[h*h == a, {h, 1}], {a, 0, 10, 1}]
Close[s]
FilePrint[FileNameJoin[{"衡知out.txt"}]]
结果是衫迹
{h ->或拦并 7.450580596923828*^-9}
{h -> 1.}
{h -> 1.4142135623730951}
{h -> 1.7320508075688772}
{h -> 2.000000000000002}
{h -> 2.23606797749979}
{h -> 2.4494897427831797}
{h -> 2.6457513110645907}
{h -> 2.82842712474619}
{h -> 3.}
{h -> 3.162277660168379}
s = OpenWrite[fname]
Write[s, #] & /@ Table[FindRoot[h*h == a, {h, 1}], {a, 0, 10, 1}]
Close[s]
FilePrint[FileNameJoin[{"衡知out.txt"}]]
结果是衫迹
{h ->或拦并 7.450580596923828*^-9}
{h -> 1.}
{h -> 1.4142135623730951}
{h -> 1.7320508075688772}
{h -> 2.000000000000002}
{h -> 2.23606797749979}
{h -> 2.4494897427831797}
{h -> 2.6457513110645907}
{h -> 2.82842712474619}
{h -> 3.}
{h -> 3.162277660168379}
来自:求助得到的回答
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询