MathGroup Archive 2006

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

Search the Archive

RE: problem with modules

  • To: mathgroup at smc.vnet.net
  • Subject: [mg72253] RE: [mg72228] problem with modules
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sat, 16 Dec 2006 05:18:21 -0500 (EST)

Jamie,

Use something like...

genUL[parm1_,parm2_,...]:=
 Module[{U, L},
  U = compute U;
  L = compute L;
  {U, L}]

Don't use MatrixForm in the Module if you want to use U and L. Return U and
L as a list of the two matrices. You do not have to use the Return
statement. Just make {U, L} the last statement in the Module.

You could use this as...

{umat, lmat} = genUL[...]

or

MatrixForm /@ genUL[...]

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

From: jltrahan at mail.usf.edu [mailto:jltrahan at mail.usf.edu]


Hello,
I do not understand how to return a result from a module so that I can use
the result globally. I am trying to generate 2 matrices from the module.
For example,
ludecomp[n_,A_]:=Module[{...},
...;
Return[U//MatrixForm]
Return[L//MatrixForm]]

When I type ludecomp[n,A], it returns a result, however, when I try to
input just the variable U, it
doesn't return a value. I'd greatly appreciate any help that you can
offer!

Thank you,
jamie





  • Prev by Date: RE: image border
  • Next by Date: Re: Can FindFit handle two dependent variables?
  • Previous by thread: Re: problem with modules
  • Next by thread: RE: problem with modules