replace is used to symbolically replace sdpvar variables with another variable, expression or constant.

## Syntax

newexpression = replace(expression,variable,replacement)


## Examples

Create a polynomial and then evaluate it

sdpvar x y
p = 1 + x^2 + y;
replace(p,[x y],[7 8])

ans =

58


Make a symbolic replacement

p = 1 + x + y + x*y
f = replace(p,[x y],[u^2 + v^2 u^2-v^2])
sdisplay(f)
1+2*u^2+u^4-v^4