MathGroup Archive 2011

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

Search the Archive

Function calling another function that uses NSolve - can't get this

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123652] Function calling another function that uses NSolve - can't get this
  • From: jdm <james.d.mclaughlin at gmail.com>
  • Date: Wed, 14 Dec 2011 06:02:28 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

I was trying to convert a function (advantagesecondalttheoretic below)
from another system to Mathematica. Probably because the function it in turn
called used NSolve, I couldn't seem to get it to work while it called
this function - it seemed that where secondaltb output {b->whatever
value}, there was no way for advantagesecondalttheoretic to access
this value. I ended up having to call the secondaltb function
separately, and then manually input the result from it to a new
version of advantagesecondalttheoretic - the one below:

This is, naturally, not much help if I want to plot any graphs!

Could someone please take a look at the below code and tell me how I
can get advantagesecondalttheoretic to call secondaltb and use the
value of b that results from it? Thanks!

secondaltb[KP_, Ps_, C_, M_] :=
 NSolve[Sqrt[2*M]*b +
    InverseCDF[NormalDistribution[0, 1], Ps]*
     Sqrt[4*(InverseCDF[NormalDistribution[0, 1], Ps]^2) +
       4*Sqrt[2*M]*b + 2.027226163*M] ==
   KP*C - 2*(InverseCDF[NormalDistribution[0, 1], Ps]^2), b,
  WorkingPrecision -> 20]

lnscale = N[1/(2*Log[2]), 20]

sb = secondaltb[2^64, 0.95, 2^(-55.38), 2295]

{{b -> 3.8915440624385913563}}

advantagesecondalttheoretic[b_] := (lnscale*(b^2)) + Log2[b] +
  Log2[Sqrt[2*Pi]]

N[advantagesecondalttheoretic[3.8915440624385913563], 20]

14.210260698586953991



  • Prev by Date: Re: NMinimize problem: fct minimized uses FindRoot
  • Next by Date: Minor problems with Mathematica 8 : private copy of stylesheet and
  • Previous by thread: Re: Does Union[] reliably sort?
  • Next by thread: Re: Function calling another function that uses NSolve -