Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Algebraically rewrite an expression by completing the square
ResourceFunction["CompleteSquare"][expr,x] returns an expression equivalent to expr, when possible, of the form (a x+b)2+c where a,b and c are FreeQ of x. |
Complete the square of a quadratic:
| In[1]:= |
| Out[1]= |
Complete the square of a quadratic with a mixture of numeric and symbolic coefficients:
| In[2]:= |
| Out[2]= |
Complete the square of the generic quadratic:
| In[3]:= |
| Out[3]= |
Complete the square of a non-quadratic, even-ordered polynomial:
| In[4]:= |
| Out[4]= |
If no expression of the required form can be found, CompleteSquare returns $Failed:
| In[5]:= |
| Out[5]= |
This work is licensed under a Creative Commons Attribution 4.0 International License