({{, (RefLink[NSolve, paclet:ref/NSolve])[expr,vars]
attempts to find numerical approximations to the solutions of the system expr of equations or inequalities for the variables vars. }, {, (RefLink[NSolve, paclet:ref/NSolve])[expr,vars,(RefLink[Reals, paclet:ref/Reals])]
finds solutions over the domain of real numbers.}})

OpenersNotesSection(Spacer1)Details and Options

The system expr can be any logical combination of:

(RefLink[NSolve, paclet:ref/NSolve])[{(Subscript[expr, 1]),(Subscript[expr, 2]),…},vars] is equivalent to (RefLink[NSolve, paclet:ref/NSolve])[(Subscript[expr, 1])&&(Subscript[expr, 2])&&…,vars].

A single variable or a list of variables can be specified.

(RefLink[NSolve, paclet:ref/NSolve]) gives solutions in terms of rules of the form:

When a single variable is specified and a particular root of an equation has multiplicity greater than one, (RefLink[NSolve, paclet:ref/NSolve]) gives several copies of the corresponding solution.

(RefLink[NSolve, paclet:ref/NSolve])[expr,vars] assumes by default that quantities appearing algebraically in inequalities are real, while all other quantities are complex.

In (RefLink[NSolve, paclet:ref/NSolve])[expr,vars,Reals] all variables, parameters, constants, and function values are restricted to be real.

(RefLink[NSolve, paclet:ref/NSolve])[expr&&vars∈(RefLink[Reals, paclet:ref/Reals]),vars,(RefLink[Complexes, paclet:ref/Complexes])] solves for real values of variables, but function values are allowed to be complex.

(RefLink[NSolve, paclet:ref/NSolve])[…,x∈reg,(RefLink[Reals, paclet:ref/Reals])] constrains x to be in the region reg. The different coordinates for x can be referred to using (RefLink[Indexed, paclet:ref/Indexed])[x,i].

(RefLink[NSolve, paclet:ref/NSolve]) deals primarily with linear and polynomial equations.

The following options can be given:

Possible (RefLink[Method, paclet:ref/Method]) settings include "EndomorphismMatrix" and "Homotopy".

OpenersPrimaryExamplesSection(Spacer1)Examples  (77)

OpenersExampleSection0(Spacer1)Basic Examples  (5)

Approximate solutions to a polynomial equation:

NSolve[x^5-2x+3==0,x]

Approximate real solutions to a polynomial equation:

NSolve[x^5-2x+3==0,x,Reals]

Approximate solutions to a system of polynomial equations:

NSolve[{x^2+y^3==1,2x+3y==4},{x,y}]

Approximate real solutions to a system of polynomial equations:

NSolve[{x^2+y^3==1,2x+3y==4},{x,y},Reals]

Solve equations in a geometric region:

NSolve[{x,y}∈InfiniteLine[{{0,0},{2,1}}]&&{x,y}∈Circle[],{x,y}]

Graphics[{{Blue,InfiniteLine[{{0,0},{2,1}}],Circle[]},{Red,Point[{x,y}]/.%}}]

OpenersExampleSection1(Spacer1)Scope  (46)

OpenersExampleSubsection0(Spacer1)Complex Equations in One Variable  (9)

Univariate polynomial equations:

NSolve[x^5-2x+17==0,x]

Polynomial equations with inexact coefficients:

NSolve[x^3-1.234x+5.678==0,x]

Polynomial equations with multiple roots:

NSolve[(x^2-1)(x^4-1)==0,x]

Algebraic equations:

NSolve[Sqrt[x]+3x^(1/3)==5,x]

Transcendental equations:

NSolve[Sin[x]==1/3,x]

NSolve[5==x*2^(x^2),x]

Univariate elementary function equations over bounded regions:

NSolve[Sin[E^x]-Cos[2 x]==1&&-1≤Re[x]≤1&&-1≤Im[x]≤1,x]

Univariate holomorphic function equations over bounded regions:

NSolve[Gamma[x]-Log[x]==I/2&&Abs[x-2]<3/2,x]

Here (RefLink[NSolve, paclet:ref/NSolve]) finds some solutions but is not able to prove there are no other solutions:

NSolve[Zeta[x]==Exp[I x]-1&&Abs[x]<5,x]

Equation with a purely imaginary period over a vertical stripe in the complex plane:

