RootFinding[Parametric]
NumberOfSolutions
compute the number of real solutions for each open cell
Calling Sequence
Parameters
Description
Examples
NumberOfSolutions(m, l)
m
-
solution record, as returned by CellDecomposition
l
(optional) list of ranges for the parameters, of the form parameter=u..v, where u is a rational number or −∞ and v is a rational number or ∞
The NumberOfSolutions⁡m calling sequence computes the number of real solutions of the system
f=0,g>0f∈m:−Equations,⁢g∈m:−Inequalities
and returns it as a list of lists of the form i,ni, where i is the index of the open cell and ni is the number of real solutions of the non-parametric system resulting from substituting parameter values from this cell.
If l is given, only those open cells whose sample points lie inside the box specified by l are considered.
This command is part of the RootFinding[Parametric] package, so it can be used in the form NumberOfSolutions(..) only after executing the command with(RootFinding[Parametric]). However, it can always be accessed through the long form of the command by using RootFinding[Parametric][NumberOfSolutions](..).
with⁡RootFindingParametric:
sys≔x2+y2=a,x−y=b,0<a
m≔CellDecomposition⁡sys,x,y
m≔Equations=⁢x2+y2−a,x−y−bInequalities=⁢aFilter=⁢0≠1Variables=⁢x,yParameters=⁢a,bDiscriminantVariety=⁢a,−b2+2⁢aProjectionPolynomials=⁢b,a,−b2+2⁢aSamplePoints=⁢a=3022314549036572936765311208925819614629174706176,b=−1,a=1,b=−1,a=3022314549036572936765311208925819614629174706176,b=1,a=1,b=1
CellPlot⁡m,samplepoints
NumberOfSolutions⁡m
1,0,2,2,3,0,4,2
Thus, the number of solution pairs x,y of the system sys is 2 if the parameters a and b are chosen from the blue or green cells, to the right of the parabola, and 0 otherwise.
You can restrict the cells for which you want the number of solutions.
NumberOfSolutions⁡m,b=0..1
3,0,4,2
NumberOfSolutions⁡m,a=0..12,b=0..1
3,0
NumberOfSolutions⁡m,a=0..12,b=2..3
In fact, the system sys has exactly one solution, of multiplicity 2, on the parabola itself. This cannot be inferred from the previous data. However, you can add the equation for the discriminant variety to the system and make b an indeterminate as well.
m:-DiscriminantVariety
a,−b2+2⁢a
eqs≔op⁡m:-Equations,op⁡2,1,
eqs≔x2+y2−a,x−y−b,−b2+2⁢a
CellDecomposition⁡eqs,m:-Inequalities,x,y,b
Error, (in RootFinding:-Parametric:-CellDecomposition) cannot solve the system: either there are infinitely many complex solutions, or there are solutions of multiplicity > 1, for almost all parameter values
In order to proceed, you must remove multiplicities by computing the radical.
with⁡PolynomialIdeals,PolynomialIdeal,Generators,Simplify,Radical:
J≔PolynomialIdeal⁡eqs,variables=x,y,b:
R≔Generators⁡Simplify⁡Radical⁡J
R≔2⁢x−b,2⁢y+b,b2−2⁢a
m2≔CellDecomposition⁡op⁡R,m:-Inequalities,x,y,b
m2≔Equations=⁢2⁢x−b,2⁢y+b,b2−2⁢aInequalities=⁢aFilter=⁢0≠1Variables=⁢x,y,bParameters=⁢aDiscriminantVariety=⁢aProjectionPolynomials=⁢aSamplePoints=⁢a=1
NumberOfSolutions⁡m2
1,2
Notice that there is only one cell, and that the equations eqs have two solutions, independent of the value of the parameter a. The following command computes these solutions for a=1:
SampleSolutions⁡m2,a=1
x=−0.7071067812,y=0.7071067812,b=−1.414213562,x=0.7071067812,y=−0.7071067812,b=1.414213562
Since the values of b are different for each of those two solutions, you can conclude that the original system sys has exactly one solution x,y for parameter values a and b on the parabola specified by the equation for the discriminant variety.
See Also
CellDecomposition
CellPlot
Parametric
PolynomialIdeals
RootFinding
Download Help Document