# realrank -- compute the real rank

## Synopsis

• Usage:
realrank F
• Inputs:
• F, , a binary form $F\in K[x,y]$ of degree $d$, where $K$ is either $\mathbb{Q}$ or a polynomial ring over $\mathbb{Q}$ (currently, with only one variable)
• Optional inputs:
• Limit => ..., default value infinity, set a bound for the rank
• QepcadOptions => ..., default value (20000000,10000), set the number of cells in the garbage collected space
• Range => ..., default value (-infinity,infinity), can be assigned an interval
• Verbose => ..., default value false, request verbose feedback
• Outputs:
• an integer, the real rank of $F$, i.e., the minimum integer $r$ such that there is a decomposition $F = c_1\,(l_1)^d+\cdots+c_r\,(l_r)^d$ where $l_1,\ldots,l_r$ are real linear forms and $c_1,\ldots,c_r\in\mathbb{R}$

## Description

Below we compute the real rank of a binary form of degree 7.

i1 : R := QQ[x,y];

i2 : F = 2*x^7+7*x^6*y+168*x^5*y^2+140*x^4*y^3+70*x^3*y^4+21*x^2*y^5+56*x*y^6+4*y^7

7     6        5 2       4 3      3 4      2 5        6     7
o2 = 2x  + 7x y + 168x y  + 140x y  + 70x y  + 21x y  + 56x*y  + 4y

o2 : QQ[x..y]

i3 : realrank F

o3 = 5


In the case when the coefficient ring $K$ contains a variable, say $u$, then the method returns a value $r$ if the real rank of $F$ is $r$ for all the real values of $u$ in the range specified by the option realrank(...,Range=>...). An error is thrown if the answer is not uniform.

i4 : Ru := QQ[u][x,y];

i5 : F = u*x^4*y+2*x^2*y^3

4      2 3
o5 = u*x y + 2x y

o5 : QQ[u][x..y]

i6 : realrank(F,Range=>(0,infinity))

o6 = 3

i7 : realrank(F,Range=>[-1,0])

o7 = 3

i8 : realrank(F,Range=>(-infinity,-1))

o8 = 3