New Solve

Adam Strzebonski

Wolfram Research, Inc.

New Solve

In the upcoming version of Mathematica Solve has been extended to allow the same input syntax as Reduce, including inequalities, domain specifications and quantifiers.

Solve[expr, vars] attempts to solve the system expr of equations or inequalities for the variables vars.

Solve[expr, vars, dom] solves over the domain dom. Common choices of dom are Reals, Integers and Complexes.

Solve a system of equations over the reals.

Solve[(x^3)+(y^3)+(z^3)==1&&3x-2y==-2z&&x+ y+ z==3,{x,y,z},Reals]

Find a condition for a quartic to have all roots equal.

Solve[(Subscript[∃, x,(x^4)+a (x^3)+b (x^2)+c x+d==0])((Subscript[∀, y,(y^4)+a (y^3)+b (y^2)+c y+d==0])x==y),{b,c,d}]

Solve a Diophantine equation.

Solve[(x^2)+x y+(y^2)==109,{x,y},Integers]

Representation of solutions as replacement rules

Representing solutions of equations may require non-equational conditions on parameters.

e=(x^2)+x y+(y^2);
ContourPlot[e==1,{x,-2,2},{y,-2,2}]

Non-equational conditions on parameters are given using new ConditionalExpression constructs.

sol=Solve[e==1,y,Reals]

Conditions on parameters are preserved when solutions are used for replacement.

e/.sol

Expand[%]

cexpr=y/.sol[[1]]

ConditionalExpression is defined when the condition is satisfied.

cexpr/.x->1/2

Plot[cexpr,{x,-2,2}]

cexpr/.x->2

ConditionalExpression

ConditionalExpression[expr, cond] represents the expression expr which is defined only when the condition cond is True.

ConditionalExpression is automatically propagated from the arguments of mathematical functions, equations and inequalities and Boolean operators.

Sin[ConditionalExpression[2 x y, x>0]]+2==0

A mathematical function with ConditionalExpression arguments is valid when all conditions are satisfied.

Exp[ConditionalExpression[x,x>0]]+((ConditionalExpression[y,y>0])^(ConditionalExpression[2,x+y<1]))

Combination of ConditionalExpression objects with contradictory conditions is undefined.

(Sqrt[ConditionalExpression[(x^2),x>0]])-(Sqrt[ConditionalExpression[(x^2),x<0]])

Generic solutions

Solve gives generic solutions only. Solutions that are valid only when continuous parameters satisfy equations are removed.

Show[{ContourPlot3D[y^2==x z^2,{x,-1,1},{y,-1,1},{z,-1,1}],Graphics3D[{Brown,Thickness[Large],Line[{{-1,0,0},{1,0,0}}]}]}]

Whitney’s umbrella has 2-dimensional and 1-dimensional parts.

Reduce[y^2==x z^2,{x,y,z},Reals]

Solve gives only 2-dimensional parts.

Solve[y^2==x z^2,z,Reals]

ParameterConditions option specifies what conditions on parameters are allowed.

Solve[y^2==x z^2,z,Reals,ParameterConditions->All]

Equational conditions on discrete parameters are allowed by default.

Solve[x^2+y^2==25,y,Integers]

Constraints on parameters

Parameters that appear in the problem may not be independent and unrestricted. They may be known to satisfty certain constraints. If the constraints form a lower-dimensional subset of the parameter space, there will be no solutions that are generically valid. It would be useful to specify that solutions are “valid generically with respect to the set of parameters satisfying the given constraints”. However, this notion is not well defined even for complex algebraic equations, since the constraints may describe a set which is not equidimensional.

assum=a c==0 && b c==0;
Reduce[assum,{a,b,c}]

Neither of the solutions is valid for all parameters satisfying the constraints. Which of them is “generically valid”?

system=x(x-1)==0&&x≠c&&c x==a c&&c x==b c;
Reduce[system && assum,{a,b,c,x}]

We extend the notion of genericity by specifiying that a solution must be valid for continuous parameters from a subset of parameter space of at most the specified codimension.

Solve[system && assum,x, ParameterConditions->Generic[1]]

Solve[system && assum,x, ParameterConditions->Generic[2]]

ParameterConditions->Generic finds solutions valid for values of continuous parameters that form a set of minimal codimension in the parameter space.

Solve[system && assum,x, ParameterConditions->Generic]

Multiple solutions

The new Solve finds solution multiplicity only for univariate equations.

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

Solution multiplicities are given for non-polynomial analytic equations as well.

Solve[Cos[x]-1==0 && -1<x<1,x]

Solve[(E^((((E^x)-Log[x]-3))^3))==1,x,Reals]

Extended InverseFunction evaluation

In the upcoming version of Mathematica InverseFunction will use Solve to compute closed from inverses of pure functions.

