# \ev

Used in quantum mechanics to denote expectation values of operators

https://texform.dev/latex/commands/ev

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Physics: bra-ket](https://texform.dev/latex/topics/physics-braket) |
| Packages | physics |
| Allowed mode | math |
| Tags |  |
| Commonality | medium |
| Kind | prefix |

## Syntax

### physics

Argument specification: `s s m g`

Used in quantum mechanics to denote expectation values of operators

## Examples

```latex
\ev{A}
```

[Open in Playground](https://play.texform.dev/?input=%5Cev%7BA%7D)

```latex
\ev*{A}
```

[Open in Playground](https://play.texform.dev/?input=%5Cev*%7BA%7D)

```latex
\ev**{A}
```

[Open in Playground](https://play.texform.dev/?input=%5Cev**%7BA%7D)

```latex
\ev{A}{B}
```

[Open in Playground](https://play.texform.dev/?input=%5Cev%7BA%7D%7BB%7D)

```latex
\ev**{A}{B}
```

[Open in Playground](https://play.texform.dev/?input=%5Cev**%7BA%7D%7BB%7D)

## Renderer support

| Package | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- |
| physics | full | none | full |

## In TeXForm

TeXForm parses this entry as prefix syntax; the package determines its argument specification.

### Expands to (physics)

```latex
\ev{#1}{#2}
```

→

```latex
\left\langle{#2}\right\vert{#1}\left\vert{#2}\right\rangle
```

Depends on star modifiers. If no second argument, it's just \langle{#1}\rangle.

### [physics/expectation-expand](https://texform.dev/rules/physics/expectation-expand)

Expand expectation-value helpers to explicit angle brackets.

Level: faithful. Fidelity: render.

```latex
\ev{#1}
```

→

```latex
\left\langle #1 \right\rangle
```

```latex
\ev{H}_{\psi}=E_0
```

→

```latex
\left\langle H \right\rangle_{\psi}=E_0
```

## Equivalent forms

```latex
\expectationvalue{A}
```

exact. Long form of \ev

```latex
\expval{A}
```

exact. Alternative short alias

## See also

- [\\expectationvalue](https://texform.dev/latex/commands/expectationvalue)
- [\\expval](https://texform.dev/latex/commands/expval)

## Test cases

### physics

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \ev{a} | Positive: baseline | Pass | Fail | Pass |
| \ev*{a} | Positive: vary:s[0] | Pass | Fail | Pass |
| \ev{a}{b} | Positive: vary:g[3] | Pass | Fail | Pass |
| \ev**{a}{b} | Positive: maximal | Pass | Fail | Pass |
| \ev a | Positive: bare[2] | Pass | Fail | Pass |
