# successive calls to maxima

I have found, and have read, a bit on calling Maxima from Sage but I have only seen simple one-time calls like

```
maxima.eval('4*x');
```

What I want to do is this (which is a *.sage file I call from the terminal using ./sage file.sage).

```
print("In Sage input file");
d = maxima.eval('halt (r,s,zeta,rho) := (1-Q*rho^r)-zeta*rho^s*(1-rho^r)');
d2 = maxima.eval('elem([2,e12,e22],elem([2,e11,e21],halt(2,1,zeta1,rho11)+diff(halt(2,1,zeta2,rho12),rho12)+halt(2,1,zeta2,rho22),[rho11,rho21]),[rho12,rho22])');
print d2;
d3 = maxima.eval('subst(R,e11,d2');
print d3;
```

But `print d3' just gives me 'd2'.... I'm sure this is very very simple but I haven't found it yet.

Thanks!