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

RE: output from a package

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23193] RE: [mg23168] output from a package
  • From: "David Park" <djmp at earthlink.net>
  • Date: Mon, 24 Apr 2000 01:12:03 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Steven,

If you define a new variable within a package, say x, it will have the name
PackageName`Private`x. I think what you are looking for is Global`x, which
will simply display as x. You can obtain this by simply using the name
Global`x instead of x, or defining a variable in your Module heading as x =
Global`x.

Another place where this problem occurs is when you define and debug a
procedure in a notebook that contains default parameters. For example:
foo[a_,b_, var_:x]:=... When you move this to a package, it will not work as
expected because var will be PackageName`Private`x. Instead, write the
definition as foo[a_,b_,var_:Global`x].

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



> From: steven.w.gaskey at Exxon.com [mailto:steven.w.gaskey at Exxon.com]
To: mathgroup at smc.vnet.net
>
> During a Mathematica session I developed a set of algebraic
> equations to solve a problem describing the vapor-liquid
> equilibrium in a reactor. The procedure I used was to define the
> equations, define a set of rules defining the parameters, define
> a set of initial conditions, then get the equations and initial
> conditions in a form that FindRoot likes and call the function.
> FindRoot returns the set of rules at the solution.
>
> Now I want to carry out the calculation a number of times so I
> used the package template from Maeder's book to turn my notebook
> into a package. The calculations work as expected, but the values
> returned from FindRoot are in the context of the package, e.g.
>
> {vlepackage`Private`wC2->.....}
>
> There are many variables, so I prefer to set up the definition to
> use the same names every time. What I would like is something
> like the `Statistics`LinearRegression package that always returns
> a rule with a name from the current context (or that what it looks like)
>
> That is I would like to be able to say things like
>
> wC2/.vlecalculation[p1,p2,p3]
>
> and the module would return a rule list that would work.
>
> Is there an straightforward way to do this?
>
> Thanks
>
> Steve
>
> Steven Gaskey
> Staff Engineer, Exxpol Reactor Technology Development
> ExxonMobil Chemical Company
> Baytown Polymer Center
> 5200 Bayway Dr
> Baytown, TX 77520
> 281 834 0356  Fax: 281 834 2434
> Steven.W.Gaskey at Exxon.com
>



  • Prev by Date: Re: how to rank a list of elements?
  • Next by Date: Re: how to rank a list of elements?
  • Previous by thread: output from a package
  • Next by thread: fastest way to do pair-sum / make pair-list