mc_hit_or_miss_1d
Estimate definite integrals via hit-or-miss Monte Carlo; handles sign-changing integrands and returns signed estimates with confidence intervals.
Instructions
Estimate ∫ₐᵇ f(x) dx with the hit-or-miss Monte Carlo method.
Handles sign-changing integrands correctly (returns the signed integral).
Args: func_str: Math expression in x. a, b: Integration limits (b > a). N: Number of samples. seed: Optional RNG seed for reproducibility. precision: Rounding digits. nivel_confianza: Confidence level in (0, 1) for the interval. plot: When True, also return a PNG plot of the samples and f(x).
Returns:
Dict with the estimate, interval, sample statistics and history.
With plot=True a list [dict, Image] is returned instead.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"func_str": "<func_str>",
"a": "<a>",
"b": "<b>"
},
"name": "mc_hit_or_miss_1d"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| N | No | ||
| a | Yes | ||
| b | Yes | ||
| plot | No | ||
| seed | No | ||
| func_str | Yes | ||
| precision | No | ||
| nivel_confianza | No |