Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7204

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

From jdm <james.d.mclaughlin@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Function calling another function that uses NSolve - can't get this
Date 2011-12-14 11:09 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jca04g$a2h$1@smc.vnet.net> (permalink)

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Function calling another function that uses NSolve - can't get this jdm <james.d.mclaughlin@gmail.com> - 2011-12-14 11:09 +0000
  Re: Function calling another function that uses NSolve - can't get this Ray Koopman <koopman@sfu.ca> - 2011-12-15 10:00 +0000
    Re: Function calling another function that uses NSolve - can't get this jdm <james.d.mclaughlin@gmail.com> - 2011-12-30 12:14 +0000

csiph-web