用于输入从实数到实数的函数的 Web UI,例如概率分布
我想要一个网络界面,供用户描述一维实值函数。我想象用户会看到一对空白的轴,他们可以单击任意位置来创建粗且可拖动的点。比如说,双击一个点,它就会消失。实际函数应作为用户提供的点的插值实时显示。
这是在 Mathematica 中实现的样子(当然我正在寻找 javascript 中的东西):
(来源:yootles.com)
I would like a web interface for a user to describe a one-dimensional real-valued function. I'm imagining the user being presented with a blank pair of axes and they can click anywhere to create points that are thick and draggable. Double-clicking a point, let's say, makes it disappear. The actual function should be shown in real time as an interpolation of the user-supplied points.
Here's what this looks like implemented in Mathematica (though of course I'm looking for something in javascript):
(source: yootles.com)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您的网站用户安装了新的 CDF 播放器插件,他们将能够使用您编写的上述示例!
虽然我还没有这方面的经验,但我相信 CDF 文件代码会直接放入您的页面中,并且会在启用正确的 MIME 类型的情况下自动加载。
以下是嵌入在博客文章中的实时可操作界面的示例: Mathematica:网络浏览器中的交互式数学< /a>.
很酷吧?
If your website users install the new CDF player plugin, they will be able to work with the above example you coded!!
While I have no experience with this yet, I believe the CDF file code drops directly into your page and will load automatically with the correct MIME type enabled.
Here is an example of a live manipulatable interface embedded in a blog post: Mathematica: Interactive mathematics in the web browser.
Cool, huh?
请记住,概率分布在整个运行过程中必须是单调非递减的,而您的示例并非如此。更糟糕的是,这个小下降并不是由于用户错误造成的——它们的分数根据需要而增加——而是插值方法的产物。如果您使用线性插值,那么任何非单调性都是您的用户的错,您可以警告他们。
Remember that a probability distribution has to be monotonically non-decreasing over its entire run, which your example is not. Even worse, that small dip is not due to user error -- their points are increasing as required -- but is an artifact of the interpolation method. If you use linear interpolation, then any non-monotonicity is your user's fault, and you can warn them.
Dan Goldstein 的 Distribution Builder 工具有一个替代界面得出概率分布。
The Distribution Builder tool by Dan Goldstein has an alternative interface for eliciting probability distributions.