InverseFunction[((a #1+b)/(c #1+d))&]

If the function is not one-to-one, InverseFunction gives an error message and picks one of the solutions.

InverseFunction[((#1)^3)+2&]

InverseFunction wrt. the second argument.

InverseFunction[((#1)^2)+((#2)^2)-1&,2,2]

There is no closed form formula for this InverseFunction.

f=InverseFunction[Sin[#]-#&]

However, exact point values can be computed.

f[2]

InverseFunction wrt. the first argument of a two-argument function.

g=InverseFunction[Function[{x,y},Beta[x,y]-x+y],1,2]

g[3,4]

Here we cannot find a closed form formula for the InverseFunction or an exact point value.

h=InverseFunction[(∑_k^∞)(k^(-#1 k))&]

h[3]

But we can compute an arbitrarily accurate approximation of the point value.

N[h[3],50]

New Solve options

Cubics and Quartics

Solve[(x^3)+2 (x^2)+3 x+4==0,x]

Solve[(x^3)+2 (x^2)+3 x+4==0,x,Cubics->False]

GeneratedParameters

Solve[(x^2)-2 (y^2)==1&&x>0&&y>0,{x,y},Integers]

Solve[(x^2)-2 (y^2)==1&&x>0&&y>0,{x,y},Integers,GeneratedParameters->(Subscript[k,#]&)]

Method

Solve[Sin[x]==(1/2),x]

Solve[Sin[x]==(1/2),x,Method->"Reduce"]

Modulus

Solve[(x^2)+2 (y^3)==3,{x,y},Modulus->7]

ParameterConditions

Solve[(x^2)+(y^2)+(z^2)==1&&x-y==(z^3),z,Reals]

Solve[(x^2)+(y^2)+(z^2)==1&&x-y==(z^3),z,Reals,ParameterConditions->Generic[1]]

Classes of solvable problems

Complex equations in one variable

Polynomial equations solvable in radicals.

Solve[(x^4)-(x^2)-5==0,x]

Solve[(x^3)-2 (x^2)+5 x+7==0,x]

General polynomial equations.

Solve[(x^5)-2 x+17==0,x]

Polynomial equations with multiple roots.

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

Polynomial equations with symbolic coefficients.

Solve[a (x^2)+b x+c==0,x]

Solve[a (x^5)+b x+c==0,x]

Algebraic equations.

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

Transcendental equations.

Solve[Sin[x]==(1/3),x]

Solve[(x^(2 a))+2 (x^a)+1==0,x]

Solve[((((x^5)-1))^x)==0,x]

Solve[5==x (2^(x^2)),x]

Solve[ArcTan[(1/(Sqrt[1+(x^2)])),(x/(Sqrt[1+(x^2)]))]==a,x]

Univariate elementary function equations over bounded regions.

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

Univariate holomorphic function equations over bounded regions.

Solve[Gamma[x]-Log[x]==(I/2)&&Abs[x-2]<(3/2),x]

Here Solve finds some solutions but is not able to prove there are no other solutions.

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

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

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

Symbolic functions.

Solve[((f[x])^3)+2 f[x]-3==0,x]

Systems of complex equations in several variables

Systems of linear equations.

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

Linear equations with symbolic coefficients.

Solve[a x+b y+c z==d&&3 x+4 y+5 z==6&&7 x+7 y+8 z==9,{x,y,z}]

Underdetermined systems of linear equations.

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

Linear equations with no solutions.

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

Systems of polynomial equations.

Solve[(x^2)+(y^2)==1&&x+2 y==3,{x,y}]

Polynomial equations with symbolic coefficients.

Solve[a (x^2)+b (y^2)==c&&x+2 y==3,{x,y}]

Algebraic equations.

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

Transcendental equations.

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

Solve[(3^(x^2))==7&&(x^2)-(y^3)==4,{x,y}]

Solve[(x^a)+(y^b)==1&&(((x y))^(a b))==2,{x,y}]

Real equations in one variable

Polynomial equations.

Solve[(x^5)-2 x+1==0,x,Reals]

Polynomial equations with multiple roots.

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

Polynomial equations with symbolic coefficients.

Solve[(x^3)+a x+(a^2)==0,x,Reals]

Algebraic equations.

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

Piecewise equations.

Solve[((Abs[x])^2)-x+UnitStep[x]==9,x,Reals]

Transcendental equations, solvable using inverse functions.

Solve[(E^x)-x==7,x,Reals]

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

Transcendental equations, solvable using special function zeros.

Solve[AiryBi[1-(x^2)]==0&&2<x<3,x,Reals]

Transcendental inequalities, solvable using special function zeros.

Solve[900<((AiryAiZero[2 t+1])^2)<1000,t,Reals]

Exp-log equations.

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

High degree sparse polynomial equations.

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

Algebraic equations involving high degree radicals.

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

Equations involving non-rational real powers.

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

Equation with a double root.

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

Tame elementary function equations.

Solve[10 Sin[Tan[(E^(-(x^2)))]]-x==3,x,Reals]

Elementary function equations in bounded intervals.

Solve[2 Sin[Exp[x]]-Cos[π x]==(3/2)&&-1<x<1,x,Reals]

Holomorphic function equations in bounded intervals.

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

Periodic elementary function equations over the reals.

Solve[Exp[Sin[x]]-Sin[3 Cos[x]]==0,x,Reals]

Systems of real equations and inequalities in several variables

Linear systems.

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

Polynomial systems.

Solve[x y==(z^2)-x&&x y z==2&&(x^2)+(y^2)+(z^2)≤5,{y,z},Reals]

Quantified polynomial systems.

Solve[(Subscript[∃, x])((x^2)+a x+b==0&&2 x+a==0),a,Reals]

Solve[(Subscript[∀, x])(Subscript[∃, y])(a (x^2)+b (y^2)-3 y==1&&y<0&&a y-y==b+1),{a,b},Reals]

Algebraic systems.

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

Piecewise systems.

Solve[Max[x,y]==Min[(y^2)-x,x]+y&&z+UnitStep[x-y]==1,{y,z},Reals]

Transcendental systems solvable using inverse functions.

Solve[Sin[x+y]==(1/2)&&(E^x)-y≤1,y,Reals]

Solve[ (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.

Solve[(E^x) (y^3)+Log[x] y==1&&x y+((E^x)/x)≥2,y,Reals]

Quantified system.

Solve[(Subscript[∃, 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.

Solve[Sin[x-Cos[x]] (y^3)-x==1&&(x^2)+(y^2)≤1,y,Reals]

Quantified system.

Solve[(Subscript[∃, 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.

Solve[(y^3)-BesselJ[2,x+2] y-y-3 x==-2&&y<0&&(x^2)<2,y,Reals]

Quantified system.

Solve[(Subscript[∃, y])((y^4)-Gamma[x+2] y-y-3 ArcSin[(x/3)]==1&&(x^2)+(y^3)==1&&0<x<2),x,Reals]

Diophantine equations

Linear systems of equations.

Solve[2 x+3 y-5 z==1&&3 x-4 y+7 z==3,{x,y,z},Integers]

Linear systems of equations and inequalities.

Solve[2 x+3 y==4&&3 x-4 y≤5&&x-2 y>-21,{x,y},Integers]

Univariate polynomial equations.

Solve[(x^12345)-2 (x^777)+1==0,x,Integers]

Binary quadratic equations.

Solve[(x^2)+x y+(y^2)==109,{x,y},Integers]

Solve[(x^2)-3 (y^2)==22&&x>0&&y>0,{x,y},Integers]

Solve[(x^2)-6 x y+9 (y^2)-x+2 y==1,{x,y},Integers]

Thue equations.

Solve[(x^3)-2 (x^2) y+(y^3)==2,{x,y},Integers]

Sum of squares equations.

Solve[(x^2)+4 (y^2)+9 (z^2)+16 (t^2)==354&&x>0&&y>0&&z>0&&t>0,{x,y,z,t},Integers]

The Pythagorean equation.

Solve[(x^2)+(y^2)==(z^2),{x,y,z},Integers]

Bounded systems of equations and inequalities.

Solve[(x^4)+(y^4)+(z^4)≤500&&x+(y^2)+(z^3)==32,{x,y,z},Integers]

High-degree systems with no solutions.

Solve[2 (x^7)+8 (y^15)+14 x y z==3,{x,y,z},Integers]

Transcendental Diophantine systems.

Solve[Exp[(y^2)]<x&&Abs[x]<5&&Abs[y]<5,{x,y},Integers]

Solve[Exp[(x^2)-5 (y^2)+1]+(x^2)-5 (y^2)==0&&x>0&&y>0,{x,y},Integers]

Polynomial systems of congruences.

Solve[Mod[(x^2)+(y^2),2]==1&&Mod[x-2 y,3]==2,{x,y},Integers]

Modular equations

Linear systems.

Solve[2 x+3 y-5 z==1&&3 x-4 y+7 z==3&&2 x-10 y+3 z==5,{x,y,z},Modulus->12]

Solve[2 x+3 y-5 z==1&&3 x-4 y+7 z==3,{x,y,z},Modulus->12]

Univariate polynomial equations.

Solve[(x^3)-2 x+1==0,x,Modulus->5]

Systems of polynomial equations and inequations.

Solve[(x^2)+(y^3)==1&&x+2 (y^2)==4,{x,y},Modulus->7]

Solve[(x^2)+(y^3)==z&&x+2 y==3 z+1&&x y z≠0,{x,y,z},Modulus->7]

Quantified polynomial systems.

Solve[(Subscript[∀, x])(Subscript[∃, y])(a (x^2)+b (y^2)-3 y==1&&y≠0),{a,b},Modulus->3]

Systems with mixed variable domains

Mixed real and complex variables.

Solve[(x^2)+(y^2)==1&&x∈Reals,y]

Mixed real and integer variables.

Solve[(x^2)+(y^2)==7&&x∈Integers&&y∈Reals,{x,y}]