# MATLAB expression manipulation

This is a simple exercise to use some Matlab expression manipulation functions. Our goal is to espress the product of two 64 Bit numbers as function of their 8 Bit sub groups. More precisely, we are going to use the following formula for 2n Bit data:

D = Dh*2^n + Dl

whereby D is a 2n Bit number, Dh are the upper n bits and Dl the lower n bits.
We multiply two Bit numbers, A and B, and we want to display the final analytical formula with matlab. The following code is very spartan, but it does the job:

The result is

(Ahhh*Bhhh)*2^112 + 2^104*(Ahhh*Bhhl + Ahhl*Bhhh) + 2^96*(Ahhl*Bhhl + Ahhh*Bhlh + Ahlh*Bhhh) + 2^88*(Ahhh*Bhll + Ahhl*Bhlh + Ahlh*Bhhl + Ahll*Bhhh) + 2^80*(Ahhl*Bhll + Ahll*Bhhl + Ahlh*Bhlh + Ahhh*Blhh + Alhh*Bhhh) + 2^72*(Ahlh*Bhll + Ahll*Bhlh + Ahhh*Blhl + Ahhl*Blhh + Alhh*Bhhl + Alhl*Bhhh) + 2^64*(Ahll*Bhll + Ahhl*Blhl + Alhl*Bhhl + Ahhh*Bllh + Ahlh*Blhh + Alhh*Bhlh + Allh*Bhhh) + 2^56*(Ahhh*Blll + Ahhl*Bllh + Ahlh*Blhl + Ahll*Blhh + Alhh*Bhll + Alhl*Bhlh + Allh*Bhhl + Alll*Bhhh) + 2^48*(Ahhl*Blll + Ahll*Blhl + Alhl*Bhll + Alll*Bhhl + Ahlh*Bllh + Allh*Bhlh + Alhh*Blhh) + 2^40*(Ahlh*Blll + Ahll*Bllh + Allh*Bhll + Alll*Bhlh + Alhh*Blhl + Alhl*Blhh) + 2^32*(Ahll*Blll + Alll*Bhll + Alhl*Blhl + Alhh*Bllh + Allh*Blhh) + 2^24*(Alhh*Blll + Alhl*Bllh + Allh*Blhl + Alll*Blhh) + 2^16*(Alhl*Blll + Alll*Blhl + Allh*Bllh) + 2^8*(Allh*Blll + Alll*Bllh) + Alll*Blll