NSolve[Cos[Exp[x]]==3 Exp[-x]+1&&0≤Re[x]≤1,x]

OpenersExampleSubsection1(Spacer1)Systems of Complex Equations in Several Variables  (8)

Systems of linear equations:

NSolve[{x+2y+3z==4,3x+4y+5z==6,7x+9y+8z==10},{x,y,z}]

Linear equations with inexact coefficients:

NSolve[1.23 x+2.34 y+3.45 z==4.56 &&5.67x+6.78y+7.89z==8.9&&9.01x+0.12y+1.23z==2.34,{x,y,z}]

Underdetermined systems of linear equations:

NSolve[x+2y+3z==4&&3x+4y+5z==6&&6x+7y+8z==9,{x,y,z}]

Linear equations with no solutions:

NSolve[x+2y+3z==4&&3x+4y+5z==6&&6x+7y+8z==0,{x,y,z}]

Systems of polynomial equations:

NSolve[x^2+y^2==1&&x+2y==3,{x,y}]

Underdetermined systems of polynomial equations:

NSolve[x^2+y^2+z^2==1&&x y z==2,{x,y,z}]

Algebraic equations:

NSolve[Sqrt[x y]==Sqrt[x+y]&&Sqrt[x]-y^(1/3)==1,{x,y}]

Transcendental equations:

NSolve[Sin[x+y]==1&&Cos[x-y]==1/2,{x,y}]

NSolve[3^x^2==7&&x^2-y^3==4,{x,y}]

OpenersExampleSubsection2(Spacer1)Real Equations in One Variable  (11)

Polynomial equations:

NSolve[x^5-2x+1==0,x,Reals]

Polynomial equations with multiple roots:

NSolve[(x^2-1)(x^4-1)==0,x,Reals]

Algebraic equations:

NSolve[Sqrt[x]+3x^(1/3)==5,x,Reals]

Piecewise equations:

NSolve[Abs[x]^2-x+UnitStep[x]==9,x,Reals]

Transcendental equations, solvable using inverse functions:

NSolve[E^x-x==7,x,Reals]

NSolve[ ((27^(2x-1))^(1/x))==(Sqrt[(9^(2x-1))]), x , Reals]

Transcendental equations, solvable using special function zeros:

NSolve[AiryBi[1-x^2]==0&&2<x<3,x,Reals]

Transcendental inequalities, solvable using special function zeros:

NSolve[900<AiryAiZero[2t+1]^2<1000,t,Reals]

Exp-log equations:

NSolve[E^(2E^x)-Log[x^2+1]-20x==11,x,Reals]

High-degree sparse polynomial equations:

NSolve[x^1000000-2x^777777+3x^12345+9x^67-10==0,x,Reals]

Algebraic equations involving high-degree radicals:

NSolve[2x^(123451/67890)-x^2+4Sqrt[x]-4x-9/8==0,x,Reals]

Equations involving irrational real powers:

NSolve[x^Pi-x^x^Sqrt[2]-Sqrt[3]x+2^(1/3)==0,x,Reals]

Equation with a double root:

NSolve[E^(2x)+x^4+4(x^2+1)==(2x^2+4)E^x,x,Reals]

Tame elementary function equations:

NSolve[10Sin[Tan[E^-x^2]]-x==3,x,Reals]

Elementary function equations in bounded intervals:

NSolve[2Sin[Exp[x]]-Cos[Pi x]==3/2&&-1<x<1,x,Reals]

Holomorphic function equations in bounded intervals:

NSolve[Cos[x]-BesselJ[5,x]==1/2&&0≤x≤10,x]

OpenersExampleSubsection3(Spacer1)Systems of Real Equations and Inequalities in Several Variables  (9)

Linear systems:

NSolve[2 x+3y-5z==1&&3x-4y+7z==3&&x+y-z==8,{x,y,z},Reals]

Polynomial systems:

NSolve[x y==z^2-x&&x y z==2&&x^2+y^2+z^2==5,{x,y,z},Reals]

Quantified polynomial systems:

NSolve[Exists[x, x^2+a x+b==0&&2 x+a==0&&a^2+x b^2==1],{a,b},Reals]

NSolve[ForAll[x,Exists[y,a x^2+b y^2-3y==1&&y<0&&a y-y==b+1]],{a,b},Reals]

Algebraic systems:

NSolve[Sqrt[x+2y]-3x+4y==5&&x+y^(1/3)==2,{x,y},Reals]

