Previous Up Next

5.13.23  Substitute a subexpression by another expression: algsubs

The algsubs command takes two arguments, an equation expr1 = expr2 between two expressions and another expression.
algsubs returns the last expression with expr1 replaced by expr2.
Input:

algsubs (x^2 = u, 1 + x^2 + x^4)

Output:

u^2 + u + 1

Input:

algsubs (a*b/c = d, 2*a*b^2/c)

Output:

2*b*d

Input:

algsubs (2a = p^2-q^2, algsubs (2c = p^2 + q^2, c^2-a^2))

Output:

p^2*q^2

Previous Up Next