# Apply a Jacobian-vector product

`(jvp function primals tangents)` returns `(values output output-tangent)`.
`primals` is a list or vector of the original arguments; `tangents` has one
matching tangent tree per argument. The output tangent has the output's tree
structure, shared leaves and leaf shapes.

```sh
sexpgpu probe --expr '(jvp (lambda (x) (* x x)) (list (full [] 3.0)) (list (full [] 2.0)))' --max-elements 100
```

The results are `9.0` and `12.0`: the direction `2.0` multiplies the derivative
`6.0`.

Input and output leaves are floating tensors. Each input tangent matches its
primal's structure, keys, shared leaves, shape and kind. Capture integer inputs
outside the differentiated function. Random draws contribute to the primal and
have zero tangent; the derivative uses those same realized values.

`jvp` composes with [grad](https://sx.041.io/docs/grad.md), [vjp](https://sx.041.io/docs/vjp.md) and [scan](https://sx.041.io/docs/tensors.md#scan),
including forward-over-reverse in a scan body. When carried tangent dependencies
change across trips, compilation time can grow with `:length`. It performs no
per-step host function evaluation. Reporting and state declarations use
`E-TRANSFORM-003`; invalid signatures or trees use `E-TRANSFORM-001`,
`E-TRANSFORM-002` or `E-TREE-001`. An unsupported derivative operation is named
by `E-TRANSFORM-004`.

---

SexpGPU documentation. Every page: https://sx.041.io/llms.txt
