gpt4 book ai didi

wolfram-mathematica - 方程线程 : Why the default behavior?

转载 作者:行者123 更新时间:2023-12-04 11:18:13 27 4
gpt4 key购买 nike

我最近重新发现了 Roman Maeder 的一个小包,它告诉 Mathematica 自动将算术和类似函数线程化到诸如 x == y 之类的表达式上。 Link to Maeder's package.

首先,为了演示,这里是 Maeder 给出的一个例子:

In[1]:= Needs["EqualThread`"]

现在继续使用线程行为来“手动”求解 x 的以下方程:
In[7]:= a == b Log[2 x]
In[8]:= %/b
Out[8]:= a/b == Log[2 x]

现在求幂:
In[9]:= Exp[%]
Out[9]= E^(a/b) == 2 x

并除以 2:
In[10]:= %/2
Out[10]= (E^(a/b))/2 == x

问:从设计的角度来看,有人可以解释为什么 Mathematica 默认设置为这种方式吗?自动线程似乎是 Mathematica 初学者所期望的行为类型——至少对我来说——也许有人可以提供一两个例子,这会导致整个系统出现问题。 (并随时指出任何数学上的无知......)

最佳答案

考虑算术运算时似乎很自然。但情况并非总是如此。

当我写

Boole[a==b]  

我不要
Boole[a] == Boole[b]  

这就是 Maeder 的软件包所做的。

编辑

在下面回答您的评论:

I noticed that Boole[] was added in v.5.2, whereas Maeder's package was authored for v.3. I guess the core of my question still revolves around the 'design' issue. I mean, how would one get around the issue you pointed out? To me, the clearest path would be declaring something about variables you're working with, no? -- What puzzles me is the way you can generally only do this with Assumptions (globally or as an option to Simplify, etc). Anyone else think it would be more natural to have a full set of numerical Attributes? (in this regard, the Constant Attribute is a tease)



我的回答绝不是对 Maeder 的包装的批评,这很好,但声明它不应该成为治疗的主流方式 等于[ ] 在妈妈。

Equal[ ] 是一个函数,一开始不是特别容易掌握:
  • 如果 lhs 和 rhs 相同,则返回 True
  • 如果通过比较数字或其他原始数据(例如字符串)确定 lhs 和 rhs 不相等,则返回 False。
  • 当 lhs 或 rhs 包含诸如 Indeterminate 和 Overflow 之类的对象时,将保持未计算。
  • 用于表示符号方程,可使用 Solve 等函数进行操作。

  • 据我了解,Maeder 的包的意图与您的非常一致,是赋予表达式 lhs == rhs 人类在做数学时使用的相同含义和操作规则。

    在数学中,等式是一种等价关系,在集合中强加偏序,而等式是断言表达式通过该特定关系相关联。

    将这些差异与其他 Mma“功能”进行比较。 罪[x] 在 Mma 中,在通常的数学中是同样的事情(好吧,几乎),大多数 Mma 野兽也可以这样说。然而,有一些 Mma 结构并不与数学概念保持完全同构:Equal、SameQ、Equivalent 等。它们是从数学世界到编程世界的桥梁。它们不是严格的数学概念,而是经过修改的编程概念来容纳它们。

    对不起,如果我在哲学方面有点。

    哼!

    关于wolfram-mathematica - 方程线程 : Why the default behavior?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5701159/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com