输入、输出和文本位于一个 Mathematica 单元中?
我希望能够混合文本和计算。像这样的事情:
巴拉巴拉巴拉...
blah blah ...平均质量为 (m1 + m2 + m3)/3 = 23.4 g ...blah blah
哈哈哈哈哈哈……
其中“(m1...)/3”是输入,“23.4”是输出。现在我只知道如何在一个单元格中显示输入,并在其下面的另一个单元格中显示输出。
这可能吗?
更新:我想将这些计算位包含在较大的写作块中,所以我不确定如何按照 Koantig 的建议使用 Print 语句,因为似乎我必须连接整个段落/单元格的值字符串和样式。
谢谢,
抢
I'd like to be able to mix text and computation. Something like this:
blah blah blah ...
blah blah ... The average mass is (m1 + m2 + m3)/3 = 23.4 g ... blah blah
blah blah blah ...
Where the "(m1... )/3" is the input, and the "23.4" is the output. Right now I only know how to show input in one cell, and the output in another cell below it.
Is this possible?
Update: I want to include these bits of computation in the midst of larger blocks of writing, so I'm not sure how to use a Print statement as Koantig suggested, because it seems I'd have to concatenate an entire paragraph/cell worth of strings and styles.
thanks,
Rob
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想您已在文本单元格中输入了表达式。如果您突出显示要计算的表达式,在您的情况下
,然后按 Shift+Ctrl+Enter(在我的 Windows 盒子上,不确定您的盒子是否如此,但如果您更喜欢菜单,则可以使用选项
Evaluation | Evaluate in Place
),那么你的表达式将被评估它的结果所取代。我知道这并不完全是你想要的,但这是我发现自己最接近的。我将表达式复制到 = 符号的右侧并计算副本。我希望很快就会有人告诉我们执行此操作的明智方法。
I suppose that you have entered your expression in a text cell. If you highlight the expression to evaluate, in your case
and hit Shift+Ctrl+Enter (on my Windows box, not sure about your box, but it's option
Evaluation | Evaluate in Place
if you prefer the menu), then your expression will be replaced by the result of evaluating it. I know that this is not exactly what you want, but it's the closest I have found myself. I copy the expression to the rhs of the = sign and evaluate the copy.I expect that someone will come along soon and tell us the smart way to do this.
也许是这样的?
结果:
Maybe something like this?
The result:
对于较小的项目,我有一个草稿笔记本和一个演示笔记本。计算在草稿笔记本中执行,然后复制到演示笔记本中。
对于较大的项目,我将计算附加到节标题,然后将节向下折叠到标题以进行演示。仍然是剪切和粘贴。
我曾经编写了一个笔记本,它将一对草稿/演示笔记本解析为最终笔记本,其中演示笔记本的特殊标记部分被在草稿笔记本上下文中计算的结果替换。这实在是太难维持了,所以我再也没有重复过这种经历。
您想要哪一个:要计算的可见的、可编辑的表达式,还是(过去)计算的死的、固定的结果?
For smaller projects, I have a scratch notebook and a presentation notebook. Calculations are performed in the scratch notebook, then copied into the presentation notebook.
For larger projects, I attach the computations to the section headers, then fold the section down to just the header for presentation purposes. There's still cutting and pasting.
I have once written a notebook that parsed a pair of scratch/presentation notebooks into a final notebook where specially marked sections of the presentation notebook were replaced with results computed in the context of the scratch notebook. This was sufficiently difficult to maintain that I have never repeated the experience.
Which did you want: visible, editable expressions to be evaluated, or dead, fixed results of (past) evaluations?