MathGroup Archive 2006

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

Search the Archive

Re: Packages--Problem in evaluating functions from my own package!!!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67546] Re: Packages--Problem in evaluating functions from my own package!!!
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Fri, 30 Jun 2006 04:14:38 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 6/29/06 at 12:10 AM, abdou.oumaima at hotmail.com wrote:

>I create a package for two importantes functions of my thesis. But
>when I load my package, sometimes I can evaluate my functions but
>all the time not.

>Hereby a piece of my code: --------------------------

>BeginPackage["`METHODECN`"];
>SetDirectory["I:\spaceMaths"];

Why do you have a call to SetDirectory here? There should be no need for it. And having a package change the current working directory when it is loaded is an excellent way to cause problems later when the package is being used.

<code snipped>

>When I load my package:
>SetDirectory["I:\spaceMaths"];
><< METHODECN.m;
>psiplusCN[1]
>psimoinsCN[1, 0.8]

>I get this error message: Get::noopen, Cannot open "METHODECN.m

That is telling you Mathematica cannot find the file METHODECN.m. Where did you save that file? In the spaceMaths directory? If not, that is the problem.

Note, the usual procedure for packages is to put them in one of the directories returned when 

$PATH

is evaluated. If that is done, there will be no need to set the working directory to the directory containing the package. It can be loaded with the following syntax

<<methodecn`

>and this ouptput: psiplusCN[1] psimoinsCN[1, 0.8]

And you get this result since Mathematica did not load your package.

--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Limit of an expression?
  • Next by Date: RE: NDolve + ParametricPlot
  • Previous by thread: Packages--Problem in evaluating functions from my own package!!!
  • Next by thread: RE: Packages--Problem in evaluating functions from my own package!!!