> For the complete documentation index, see [llms.txt](https://docs.kostacloud.com/llms.txt). This page is available as [Markdown](https://docs.kostacloud.com/kostacloud/advanced-optics-ray-trace/gradient-index-optics-grin.md).

# Gradient Index Optics (GRIN)

Gradient Index Optics Setup and Theory in KostaCLOUD

In tracing GRIN Optics rays follow curved trajectories due to Fermat's principal, for which in a inhomogeneous refractive media where index depends as a function of position, $$n(\vec{r})$$, we obtain (Ref 1):

$$
\delta\int n(\vec{r}) \text{d}s = 0
$$

By defining a parametric vector $$\vec{r}(s)$$, we can calculate components within the Cartesian Coordinate system, and then using calculus of variations we can obtain the following ray equation:

$$
\frac{\text{d}}{\text{d}s}(n(\vec{r}) \frac{\text{d}\vec{r}}{\text{d}s}) = \nabla n(\vec{r})
$$

We can now simply integrate this equation twice to calculate the ray trajectories from an initial position as follows:

$$
\vec{r}(s) = \int_0^s\frac{1}{n(\vec{r}(t'))}\int_0^{t'} \nabla n(\vec{r}(t)) \text{d}t\text{d}t'
$$

Finally we can calculate the trajectory using an ODE solver. This ODE solver utilizes a higher order symplectic energy loss minimization adaptive step methodology[^1] to determine optimal step size, and minimize computation time for computationally rigorous GRIN systems.

<figure><img src="/media/8d57b929177d1296150be8de3a876e99439e0c7d77d73d3c23fc46467cc9d44f.png" alt=""><figcaption><p>Example of Cascaded Luneberg, Maxwell Fisheye, and GRIN9 Profile in KostaCLOUD</p></figcaption></figure>

#### References

1. B. E. Saleh and M. C. Teich, Fundamentals of Photonics, John Wiley & Sons (2019).
2. Simon Tsaoussis, Hossein Alisafaee, "Ray tracing tool for arbitrary gradient index optical components," Proc. SPIE 11483, Novel Optical Systems, Methods, and Applications XXIII, 114830Y (21 August 2020); doi: 10.1117/12.2569760

[^1]: Proprietary Method
