Re: Re: Why can't Mathematica find this root?
- To: mathgroup at smc.vnet.net
- Subject: [mg38417] Re: [mg38362] Re: Why can't Mathematica find this root?
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Sat, 14 Dec 2002 03:20:00 -0500 (EST)
- References: <at4dgq$f1c$1@smc.vnet.net> <at9b6n$pqk$1@smc.vnet.net> <200212130908.EAA03312@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Konrad Den Ende wrote: > > > No, you don't. There are infinitely many roots, of which Mathematica gives > > you only three: -Pi/2, 0, and Pi/2. > > Actually, you get five different roots, not three. Nevertheless - point > taken. > I ment of course that i'd like Mathematica to give me ALL the roots on form: > angle + (period * n). I'll try to be more exact the next time. > > > Didn't you notice Mathematica's comment that, since inverse functions were > > being used, some solutions might not be found? That's the explanation. > > Yes, i did. I wonder why it's the ONLY method used by Mathematica. It feels > pretty bad to know that the program "misses" some simple roots. I don't > wonder > "what kind of algorithm gave that", rather "why do they use only that > algorithm". > > I appologize if my question caused any trouble by it's "fuzziness". > > -- > Vänligen > Konrad > ------------------- I did not really understand at first the nature of the question. Now that I do I'll take a stab at it. Under Solve>Further Examples>"Getting infinite solution sets for some equations" in the Help Browser, there is code to do something called "GeneralizeSolve". It is based on finding periodic inverses to various known functions, and takes advantage of the fact that Solve will find solutions in terms of these inverse functions. It does not quite work directly on your problem for the simple reason that e.g. ArcSin[0] will evaluate to 0. So we make it work by solving f'[x]==a and substituting a->0 afterward. Here is the code in question. arctrigs = {ArcSin, ArcCos, ArcCsc, ArcSec, ArcTan, ArcCot, ArcSinh, ArcCosh, ArcCsch, ArcSech, ArcTanh, ArcCoth}; periods = {2*Pi, 2*Pi, 2*Pi, 2*Pi, Pi, Pi, 2*I*Pi, 2*I*Pi, 2*I*Pi, 2*I*Pi, I*Pi, I*Pi}; (* We use n to denote an arbitrary integer *) Generalize[f_[x_], n_] := f[x] + nperiods[[Position[arctrigs, f][[1, 1]]]] /; MemberQ[arctrigs, f] Generalize[Log[x_],n_]:=Log[x]+2\[Pi]\[ImaginaryI]n Generalize[ProductLog[x_],n_]:=ProductLog[n,x] Generalize[x___, n_] := x GeneralizedSolve[eqns_, vars_] := Generalize[#, n] & //@ Solve[eqns, vars] In[12]:= GeneralizedSolve[f'[x]==a,x]/. a->0 Solve::ifun: Inverse functions are being used by Solve, so some solutions may \ not be found. Out[12]= {{x -> -((2*Pi)/3) - 2*n*Pi}, {x -> (2*Pi)/3 + 2*n*Pi}, {x -> -(Pi/3) - 2*n*Pi}, {x -> Pi/3 + 2*n*Pi}, {x -> -Pi - 2*n*Pi}, {x -> Pi + 2*n*Pi}, {x -> -2*n*Pi}, {x -> 2*n*Pi}} A minor inconvenience is that some solutions may be listed more than once e.g. the last two are equivalent if we regard n as ranging over all integers. Daniel Lichtblau Wolfram Research
- References:
- Re: Why can't Mathematica find this root?
- From: "Konrad Den Ende" <konrad@voxway.com>
- Re: Why can't Mathematica find this root?