Differentiating Functions and Root objects [ was Re: ArcCos[]]
- To: mathgroup at smc.vnet.net
- Subject: [mg24833] Differentiating Functions and Root objects [ was Re: ArcCos[]]
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Tue, 15 Aug 2000 03:04:05 -0400 (EDT)
- References: <8mqvd7$18j@smc.vnet.net> <8mtc0m$7qb@smc.vnet.net> <8n7q9r$1j7@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
John's posting stirred me into taking another look a this problem. Here are four observations 1. We can differentiating a pure function with respect to a parameter D[Function[x, Sin[y] x^2], y] Function[x, x^2*Cos[y]] D[Sin[y] #^2 &, y] Cos[y]*#1^2 & 2. The original problem, differentiating Root objects a = Root[-t + 2*#1 + 2*t^2*#1 + #1^3 &, 1] Root[-t + 2*#1 + 2*t^2*#1 + #1^3 & , 1] (b = D[a, t]) // InputForm (1 - 4*t*Root[-t + 2*#1 + 2*t^2*#1 + #1^3 & , 1])/ (2 + 2*t^2 + 3*Root[-t + 2*#1 + 2*t^2*#1 + #1^3 & , 1]^ 2) Make this output explicit (rb = ToRadicals[b]) // InputForm (1 - 4*t*(-(2^(1/3)*(6 + 6*t^2))/ (3*(27*t + Sqrt[729*t^2 + 4*(6 + 6*t^2)^3])^ (1/3)) + (27*t + Sqrt[729*t^2 + 4*(6 + 6*t^2)^3])^ (1/3)/(3*2^(1/3))))/(2 + 2*t^2 + 3*(-(2^(1/3)*(6 + 6*t^2))/ (3*(27*t + Sqrt[729*t^2 + 4*(6 + 6*t^2)^3])^ (1/3)) + (27*t + Sqrt[729*t^2 + 4*(6 + 6*t^2)^3])^(1/3)/ (3*2^(1/3)))^2) Maybe Solve and NSolve will work on rb == 0, -- I gave up after a a brief wait -- but we can quickly get FindRoot[rb == 0, {t, 0}] {t -> -818.986} Is b correct for the rate of change of a respect to t? We can check rb - D[ToRadicals[a], t] // Simplify 0 We might expect with sol the corresponding polynomial would have a multiple root. Check: (poly = -t + 2*#1 + 2*t^2*#1 + #1^3 &[x] /. sol[[1]]) // InputForm 818.985893312185 + 1.3414777868887153*^6*x + x^3 Solve[% == 0, x] // InputForm {{x -> -0.0006105102159100438}, {x -> 0.0003052551079550219 - 1158.2218211072502*I}, {x -> 0.0003052551079550219 + 1158.2218211072502*I}} 3. Can we still get the solution without using ToRadicals? sol2 = FindRoot[b == 0, {t, 0}] FindRoot::"jsing": "Encountered a singular Jacobian at the point \!\(t\) = \!\ \(0.`\). Try perturbing the initial point(s)." FindRoot::"jsing": "Encountered a singular Jacobian at the point \!\(t\) = \!\ \(0.`\). Try perturbing the initial point(s)." FindRoot[b == 0, {t, 0}] However sol2 = FindRoot[b == 0, {t, 0.1}] {t -> -1.0150511440294088} A different solution. And we get Solve[(-t + 2*#1 + 2*t^2*#1 + #1^3 &[x] /. sol2[[1]]) == 0, x] {{x -> -0.2462928577523092}, {x -> 0.1231464288761546 - 2.0263644239932934*I}, {x -> 0.1231464288761546 + 2.0263644239932934*I}} 4. Is Differentiation of Root objects always valid? Is this method a general one for finding which parameter values give multiple roots? Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "John D. Hendrickson" <jdh at hend.net> wrote in message news:8n7q9r$1j7 at smc.vnet.net... > I've got Mathematica 4.0.2.0. Since I'm running Win95 I don't mind > crashing - thats pretty much a constant, so I tried your dare:) But mine > didn't crash - it gave me output. Also - I have a substitute that might be > what you want. > > In[1]:= > a = Root[-t + 2*#1 + 2*t^2*#1 + #1^3 & , 1]; > > In[2]:= > b = D[a, t]; > > In[4]:= > InputForm[ Solve[b == 0, t] ] > > Solve::"tdep": "The equations appear to involve the variables to be solved \ > for in an essentially non-algebraic way." > > Out[4]//InputForm= > Solve[(1 - 4*t*Root[-t + 2*#1 + 2*t^2*#1 + #1^3 & , 1])/ > (2 + 2*t^2 + 3*Root[-t + 2*#1 + 2*t^2*#1 + #1^3 & , 1]^ > 2) == 0, t] > > =================================================================== > Would the following be acceptible in your circumstance? > I assumed by making the unexplicit root object explicit: > ==================================================================== > > In[3]:= > Exit[] > > In[1]:= > a = Root[-t + 2*#1 + 2*t^2*#1 + #1^3 & , 1]; > > In[2]:= > ax = First[a][x] > > Out[2]= > \!\(\(-t\) + 2\ x + 2\ t\^2\ x + x\^3\) > > In[3]:= > b = D[ax, t]; > > In[4]:= > InputForm[ Solve[b == 0, t] ] > > Out[4]//InputForm= > {{t -> 1/(4*x)}} > > =================================================================== > > Allan Hayes wrote in message <8mtc0m$7qb at smc.vnet.net>... > > > > > > > >"Gianluca Gorni" <gorni at dimi.uniud.it> wrote in message > >news:8mqvd7$18j at smc.vnet.net... > > > > > >----------- Snip ------------- > >> An unrelated problem: the following instructions consistently crash > >> my Mac Mathematica 4 kernel: > >> > >> a = Root[-t + 2*#1 + 2*t^2*#1 + #1^3 & , 1]; > >> b = D[a, t]; > >> Solve[b == 0, t] > >> > >-- > >Gianluca , > >It crashes Mathematica 4.02 on Windows also. > > > >Allan > >--------------------- > >Allan Hayes > >Mathematica Training and Consulting > >Leicester UK > >www.haystack.demon.co.uk > >hay at haystack.demon.co.uk > >Voice: +44 (0)116 271 4198 > >Fax: +44 (0)870 164 0565 > > > > > > > > > > >
- Follow-Ups:
- Re: Differentiating Functions and Root objects [ was Re: ArcCos[]]
- From: Daniel Lichtblau <danl@wolfram.com>
- Re: Differentiating Functions and Root objects [ was Re: ArcCos[]]