← All tool references

Math · not_available

Expected Value Calculator

Calculate probability-weighted expected value.

Open public tool

Overview

Category
Math
API mode
not_available
Processing
client-side
Privacy
no-data-stored

Public descriptor

The descriptor is available without an API key and supplies this tool’s metadata, schemas, modes, and examples.

GET /api/v1/tools/expected-value-calculator

View this descriptor as JSON

Execute availability

This tool is documented as a browser capability. Its execute route does not produce a server-side result; when execution is enabled, it responds with browser_interaction_required and points callers to the public tool page.

POST /api/v1/tools/expected-value-calculator/execute

Authentication is not issued during the preview. A bearer API key is planned for execution after launch.

Input schema

object object; additional properties are not accepted.

outcomes · string · required
Enter outcome | probability per line.
{
    "type": "object",
    "properties": {
        "outcomes": {
            "type": "string",
            "description": "Enter outcome | probability per line."
        }
    },
    "required": [
        "outcomes"
    ],
    "additionalProperties": false
}

Output schema

On a successful execution, schema values appear in data.result.values.

expected_value · number
Expected value calculated by the tool.
probability_total · number
Probability total calculated by the tool.
variance · number
Outcome variance calculated by the tool.
rows · array
Weighted outcomes calculated by the tool.
{
    "type": "object",
    "properties": {
        "expected_value": {
            "type": "number",
            "description": "Expected value calculated by the tool."
        },
        "probability_total": {
            "type": "number",
            "description": "Probability total calculated by the tool."
        },
        "variance": {
            "type": "number",
            "description": "Outcome variance calculated by the tool."
        },
        "rows": {
            "type": "array",
            "description": "Weighted outcomes calculated by the tool."
        }
    },
    "additionalProperties": false
}

Expected Value Calculator worked example

The request body follows the published input schema. The response below shows the success-envelope shape returned after execution is available.

curl -X POST "https://utilitypages.org/api/v1/tools/expected-value-calculator/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "outcomes": "100|0.25\n20|0.50\n-40|0.25"
}'
{
    "ok": true,
    "data": {
        "slug": "expected-value-calculator",
        "result": {
            "values": {
                "expected_value": 25,
                "probability_total": 1,
                "variance": 2475,
                "rows": [
                    {
                        "outcome": 100,
                        "probability": 0.25,
                        "weighted_outcome": 25
                    },
                    {
                        "outcome": 20,
                        "probability": 0.5,
                        "weighted_outcome": 10
                    },
                    {
                        "outcome": -40,
                        "probability": 0.25,
                        "weighted_outcome": -10
                    }
                ]
            },
            "display": {
                "display": "25"
            },
            "warnings": [],
            "assumptions": [],
            "steps": []
        }
    },
    "meta": [],
    "request_id": "req_example_123"
}

Errors

api_not_launched · 503
Returned by the current launch gate for every execute request.
invalid_json · 400
Returned when an enabled execute request does not contain valid JSON.
validation_failed · 422
Returned when a request does not satisfy the input schema.
browser_interaction_required · 422
Returned for browser capability tools instead of inventing a server-side result.
tool_not_found · 404
Returned when a requested descriptor slug does not exist.
execution_failed · 503
Returned when an enabled server-side execution cannot complete.