Maxima Function
multthru (expr)
multthru(expr_1,expr_2)
Multiplies a factor (which should be a sum) of expr by
the other factors of expr. That is, expr is f_1 f_2 ... f_n
where at least
one factor, say f_i, is a sum of terms. Each term in that sum is
multiplied by the other factors in the product. (Namely all the
factors except f_i). multthru
does not expand exponentiated sums.
This function is the fastest way to distribute products (commutative
or noncommutative) over sums. Since quotients are represented as
products multthru
can be used to divide sums by products as well.
multthru (expr_1, expr_2)
multiplies each term in expr_2 (which should be a
sum or an equation) by expr_1. If expr_1 is not itself a sum then this
form is equivalent to multthru (expr_1*expr_2)
.
(%i1) x/(x-y)^2 - 1/(x-y) - f(x)/(x-y)^3; 1 x f(x) (%o1) - ----- + -------- - -------- x - y 2 3 (x - y) (x - y) (%i2) multthru ((x-y)^3, %); 2 (%o2) - (x - y) + x (x - y) - f(x) (%i3) ratexpand (%); 2 (%o3) - y + x y - f(x) (%i4) ((a+b)^10*s^2 + 2*a*b*s + (a*b)^2)/(a*b*s^2); 10 2 2 2 (b + a) s + 2 a b s + a b (%o4) ------------------------------ 2 a b s (%i5) multthru (%); /* note that this does not expand (b+a)^10 */ 10 2 a b (b + a) (%o5) - + --- + --------- s 2 a b s (%i6) multthru (a.(b+c.(d+e)+f)); (%o6) a . f + a . c . (e + d) + a . b (%i7) expand (a.(b+c.(d+e)+f)); (%o7) a . f + a . c . e + a . c . d + a . b