# Dirdiff.m

From Spinach Documentation Wiki

Directional derivatives of the matrix exponential.

## Syntax

D=dirdiff(spin_system,A,B,T,N)

## Description

Implements Equation 11 of Najfeld and Havel (https://doi.org/10.1006/aama.1995.1017) and Equation 16 of Goodwin and Kuprov (http://dx.doi.org/10.1063/1.4928978)

## Arguments

A - a matrix B - a matrix or a cell array of matrices T - the time parameter in exp(A*T) that is being differentiated N - derivative order

If A an B are matrices, computes the N-th derivative of the matrix exponential exp(A*T) in the direction B. If B is a cell array, computes the mixed derivative of exp(A*T) in directions B{1}, B{2}, etc.

## Returns

D - the directional derivative

## Examples

This function is used by grape.m to compute propagator derivatives and by intrep.m to perform numeical rotating frame transformations.

## Notes

The auxiliary matrix method is massively faster than either commutator seroes or diagonalisation.

## See also

expmint.m, rotframe.m, intrep.m, grape.m

*Version 2.0, authors: Ilya Kuprov, David Goodwin*