MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Trouble with FindRoot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79246] Re: Trouble with FindRoot
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sun, 22 Jul 2007 04:17:45 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <f7sh9g$t29$1@smc.vnet.net>

chuck009 wrote:
>> Sooraj R wrote:
> 
>>> Now for the initial guess for second row, I need to
>>> use the first row as the initial guess, and so on.
>>> How do I do this?
> 
> Jean-Marc,  Looks like your code is not doing this.  I modified it to do so:

Hi,

I plea guilty: I forgot to reply to the second part of the OP's query.

Regards,
Jean-Marc

> eh = Table[Eh, {10}, {16}];
> 
> m = 3.85857975 10^-31;
> charge = 1.602 10^-19;
> hbar = 1.054571 10^-34;
> LH = {88.83663979522105,
>    93.83693172861489, 98.83720928295747, 103.83746882256844, \
> 108.83770913229637, 113.837930338503, 118.83813328307562, 123.83831915913095, \
> 128.83848929997706, 133.8386450587284, 138.83878774185274, 143.8389185748323, \
> 148.8390386868427, 153.83914910653547, 158.83925076412058, \
> 163.83934449683832};
> F = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} 10^6;
> ZeroField = Table[0, {16}];
> For[i = 1, i < 17, i++, ZeroField[[i]] = (Pi hbar)^2/(2 m charge (LH[[i]] 
>     10^-10)^2)]
> 
> (*Added Print function so ZeroField is displayed*)
> Print[ZeroField // MatrixForm];
> (* now do the first row *)
> 
> For[i = 1, i < 17, i++, eh[[1, i]] = Eh /. FindRoot[AiryAi[-((2*
>     m)/(charge*hbar*F[[j]])^2)^(1/3) (Eh 
>     charge + charge*F[[j]]*(LH[[i]] 10^-10)/2)] AiryBi[-((2*m)/(charge*hbar*
>       F[[j]])^2)^(1/3) (Eh charge - charge*F[[j]]*(LH[[i]] 
>       10^-10)/2)] == AiryAi[-((2*m)/(charge*hbar*F[[j]])^2)^(1/
>       3) (Eh charge - charge*F[[j]]*(
>           LH[[i]] 10^-10)/2)] AiryBi[-((2*m)/(charge*
>               hbar*F[[j]])^2)^(
>                         1/3) (Eh charge + charge*F[[j]]*(LH[[i]] 
>                           10^-10)/2)], {Eh, ZeroField[[i]]}]]
> 
> 
> (* now do succeeding 
>                         rows by using the 
>                               row above each as the starting values for \
> FindRoot *)
> 
> For[j = 2, j < 11, j++, For[i = 1, i < 17,
>    i++,(*Here we are : the symbol Eh located at (j, i) is going to be replace \
> by the value returned by FindRoot by applying the replacement operator /. to \
> the transformation rule of the form {Eh -> somenumber}*)eh[[j, 
>     i]] = Eh /. FindRoot[AiryAi[-((2*m)/(
>     charge*hbar*F[[j]])^2)^(1/3) (Eh charge + charge*F[[j]]*(
>             LH[[i]] 10^-10)/2)] AiryBi[-((2*m)/(charge*hbar*F[[j]])^2)^(
>                 1/3) (Eh charge - charge*F[[j]]*(LH[[i]] 10^-10)/2)] == \
> AiryAi[-((2*m)/(charge*hbar*F[[j]])^2)^(1/3) (Eh charge - \
> charge*F[[j]]*(LH[[i]] 10^-10)/2)] \
> AiryBi[-((2*m)/(charge*hbar*F[[j]])^2)^(1/3) (Eh 
>         charge + charge*F[[j]]*(LH[[i]] 10^-10)/2)], {Eh, eh[[j - 1, i]]}]]]
> eh // MatrixForm
> 



  • Prev by Date: HoldCompleteForm (or HoldFormComplete)
  • Next by Date: Heat transfer -- possible in mathematica?
  • Previous by thread: Re: Trouble with FindRoot
  • Next by thread: Annotating Graphics3D ?