在更高的抽象水平上进行概率计算 [英] Doing probabilistic calculations on a higher abstraction level

查看:129
本文介绍了在更高的抽象水平上进行概率计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

致低俗人士:这不是关于数学的问题,而是 有关编程语言 Mathematica 的问题.

To the downvoters: this isn't a question about mathematics, it's a question about the programming language Mathematica.

Mathematica的主要特征之一是它可以象征性地处理许多事情.但是,如果您考虑一下,许多符号功能实际上只是符号的一半.

One of the prime characteristics of Mathematica is that it can deal with many things symbolically. But if you come to think about it, many of the symbolic features are actually only halfway symbolic.

以矢量为例.我们可以有一个像{x,y,z}这样的符号向量,用一个充满符号的矩阵进行矩阵乘法,最后得到一个符号结果,因此我们可以考虑那个符号向量代数.但是我们都知道,开箱即用,Mathematica不允许您说符号 x 是矢量,并且给定了矩阵 A A . x 也是一个向量.那是更高的抽象层次,而Mathematica(目前)还没有很好地处理这一层次.

Take vectors for instance. We can have a symbolic vector like {x,y,z}, do a matrix multiplication with a matrix full of symbols and end up with a symbolic result and so we might consider that symbolic vector algebra. But we all know that, right out of the box, Mathematica does not allow you to say that a symbol x is a vector and that given a matrix A, A . x is a vector too. That's a higher level of abstraction, one that Mathematica (currently) does not very well deal with.

同样,Mathematica知道如何找到仅用符号定义的函数的五阶导数,但它不适用于寻找 r 导数(请参见"当r在Mathematica中是符号时,如何找到函数的rth导数?问题).

Similarly, Mathematica knows how to find the 5th derivative of a function that's defined in terms of nothing than symbols, but it's not well geared towards finding the r th derivative (see the "How to find a function's rth derivative when r is symbolic in Mathematica?" question).

此外,Mathematica具有广泛的布尔代数功能,有些古老的历史了,但许多是最近在版本7中获得的.在版本8中,我们获得了概率和朋友(例如有条件的)使我们能够以随机变量的概率进行推理具有给定的分布.这是一个非常了不起的补充,它帮助我非常熟悉此域,并且我非常喜欢使用它.但是...

Furthermore, Mathematica has extensive Boolean algebra capabilities, some stone age old, but many recently obtained in version 7. In version 8 we got Probability and friends (such as Conditioned) which allows us to reason with probabilities of random variables with given distributions. It's a really magnificent addition which helps me a lot in familiarizing myself with this domain, and I enjoy working with it tremendously. However,...

我正在与一位同事讨论概率逻辑的某些规则,例如熟悉的

I was discussing with a colleague certain rules of probabilistic logic like the familiar

即给定事件/状态/结果 A 的事件/状态/结果 C 的条件概率为真.

i.e., the conditional probability of event/state/outcome C given event/state/outcome A is true.

具体地说,我们正在看这个:

Specifically, we were looking at this one:

,尽管在​​我意识到我不知道如何立即使用Mathematica解决这一问题之前,我已经对Mathematica的Probability进行了高度评价.同样,就像抽象向量和矩阵以及符号导数一样,这似乎太高了抽象水平.还是吗?我的问题是:

and although I had spoken highly about Mathematica's Probability just before I realized that I wouldn't know how to solve this right away with Mathematica. Again, just as with abstract vectors and matrices, and symbolic derivatives, this seems to be an abstraction level too high. Or is it? My question is:

您能找到一种使用Mathematica程序在上述方程式和相似方程式中找到真假的方法吗?

Could you find a way to find the truth or falsehood in the above and similar equations using a Mathematica program?

推荐答案

>> Mathematica不允许您说符号x是矢量

确定它确实...反正足够近了...它是Reals的集合.根据您要执行的操作,这称为假设或条件.

Sure it does... Close enough anyway... that it's a collection of Reals. It's called assumptions or conditioning, depending on what you want to do.

Refine[Sqrt[x]*Sqrt[y]]

由于假设X和Y可以是任何符号,因此上述内容并未完善,但是如果缩小范围,则会得到结果:

The above doesn't refine because it assumes X and Y can be any symbol, but if you narrow their scope, you get results:

Assuming[ x > 0 && y > 0, Refine[Sqrt[x]*Sqrt[y]]]

很高兴能够说:Element[x,Reals^2](二维实向量),也许在Mathematica 9中.:-)

It would be very nice to have the ability to say: Element[x,Reals^2] (2-dimensional real vector), maybe in Mathematica 9. :-)


至于此问题:


As for this problem:

>>您能找到一种使用Mathematica程序在上述方程式和相似方程式中找到真假的方法吗?

请参阅我对这个问题的答案(第一个),以了解贝叶斯定理的一种符号方法: https://stackoverflow.com/问题/8378336/如何在数学中解决条件概率是可能的

Please refer to my answer (first one) on this question to see a symbolic approach to Bayes theorem: https://stackoverflow.com/questions/8378336/how-do-you-work-out-conditional-probabilities-in-mathematica-is-it-possible

这篇关于在更高的抽象水平上进行概率计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