Skip to content

Checking your reading list…

Retry verification

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

Estimating Projectile Hit Probability Inside an Ellipse with Monte Carlo and Numerical Integration
Fundamentals 3 min read

Estimating Projectile Hit Probability Inside an Ellipse with Monte Carlo and Numerical Integration

This article demonstrates how to compute the probability that a projectile, whose impact points follow a bivariate normal distribution with 100 m standard deviations, lands inside a given elliptical target by comparing analytical numerical integration with a Monte Carlo simulation implemented in Python.

Problem

The target of the artillery fire is the region enclosed by an ellipse centered at the origin. When aiming at the center, random deviations cause the impact point to differ from the center. Assume the impact points are distributed around the target center as a two‑dimensional normal distribution with standard deviations of 100 m in both x and y directions, independent of each other. Use Monte Carlo simulation to compute the probability that the projectile lands inside the ellipse and compare it with the probability obtained by numerical integration.

Ellipse diagram
Ellipse diagram

Solution

Let (X, Y) denote the random impact point. Its joint probability density function is

The probability that the projectile lands inside the ellipse \(x^2/120^2 + y^2/80^2 \le 1\) is

Numerical integration result
Numerical integration result

Using Python’s numerical integration (scipy.integrate.dblquad) we obtain the value (approximately 0.376).

We can also estimate the probability with Monte Carlo. Simulating N = 1,000,000 shots, counting the number that satisfy the ellipse condition, and dividing by N gives an approximate probability around 0.3754.

Code

import numpy as np
from scipy.integrate import dblquad
fxy=lambda x,y: 1/(20000*np.pi)*np.exp(-(x**2+y**2)/20000)
bdy=lambda x: 80*np.sqrt(1-x**2/120**2)
p1=dblquad(fxy,-120,120,lambda x:-bdy(x),bdy)
print("Probability (numerical integration):", p1)
N=1000000; mu=[0,0]; cov=10000*np.identity(2);
a=np.random.multivariate_normal(mu,cov,size=N)
n=((a[:,0]**2/120**2 + a[:,1]**2/80**2) <= 1).sum()
p2=n/N; print('Probability (Monte Carlo):', p2)

Source: S. Shougui, S. Xijing. Python Mathematics Experiments and Modeling (2020). Science Press.

About this article

For questions about attribution, corrections or content rights, please contactadmin@besthub.devand we will review it promptly.

Report an issue with this article
PythonMonte CarloNumerical IntegrationBivariate Normal Distribution

Reader feedback

Was this useful?

Useful0

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion