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

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!94.232.116.11.MISMATCH!feed.xsnews.nl!border-1.ams.xsnews.nl!newspump.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail
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 Wed, 14 Dec 2011 11:09:04 +0000 (UTC)
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Sender steve@smc.vnet.net
Approved Steven M. Christensen <steve@smc.vnet.net>, Moderator
Message-ID <jca04g$a2h$1@smc.vnet.net> (permalink)
Lines 36
NNTP-Posting-Date 14 Dec 2011 10:13:48 GMT
NNTP-Posting-Host cb295ad7.news.twtelecom.net
X-Trace DXC=0@XYBTh>P0>ZODQm5jgcg>C_A=>8kQj6==_1NR_H?JP=GjUJ]Jg13B4EFiONJ7[Go6gb8^5f4L2D3
X-Complaints-To abuse@twtelecom.net
Xref x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:7204

Show key headers only | 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