### The Maxima on-line user's manual

Algebra Calculator

#### Backtrace

Function: backtrace ()

Function: backtrace (<n>) Prints the call stack, that is, the list of functions which called the currently active function.

`backtrace()` prints the entire call stack.

`backtrace (<n>)` prints the <n> most recent functions, including the currently active function.

`backtrace` can be called from a script, a function, or the interactive prompt (not only in a debugging context).

Examples:

* `backtrace()` prints the entire call stack.

```               (%i1) h(x) := g(x/7)\$
(%i2) g(x) := f(x-11)\$
(%i3) f(x) := e(x^2)\$
(%i4) e(x) := (backtrace(), 2*x + 13)\$
(%i5) h(10);
#0: e(x=4489/49)
#1: f(x=-67/7)
#2: g(x=10/7)
#3: h(x=10)
9615
(%o5)                         ----
49```

* `backtrace (<n>)` prints the <n> most recent functions, including the currently active function.

```               (%i1) h(x) := (backtrace(1), g(x/7))\$
(%i2) g(x) := (backtrace(1), f(x-11))\$
(%i3) f(x) := (backtrace(1), e(x^2))\$
(%i4) e(x) := (backtrace(1), 2*x + 13)\$
(%i5) h(10);
#0: h(x=10)
#0: g(x=10/7)
#0: f(x=-67/7)
#0: e(x=4489/49)
9615
(%o5)                         ----
49```

```(%o1)                                true
(%i2) ```

? backtrace;

Calculate

backtrace (5);

Calculate

h(x) := g(x/7);

g(x) := f(x-11);

f(x) := e(x^2);

Calculate

? backtrace;

Calculate

backtrace (5);

Calculate

h(x) := g(x/7);

g(x) := f(x-11);

f(x) := e(x^2);

Calculate