Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*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 2000

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

Search the Archive

getting module output in replace form

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24605] getting module output in replace form
  • From: Michael Gilchrist <mag5 at duke.edu>
  • Date: Fri, 28 Jul 2000 17:23:42 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

I am trying to create a module that will output a list of replacement 
rules.

for example

{var1, var2}/.CalculateVariables[1, 0.3, 1.222]

where CalculateVariables is the module I am writing.

i.e. 

CalculateVariables[a_, b_, c_]:=
	Module[{var1, var2, var3, var4},

		var1 = a* b^c;
		var2 = b/c;
		.
		.
		.

		{"var1 ->" OutputForm[var1], 
		 "var2 ->" OutputForm[var2],
		 "var3 ->" OutputForm[var3],
		 "var4 ->" OutputForm[var4]
		}
	]

But if I try to use the output as a replacement rule I get
 
>ReplaceAll::"reps" {{var1-> 0.234, var2->0.323, var3-> 100001, var4->0}} 
is neither a list of replacement 
rules nor a valid dispatch table, and so cannot be used for replacing."



I have tried wrapping the "vari ->" in textform, outputform, etc but get 
nowhere.

I feel like I must be doing something wrong since this seems like it 
should be an easy and common use of a module.  Any help would be 
appreciated.

Thanks,


Mike


Michael Gilchrist
Dept. of Biology
Duke University
Durham, NC 27708





  • Prev by Date: MathReader Linux help browser segfaults...
  • Next by Date: Industrial Electromagnetism
  • Previous by thread: Re: MathReader Linux help browser segfaults...
  • Next by thread: Re: getting module output in replace form