Re: Method option to Solve

• To: mathgroup at smc.vnet.net
• Subject: [mg71616] Re: Method option to Solve
• From: "dimitris" <dimmechan at yahoo.com>
• Date: Sat, 25 Nov 2006 05:36:54 -0500 (EST)
• References: <ejur0n\$i3c\$1@smc.vnet.net>

```First some useful links

http://support.wolfram.com/mathematica/kernel/Symbols/System/Method.html
http://documents.wolfram.com/mathematica/book/section-A.9.5
http://library.wolfram.com/infocenter/Conferences/337/

One way to learn more things bout one option that lacks enough
documentation
is to do a mistake deliberately.

E.g.

Options[NIntegrate]
{AccuracyGoal -> Infinity, Compiled -> True, EvaluationMonitor -> None,
GaussPoints -> Automatic, MaxPoints -> Automatic,
MaxRecursion -> 6, Method -> Automatic, MinRecursion -> 0,
PrecisionGoal -> Automatic, SingularityDepth -> 4,
WorkingPrecision -> MachinePrecision}

NIntegrate[x, {x, 1, 2}, Method -> Mistake]
NIntegrate::bdmtd : The method specified by the Method option should be
one \
of Automatic, GaussKronrod, DoubleExponential, Trapezoidal,
Oscillatory, \
MonteCarlo, QuasiMonteCarlo, EvenOddSubdivision, or \
SymbolicPiecewiseSubdivision. Only methods EvenOddSubdivision and \
SymbolicPiecewiseSubdivision can be specified with submethods in the
nested \
form Method->{method, Method->submethod}.
NIntegrate[x, {x, 1, 2}, Method -> Mistake]

For Solve

Solve[a*x^4 + b*x^3 + c*x^2 + d*x+e== 0, x, Method -> AgainMistake]
Solve::method : Value of option Method -> AgainMistake should be 1, 2,
or 3.
Solve[d*x + c*x^2 + b*x^3 + a*x^4 +e== 0, x, Method -> AgainMistake]

Let's see some examples

Solve[2*x^3 + 3*x^2 + 4*x + 1 == 0, x, Method -> 1]
{{1 + 4*x + 3*x^2 + 2*x^3 -> 0}}

Solve[2*x^3 + 3*x^2 + 4*x + 1 == 0, x, Method -> 2]
{{1 + 4*x + 3*x^2 + 2*x^3 -> 0}}

Solve[2*x^3 + 3*x^2 + 4*x + 1 == 0, x, Method -> 3]
{{x -> -(1/2) + (9 + 2*Sqrt[114])^(1/3)/(2*3^(2/3)) - 5/(2*(3*(9 +
2*Sqrt[114]))^(1/3))},
{x -> -(1/2) - ((1 + I*Sqrt[3])*(9 + 2*Sqrt[114])^(1/3))/(4*3^(2/3))
+ (5*(1 - I*Sqrt[3]))/(4*(3*(9 + 2*Sqrt[114]))^(1/3))},
{x -> -(1/2) - ((1 - I*Sqrt[3])*(9 + 2*Sqrt[114])^(1/3))/(4*3^(2/3))
+ (5*(1 + I*Sqrt[3]))/(4*(3*(9 + 2*Sqrt[114]))^(1/3))}}

Solve[3*x^2 + 4*x + 1 == 0, x, Method -> 1]
{{1 + 4*x + 3*x^2 -> 0}}

Solve[3*x^2 + 4*x + 1 == 0, x, Method -> 2]
{{1 + 4*x + 3*x^2 -> 0}}

Solve[3*x^2 + 4*x + 1 == 0, x, Method -> 3]
{{x -> -1}, {x -> -(1/3)}}

Solve[4*x + 1 == 0, x, Method -> 1]
{{x -> -(1/4)}}

Solve[4*x + 1 == 0, x, Method -> 2]
{{x -> -(1/4)}}

Solve[4*x + 1 == 0, x, Method -> 3]
{{x -> -(1/4)}}

Block[{Message}, ({Method -> ToString[#1], Solve[Log[x] == x, x, Method
-> #1]} & ) /@ Range[3]]
{{Method -> "1", {{(-E^(-x))*x -> -1, x -> -ProductLog[(-E^(-x))*x]}}},

{Method -> "2", {{(-E^(-x))*x -> -1, x ->
-ProductLog[(-E^(-x))*x]}}}, {Method -> "3", {{x -> -ProductLog[-1]}}}}

Regards
Dimitris

Andrew Moylan wrote:
> Hi all,
>
> The usage string for the option name Method says "Method is an option
> to Solve, related functions, and various numerical functions, which
> specifies what algorithm to use in evaluating the result.". The list of
> options for Solve does indeed include Method, with a default value of
> 3:
>
> In[11]:=
> Options[Solve]
>
> Out[11]=
> {InverseFunctions -> Automatic, MakeRules -> False,
>   Method -> 3, Mode -> Generic, Sort -> True,
>   VerifySolutions -> Automatic, WorkingPrecision -> Infinity}
>
> However, I have been unable to find any other reference to the Method
> option to Solve in the documentation. Can anyone explain what this
> option does, and/or refer me to a part of the documentation that
> explains it?
>
> Cheers,
> Andrew

```

• Prev by Date: Re: pattern matching: rules that stop other rules?
• Next by Date: Function Name from Inside the function
• Previous by thread: Re: Re: Method option to Solve
• Next by thread: Re: Method option to Solve