MathGroup Archive 2009

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

Search the Archive

Re: Manipulating list of functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96802] Re: [mg96316] Manipulating list of functions
  • From: Syd Geraghty <sydgeraghty at me.com>
  • Date: Wed, 25 Feb 2009 04:04:17 -0500 (EST)

Hi all,

we recently had a thread regarding manipulating a list of functions  
which worked fine:-

Manipulate[Block[{funcA, funcB, funcC, funcList},
   funcA[z_] := Sin[z + a];
   funcB[z_] := Cos[z + b];
   funcC[z_] := funcA[z] + funcB[z];
   funcList = #[x] & /@ {funcA, funcB, funcC};
   Plot[Evaluate[funcList], {x, 1, 10}, Axes -> False, Frame ->  
True]], {a, 0,
   Pi}, {b, 0, Pi}]

I have tried what I thought would be a trivial a variant of this for  
very simple functions:

Manipulate[
  Block[{initialinvestment, nbrshares, profit, totalofholding,  
funcList},
   initialinvestment := 100000;
   nbrshares[buyprice_] := initialinvestment/buyprice;
   profit[buyprice_] := (finalprice - buyprice)*nbrshares;
   totalofholding := profit + initialinvestment;
   funcList := #[x] & /@ {nbrshares, initialinvestment, profit,  
totalofholding};
   Plot[Evaluate[funcList], {x, 4, 7}, Axes -> False, Frame -> True,
    PlotRange -> {0, 650000}]], {finalprice, 16, 24, 1}]

However I only get the nbrshares plotted, after several attempts I  
cannot get the desired output and would appreciate advice as to why  
the simpler function specifications lead to failure.

It appears that unless the functions all contain explicit references  
such as to "z" in the first working example then they are omitted.


Thanks in advance ... Syd

Syd Geraghty B.Sc, M.Sc.

sydgeraghty at mac.com

Mathematica 7.0.0 for Mac OS X x86 (64 - bit) (21st November, 2008)
MacOS X V 10.5.6
MacBook Pro 2.33 GHz Intel Core 2 Duo  2GB RAM





  • Prev by Date: Re: Coolest Mathematica trick you'll see this month
  • Next by Date: Re: newbie: can't Manipulate ListPlot of recurrence
  • Previous by thread: Re: Manipulating list of functions
  • Next by thread: Re: Manipulating list of functions