Piecewise systems:

NSolve[Max[x^2,1-y^3]==Min[y^2,x]+7y&&x+UnitStep[4-y]==5,{x,y},Reals]

Transcendental systems solvable using inverse functions:

NSolve[Sin[x+y]==1/2&&E^x-y==1&&x^2≤10,{x,y},Reals]

NSolve[ (3^x)-(2^(2y))==77 && (Sqrt[(3^x)])-(2^y)==7, {x, y}, Reals]

Systems exp-log in the first variable and polynomial in the other variables:

NSolve[E^x y^3+Log[x]y==1&&x y+E^x/x==10,{x,y},Reals]

Quantified system:

NSolve[Exists[a,a x^2+Sinh[x^2+1]a^2==1&&x^2-a^2==1],x,Reals]

Systems elementary and bounded in the first variable and polynomial in the other variables:

NSolve[Sin[x-Cos[x]] y^3-x==1&&x^2+y^2==1,{x,y},Reals]

Quantified system:

NSolve[Exists[y,y^3-Cos[x] y+2 x^2 Sin[x^2-1]==0&&x^2+y^2==2],x,Reals]

Systems holomorphic and bounded in the first variable and polynomial in the other variables:

NSolve[y^3-BesselJ[2,x+2] y-y-3 x==-2&&x^2≤1&&x y-x^2+y^2==3,{x,y},Reals]

Quantified system:

NSolve[Exists[y,y^4-Gamma[x+2] y-y-3 ArcSin[x/3]==1&&x^2+y^3==1&&0<x<2],x,Reals]

OpenersExampleSubsection4(Spacer1)Systems with Mixed Variable Domains  (1)

Mixed real and complex variables:

NSolve[x^2+y^2==1&&x^4+ y^4==2&&Element[x,Reals],{x,y}]

OpenersExampleSubsection5(Spacer1)Geometric Regions  (8)

Solve over special regions in 2D:

(Subscript[ℛ, 1])=Circle[];
(Subscript[ℛ, 2])=Line[{{-2,1},{1,-2}}];

NSolve[{x,y}∈(Subscript[ℛ, 1])&&{x,y}∈(Subscript[ℛ, 2]),{x,y}]

Plot it:

Graphics[{{Blue,(Subscript[ℛ, 1]),(Subscript[ℛ, 2])},{Red,Point[{x,y}]/.%}}]

Solve over special regions in 3D:

(Subscript[ℛ, 1])=Sphere[];
(Subscript[ℛ, 2])=InfinitePlane[{{0,0,0},{0,1,0},{1,0,1}}];

NSolve[2 x y==(z^2)&&{x,y,z}∈(Subscript[ℛ, 1])&&{x,y,z}∈(Subscript[ℛ, 2]),{x,y,z},Reals]

Plot it:

Show[{ContourPlot3D[2 x y==(z^2),{x,-1.2,1.2},{y,-1.2,1.2},{z,-1.2,1.2},Mesh->None,ContourStyle->Opacity[0.5]],Graphics3D[{{Opacity[0.5],Green,(Subscript[ℛ, 1])},{Opacity[0.5],Yellow,(Subscript[ℛ, 2])},{PointSize[Large],Red,Point[{x,y,z}/.%]}}]}]

An implicitly defined region:

ℛ=ImplicitRegion[a+2 b-3 c≥1&&a b c==7,{a,b,c}];

NSolve[(y^2)+x z==1&&x+y==z^2&&{x,y,z}∈ℛ,{x,y,z},Reals]

A parametrically defined region:

ℛ=ParametricRegion[{s+t,s-t,s t},{s,t}];

NSolve[x y==z&&x+2 y+3 z==1&&{x,y,z}∈ℛ,{x,y,z},Reals]

Derived regions:

(Subscript[ℛ, 1])=Disk[{0,0},2];
(Subscript[ℛ, 2])=Circle[{1,1},2];
(Subscript[ℛ, 3])=RegionIntersection[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])];

NSolve[(x^2)==x y+1&&{x,y}∈(Subscript[ℛ, 3]),{x,y},Reals]

Plot it:

Show[{ContourPlot[(x^2)==x y+1,{x,-2,3},{y,-2,3}],Graphics[{{Opacity[0.5],Yellow,(Subscript[ℛ, 1])},{Green,(Subscript[ℛ, 2])},{Red,Point[{x,y}/. %]}}]}]

