# Gradient Index Optics (GRIN)

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="/files/MFQBqHpuPMcFAWEDdZ3J" 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kostacloud.com/kostacloud/advanced-optics-ray-trace/gradient-index-optics-grin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
