# [Maxima] Lumping constants in Maxima

Jako Nieuwoudt jako.nwd at gmail.com
Sat Mar 7 02:38:02 CST 2009

```Hi everyone,

While simultaneously solving some equations I managed to generate several (very) large equations in Maxima which I would like to reduce to a more manageable size by lumping the constants.  A simplified example equation would look like this:

theta = (((k1[1,1]*k2[1,1]+k1[1,1]*k3[1,1])*K1[1,2]*K2[1,2]*K3[1,2]*K4[1,2]*k1[2,1]*k2[2,1]+(k1[1,1]*k2[1,1]+k1[1,1]*k3[1,1])*K1[1,2]*K2[1,2]*K3[1,2]*K4[1,2]*k1[2,1]*k3[2,1])*K1[2,2]*K2[2,2]*K3[2,2]*K4[2,2]*k1[3,1]*x*y^4)/(((k1[1,1]*k2[1,1]+k1[1,1]*k3[1,1])*K1[1,2]*K2[1,2]*K3[1,2]*K4[1,2]*k1[2,1]*k2[2,1]+(k1[1,1]*k2[1,1]+k1[1,1]*k3[1,1])*K1[1,2]*K2[1,2]*K3[1,2]*K4[1,2]*k1[2,1]*k3[2,1])*K1[2,2]*K2[2,2]*K3[2,2]*K4[2,2]*k1[3,1]*K2[3,2]*y^5 + 1)

I would like to ask Maxima to see k1, k2, k3 and K1, K2, K3 and K4 as constants, look for repeating patterns of these constants and lump them as efficiently as possible.  I.e. for the above I want Maxima to arrive at the following:

a = ((k1[1,1]*k2[1,1]+k1[1,1]*k3[1,1])*K1[1,2]*K2[1,2]*K3[1,2]*K4[1,2]*k1[2,1]*k2[2,1]+(k1[1,1]*k2[1,1]+k1[1,1]*k3[1,1])*K1[1,2]*K2[1,2]*K3[1,2]*K4[1,2]*k1[2,1]*k3[2,1])*K1[2,2]*K2[2,2]*K3[2,2]*K4[2,2]*k1[3,1]

theta = (a*x*y^4)/(a*K2[3,2]*y^5 + 1)

I'm new at Maxima and have looked through the documentation, but haven't been able to find a way to do this.  I would appreciate any nudge in the right direction.

Thanks!

Jako
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20090307/a3c436a7/attachment.htm
```