Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Recursion

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54973] Re: [mg54937] Recursion
  • From: DrBob <drbob at bigfoot.com>
  • Date: Tue, 8 Mar 2005 05:04:17 -0500 (EST)
  • References: <200503070710.CAA07693@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

Given a starting or intermediate "guess" for Subscript[W, 0][T], the next guess would be:

next[guess_] =
   (((12*Subscript[\[CurlyEpsilon], Si])/
      (q*a))*((2*Subscript[k, B]*
       T)/q)*Log[(a*guess)/
       (2*Subscript[n, i][T])])^
    (1/3)

Iterating n times from an initial value looks like:

Nest[next, start, n]

Iterating to a fixed point would look like:

FixedPoint[next, start]

This can be expected to work only if, in the range between "start" and the final answer, the derivative of "next" is strictly between -1 and 1 (making "next" a contraction mapping).

That is,

-1 <= next'[x] <= 1

-1 <= (2*T*Subscript[k, B]*
     Subscript[\[CurlyEpsilon], Si])/
    (3^(2/3)*a*q^2*x*
     ((T*Log[(a*x)/
          (2*Subscript[n, i][T])]*
        Subscript[k, B]*
        Subscript[\[CurlyEpsilon], Si])/
       (a*q^2))^(2/3)) <= 1

That obviously depends on the constants; the smaller the derivative, the faster you'll get convergence.

Another option is to solve for x in the equation next[x] == x. Solve can't handle this problem directly, but NSolve might (once you've assigned numerical values to all quantities but x).

But we can solve it this way:

next[x] == x;
(#1^3 &) /@ %;
Solve[%, x]

{{x -> -((2*T^(1/3)*
        ProductLog[
          -((q^2*Subscript[n, i][
            T]^3)/(a^2*T*
            Subscript[k, B]*
            Subscript[\[CurlyEpsilon], Si]))]^
         (1/3)*Subscript[k, B]^
         (1/3)*Subscript[\[CurlyEpsilon], Si]^
         (1/3))/(a^(1/3)*
        q^(2/3)))},
   {x -> (2*(-1)^(1/3)*T^(1/3)*
       ProductLog[
         -((q^2*Subscript[n, i][
            T]^3)/(a^2*T*
            Subscript[k, B]*
            Subscript[\[CurlyEpsilon], Si]))]^
        (1/3)*Subscript[k, B]^
        (1/3)*Subscript[\[CurlyEpsilon], Si]^
        (1/3))/(a^(1/3)*
       q^(2/3))},
   {x -> -((2*(-1)^(2/3)*T^(1/3)*
        ProductLog[
          -((q^2*Subscript[n, i][
            T]^3)/(a^2*T*
            Subscript[k, B]*
            Subscript[\[CurlyEpsilon], Si]))]^
         (1/3)*Subscript[k, B]^
         (1/3)*Subscript[\[CurlyEpsilon], Si]^
         (1/3))/(a^(1/3)*
        q^(2/3)))}}

If you can determine that one or more of these solutions is valid for your application, iterations are unnecessary.

If your real application is more complicated, one of the other approaches may be necessary.

Bobby

On Mon, 7 Mar 2005 02:10:22 -0500 (EST), Christopher Grinde <christopher.grinde at hive.no> wrote:

>
> Hi.
> I am quite new to mathematica and need help to set up a recursion loop:
>
> \!\(W\_0[T_] := \@\(\(\(12\ \[CurlyEpsilon]\_Si\)\/\(q\ a\)\) \(\(2\
> \(k\_B\) \
> T\)\/q\) Log[\(a\ W\_0[T]\)\/\(2\ n\_i[T]\)]\)\%3\)
>
> How do I make this a recursive function which i can supply a start value for
> W0 and a limit for accuracy (W0[n]-W0[n+1]< some limit)
>
> Any help would be highly appreciated



-- 
DrBob at bigfoot.com


  • References:
    • Recursion
      • From: Christopher Grinde <christopher.grinde@hive.no>
  • Prev by Date: Re: Setting the ResultFormat in a ASP.NET WebApplication.
  • Next by Date: Re: Re: Re: Why does mathematica randomly rewrite notebooks?
  • Previous by thread: Recursion
  • Next by thread: Re: Recursion