dreeves
dreeves

Reputation: 26942

Web UI for inputting a function from the reals to the reals, such as a probability distribution

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)

Upvotes: 2

Views: 158

Answers (3)

telefunkenvf14
telefunkenvf14

Reputation: 1011

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?

Upvotes: 2

dreeves
dreeves

Reputation: 26942

The Distribution Builder tool by Dan Goldstein has an alternative interface for eliciting probability distributions.

Upvotes: 0

Amos Newcombe
Amos Newcombe

Reputation: 136

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.

Upvotes: 0

Related Questions