> For the complete documentation index, see [llms.txt](https://docs.kostacloud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; 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="https://2927895027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvzB1GHTV5xshI62EhkCW%2Fuploads%2F3MOYSGsnOaLvDPEtdW03%2Fimage.png?alt=media&amp;token=c274dfe1-9bad-4ae2-81bd-9e7be514fcf5" 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