Regions dependent on parameters:

(Subscript[ℛ, 1])=Circle[];
(Subscript[ℛ, 2])=InfiniteLine[{{-2,0},{0,t}}];
(Subscript[ℛ, 3])=Circle[{1,1},{2t,t}];
(Subscript[ℛ, 4])=RegionIntersection[(Subscript[ℛ, 1]),(Subscript[ℛ, 2]),(Subscript[ℛ, 3])];

NSolve[{x,y}∈(Subscript[ℛ, 4]),{t,x,y},Reals]

Plot it:

Graphics[{{Blue,(Subscript[ℛ, 1]),(Subscript[ℛ, 2]),(Subscript[ℛ, 3])},{Red,Point[{x,y}]}}/.%]

Find values of parameters a, b, and r for which the circles contain the given points:

(Subscript[ℛ, 1])=Circle[{a,b},r];
(Subscript[ℛ, 2])=Circle[{a+1,b},r];
(Subscript[ℛ, 3])=RegionIntersection[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])];

NSolve[({0,1}|{0,-1})∈(Subscript[ℛ, 3]),{a,b,r},Reals]

Plot it:

Show[{Graphics[{{Blue,(Subscript[ℛ, 1])},{Green,(Subscript[ℛ, 2])},{Red,Point[{{0,1},{0,-1}}]}}/.%]}]

Use x∈ℛ to specify that x is a vector in (ℝ^2):

ℛ=RegionIntersection[Circle[],Line[{{-2,-1},{1,2}}]];

NSolve[x∈ℛ,x]

In this case x is a vector in (ℝ^3):

ℛ=Sphere[];

NSolve[x.{1,2,3}==0&&x.{-3,-2,-1}==0&&x∈ℛ,x]

OpenersExampleSection2(Spacer1)Generalizations & Extensions  (1)

All variables are solved for:

NSolve[x^2+3x+1==0]

Working precision can be given as the last argument:

NSolve[x^5-x+2,x,Reals,30]

OpenersExampleSection3(Spacer1)Options  (3)

OpenersExampleSubsection6(Spacer1)Method  (1)

By default (RefLink[NSolve, paclet:ref/NSolve]) introduces slicing hyperplanes for underdetermined complex systems:

NSolve[x^2+y^2==1,{x,y}]

With (RefLink[Method, paclet:ref/Method])->{"UseSlicingHyperplanes"->(RefLink[False, paclet:ref/False])}, (RefLink[NSolve, paclet:ref/NSolve]) gives parametric solutions:

NSolve[x^2+y^2==1,{x,y},Method->{"UseSlicingHyperplanes"->False}]

OpenersExampleSubsection7(Spacer1)VerifySolutions  (1)

(RefLink[NSolve, paclet:ref/NSolve]) verifies solutions obtained using non-equivalent transformations:

funs={Sqrt[x+Sqrt[x]]-2,y^9-y-2 x^(1/7)-3};
eqns=And@@Thread[funs==0];
(sol1=NSolve[eqns,{x,y}]);//Timing

With (RefLink[VerifySolutions, paclet:ref/VerifySolutions])->(RefLink[False, paclet:ref/False]), (RefLink[NSolve, paclet:ref/NSolve]) does not verify the solutions:

(sol2=NSolve[eqns,{x,y},VerifySolutions->False]);//Timing

Some of the solutions returned with (RefLink[VerifySolutions, paclet:ref/VerifySolutions])->(RefLink[False, paclet:ref/False]) are not correct:

Length/@{sol1, sol2}

This uses a fast numeric test in an attempt to select correct solutions:

(sol3=Select[sol2,Chop[funs/.#,10^-8]=={0,0}&]);//Timing

In this case the simple numeric verification gives the correct solution set:

sol3===sol1

OpenersExampleSubsection8(Spacer1)WorkingPrecision  (1)

By default, (RefLink[NSolve, paclet:ref/NSolve]) finds solutions of exact equations using machine-precision computations:

NSolve[x^5+2 x+7==0,x]

This computes the solutions using 50-digit precision:

NSolve[x^5+2 x+7==0,x,WorkingPrecision->50]

OpenersExampleSection4(Spacer1)Applications  (11)

OpenersExampleSubsection9(Spacer1)Geometry  (11)

Find intersection points of a circle and a parabola:

pts=NSolve[x^2+y^2==1&&y-2x^2+3/2==0,{x,y}]

Show[{ContourPlot[{x^2+y^2==1,y-2x^2+3/2==0},{x,-1.5,1.5},{y,-1.5,1.5}],Graphics[{Red,PointSize[Medium],Point[{x,y}/.pts]}]}]

Find the intersection of (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[{0,0},{1,1}] and (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[{{0,1},{1,0}}]:

line1=InfiniteLine[{0,0},{1,1}];
line2=InfiniteLine[{{0,1},{1,0}}];

sol=NSolve[{x,y}∈line1∧{x,y}∈line2,{x,y}]

Plot it:

Graphics[{{Lighter[Blue,0.5],line1,line2},{Red,Point[{x,y}/.sol]}},Axes->True,ImageSize->Small]

Find the intersections of (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[{0,0},{1,1}] and (RefLink[Circle, paclet:ref/Circle])[{0,0},1]:

line=InfiniteLine[{0,0},{1,1}];
circle=Circle[{0,0},1];

sol=NSolve[{x,y}∈line∧{x,y}∈circle,{x,y}]

Plot it:

Graphics[{{Lighter[Blue,0.5],line,circle},{Red,Point[{x,y}/.sol]}},ImageSize->Small]

Find all pairwise intersections between five random lines:

lines=InfiniteLine/@RandomReal[1,{5,2,2}];

Use (RefLink[BooleanCountingFunction, paclet:ref/BooleanCountingFunction]) to express that exactly two conditions are true:

sol=NSolve[{x,y}∈BooleanRegion[BooleanCountingFunction[{2},5],lines],{x,y}]

Plot it:

Graphics[{{Lighter[Blue,0.5],lines},{Red,PointSize[Medium],Point[{x,y}/.sol]}}]

Find the pairwise intersections of the circles (RefLink[Circle, paclet:ref/Circle])[{1/3 (RefLink[Cos, paclet:ref/Cos])[k 2π/5],1/3 (RefLink[Sin, paclet:ref/Sin])[k 2π/5]}] for k=0,…,4:

circles=Table[Circle[{1/3 Cos[k 2π/5],1/3 Sin[k 2π/5]}],{k,0,4}];

sol=NSolve[{x,y}∈BooleanRegion[BooleanCountingFunction[{2},5],circles],{x,y}]

Plot it:

Graphics[{{Lighter[Blue,0.5],circles},{Red,PointSize[Medium],Point[{x,y}/.sol]}}]

Find the intersection of (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[{{-1,1,1},{1,1,1}}] and (RefLink[InfinitePlane, paclet:ref/InfinitePlane])[{{2,0,0},{0,2,0},{0,0,2}}]:

line=InfiniteLine[{{-1,1,1},{1,1,1}}];
plane=InfinitePlane[{{2,0,0},{0,2,0},{0,0,2}}];

sol=NSolve[{{x,y,z}∈line,{x,y,z}∈plane},{x,y,z}]

Plot it:

Graphics3D[{{Opacity[0.5],line,plane},{Red,PointSize[Large],Point[{x,y,z}/.sol]}},Axes->True,PlotRange->{{-2,2},{-2,2},{-2,2}}]

Find the intersections of (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[{{-1,1,1},{1,1,1}}] and (RefLink[Sphere, paclet:ref/Sphere])[{0,0,0},3]:

line=InfiniteLine[{{-1,1,1},{1,1,1}}];
sphere=Sphere[{0,0,0},3];

sol=NSolve[{{x,y,z}∈line,{x,y,z}∈sphere},{x,y,z}]

Plot it:

Graphics3D[{{Opacity[0.5],line,sphere},{Red,PointSize[Large],Point[{x,y,z}/.sol]}},PlotRangePadding->0.5]

Find the intersections of (RefLink[InfiniteLine, paclet:ref/InfiniteLine])[{{-1,1/3,1/2},{1,1/3,1/2}}] and the boundary of (RefLink[Tetrahedron, paclet:ref/Tetrahedron])[{{0,0,0},{1,0,0},{0,1,0},{0,0,1}}]:

line=InfiniteLine[{{-1,1/3,1/2},{1,1/3,1/2}}];
tet=RegionBoundary@Tetrahedron[{{0,0,0},{1,0,0},{0,1,0},{0,0,1}}];

sol=NSolve[{x,y,z}∈RegionIntersection[line,tet],{x,y,z}]

Plot it:

Graphics3D[{{Opacity[0.5],line,Tetrahedron[{{0,0,0},{1,0,0},{0,1,0},{0,0,1}}]},{Red,PointSize[Medium],Point[{x,y,z}/.sol]}},PlotRangePadding->0.2]

Find the intersection for three random planes:

planes=InfinitePlane/@RandomReal[1,{3,3,3}];

sol=NSolve[{x,y,z}∈RegionIntersection@@planes,{x,y,z}]

Plot it:

Graphics3D[{{Opacity[0.5],planes},{Red,PointSize[Medium],Point[{x,y,z}/.sol]}},PlotRangePadding->0.1]

Find the intersections of the spheres (RefLink[Sphere, paclet:ref/Sphere])[{1/3 (RefLink[Cos, paclet:ref/Cos])[k 2π/3],1/3 (RefLink[Sin, paclet:ref/Sin])[k 2π/3],0}] for k=0,1,2:

spheres=Table[Sphere[{1/3 Cos[k 2π/3],1/3 Sin[k 2π/3],0}],{k,0,2}];

sol=NSolve[{x,y,z}∈RegionIntersection@@spheres,{x,y,z}]

Plot it:

Graphics3D[{{Opacity[0.5],spheres},{Red,PointSize[Large],Point[{x,y,z}/.sol]}}]

Find all the intersections of exactly three planes among 10 random planes:

planes=InfinitePlane/@RandomReal[{-1,1},{10,3,3}];

Use (RefLink[BooleanCountingFunction, paclet:ref/BooleanCountingFunction]) to find the condition of exactly three things being true:

sol=NSolve[{x,y,z}∈BooleanRegion[BooleanCountingFunction[{3},10],planes],{x,y,z}];//Quiet

Plot it:

Graphics3D[{{Opacity[0.3],planes},{Red,PointSize[Medium],Point[{x,y,z}/.sol]}},PlotRange->{{-1,1},{-1,1},{-1,1}}]

OpenersExampleSection5(Spacer1)Properties & Relations  (7)

Solutions approximately satisfy the equations:

polys={x^2+y^2-1,2x+3y-4};
NSolve[Thread[polys==0],{x,y}]

Solutions are given as replacement rules and can be directly used for substitution:

polys/.%

(RefLink[NSolve, paclet:ref/NSolve]) uses {} to represent the empty or no solution:

NSolve[x==1&&x==2,x]

(RefLink[NSolve, paclet:ref/NSolve]) uses {{}} to represent the universal solution or that all points satisfy the equations:

NSolve[x==x,x]

For univariate equations, (RefLink[NSolve, paclet:ref/NSolve]) repeats solutions according to their multiplicity:

NSolve[(x-1)^2(x-2)^3==0,x]

Find solutions over specified domains:

NSolve[(x^4-1)(x^4-4)==0,x]

NSolve[(x^4-1)(x^4-4)==0,x,Reals]

(RefLink[NSolve, paclet:ref/NSolve]) is a global equation solver:

NSolve[{x^2+y^3==1,x^4+y^4==2},{x,y}]

(RefLink[FindRoot, paclet:ref/FindRoot]) is a local equation solver:

FindRoot[{x^2+y^3==1,x^4+y^4==2},{{x,1},{y,-1}}]

(RefLink[NSolve, paclet:ref/NSolve]) gives approximate results:

NSolve[{x^2+y^2==1,x+y^2==2},{x,y}]

Use (RefLink[Solve, paclet:ref/Solve]) to get exact solutions:

Solve[{x^2+y^2==1,x+y^2==2},{x,y}]

Use (RefLink[FindInstance, paclet:ref/FindInstance]) to get exact solution instances:

FindInstance[{x^2+y^2==1,x+y^2==2},{x,y}]

Use (RefLink[NDSolve, paclet:ref/NDSolve]) to solve differential equations numerically:

NDSolve[{y''[x]==-y[x],y[0]==0,y'[0]==1},y[x],{x,0,7}]

Plot[y[x]/.%[[1]],{x,0,7}]

OpenersExampleSection6(Spacer1)Possible Issues  (3)

Solutions obtained with machine-precision numeric computations may not be accurate:

poly=Expand[Product[x-i,{i,30}]];

NSolve[poly==0,x]

With higher (RefLink[WorkingPrecision, paclet:ref/WorkingPrecision]) more accurate results are produced:

NSolve[poly==0,x,WorkingPrecision->20]

Approximate solutions may not satisfy the equations due to numeric errors:

eqns={x^2+y^2==1,x^3-2x y==2};
sols=NSolve[eqns,{x,y}]

eqns/.sols

The equations are satisfied up to a certain tolerance:

Norm/@({x^2+y^2-1,x^3-2x y-2}/.sols)

Using higher (RefLink[WorkingPrecision, paclet:ref/WorkingPrecision]) will give solutions with smaller tolerance:

sols=NSolve[eqns,{x,y},WorkingPrecision->25]

({x^2+y^2-1,x^3-2x y-2}/.sols)

If the solutions set is infinite, (RefLink[NSolve, paclet:ref/NSolve]) gives its intersection with random hyperplanes:

NSolve[x^2+y^2==1,{x,y}]

NSolve[x^2+y^2+z^2==1,{x,y,z}]

Use (RefLink[ContourPlot, paclet:ref/ContourPlot]) and (RefLink[ContourPlot3D, paclet:ref/ContourPlot3D]) to view the real part of solutions:

ContourPlot[x^2+y^2==1,{x,-1,1},{y,-1,1}]

ContourPlot3D[x^2+y^2+z^2==1,{x,-1,1},{y,-1,1},{z,-1,1}]

OpenersExampleSection7(Spacer1)Neat Examples  (1)

Solve the equation sin(z+sin(z+sin(z)))==cos(z+cos(z+cos(z))):

roots=NSolve[Sin[z+Sin[z+Sin[z]]]==Cos[z+Cos[z+Cos[z]]]&&-3<Re[z]<3&&-3<Im[z]<3,z];

ListPlot[{Re[z],Im[z]}/.roots,PlotLabel->TraditionalForm[Sin[z+Sin[z+Sin[z]]]==Cos[z+Cos[z+Cos[z]]]]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Solve, paclet:ref/Solve])  ▪  (RefLink[FindRoot, paclet:ref/FindRoot])  ▪  (RefLink[NDSolve, paclet:ref/NDSolve])  ▪  (RefLink[NMinimize, paclet:ref/NMinimize])  ▪  (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction])  ▪  (RefLink[AsymptoticSolve, paclet:ref/AsymptoticSolve])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Numerical Mathematics: Basic Operations, paclet:tutorial/NumericalCalculations])}, {▪(RefLinkPlain[Numerical Equation Solving, paclet:tutorial/NumericalEquationSolving])}, {▪(RefLinkPlain[Equations in One Variable, paclet:tutorial/EquationsInOneVariable])}, {▪(RefLinkPlain[Numerical Mathematics, paclet:tutorial/NumericalMathematicsInTheWolframLanguage])}, {▪(RefLinkPlain[Numerical Solution of Polynomial Equations, paclet:tutorial/NumericalSolutionOfPolynomialEquations])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Equation Solving, paclet:guide/EquationSolving])}, {▪(RefLinkPlain[Polynomial Systems, paclet:guide/PolynomialSystems])}, {▪(RefLinkPlain[Numerical Evaluation & Precision, paclet:guide/NumericalEvaluationAndPrecision])}, {▪(RefLinkPlain[Polynomial Equations, paclet:guide/PolynomialEquations])}, {▪(RefLinkPlain[Solvers over Regions, paclet:guide/GeometricSolvers])}, {▪(RefLinkPlain[Solid Geometry, paclet:guide/SolidGeometry])}, {▪(RefLinkPlain[Plane Geometry, paclet:guide/PlaneGeometry])}, {▪(RefLinkPlain[Polygons, paclet:guide/Polygons])}, {▪(RefLinkPlain[Geometric Computation, paclet:guide/GeometricComputation])}, {▪(RefLinkPlain[Polyhedra, paclet:guide/Polyhedra])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(Spacer1)▪(RefLinkPlain[(Spacer1)Implementation notes: Numerical and Related Functions, paclet:tutorial/SomeNotesOnInternalImplementation#25940])}, {(WebLink[DocumentationFooterIconsRelatedLinks-NKS.png(Spacer1)NKS|Online, http://www.wolframscience.com/nksonline/index/search.cgi?SearchIndex=NSolve]) ((WebLink[A New Kind of Science, http://www.wolframscience.com/nksonline/]))}})}})