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: [mg67561] RE: [mg67521] Packages--Problem in evaluating functions from my own package!!!
  • From: "David Park" <djmp at earthlink.net>
  • Date: Fri, 30 Jun 2006 04:15:55 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Is your thesis about physics or is it about computer science? The reason I
ask this is because you talk about making a real time graphical interface
and that sounds to me like a very major computer science project that has
little to do with physics.

If your thesis is actually about some physics topic, and not about designing
computer interfaces, then you might consider simply using the regular
Mathematica notebook interface. This is quite versatile and allows you to
produce documents that are just like textbooks or research papers, with
textual discussion, equations and diagrams. If you can do this, and it
should be possible to do most projects this way, you will avoid a lot of
extra work.

Don't think of Mathematica as a calculator and don't think of it as a
programming language but think of it as a piece of paper on which you write
your thesis. You should be able to do everything, or almost everything,
within Mathematica.

Do you know how to do things like entering Text cells and using Section
groupings, Subsection groupings, etc., and things like that?

When I work on some topic I always make a Mathematica notebook as follows: I
put an Initialization Section at the top where I put all the initialization
statements - such as loading in packages. I usually make these
Initialization cells and when I save the notebook I DON'T save as an
Autosave Package.

Then I always put next a Routines Section. In the Routines section I
accumulate routines I develop while working on the physics topic. I usually
also write usage messages for them. I usually make these Initialization
cells also. I don't use any package structure at all at this point. I might
even copy this Routines Section from notebook to notebook. After I have used
the routines for a while, and see that they work, and maybe have perfected
them, and if I think they would be generally useful - then, and only then,
do I put them into a package.

I find that the easiest way to work.

I'm not quite certain what your name is.

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


From: Oumaima Abdou [mailto:abdou.oumaima at hotmail.com]
To: mathgroup at smc.vnet.net

Hello David,
You email proof your niceness because you spend a time to help me, I'm
really happy to read from you. I'll try soon your suggestions, hope that it
works.
I prepare my PHD thesis in physics and I'm using mathematica for my
numerical calculus. By now I'm trying to attain one objectif is to gather
all my functions in one application and to do a graphic interface for a real
time calculus. I'm using J/Link and some Java Code. I don't know if I'll
achieve my aim, but better trying than never.
I come back to you after testing your suggestions if you don't mind.
Thank you again.
PS: My English is so modest because I'm French-speaking :-)
Best regards

>From: "David Park"
To: mathgroup at smc.vnet.net
>Subject: [mg67561] RE: [mg67521] Packages--Problem in evaluating functions from my
own package!!!
>Date: Thu, 29 Jun 2006 09:30:07 -0400
>
>Lian,
>
>The best way, I think, to handle packages is to put them in a place where
>Mathematica will automatically find them. And that place can be found by
>evaluating $BaseDirectory or $UserBaseDirectory in Mathematica 5.x. (These
>files are discussed in Help, Getting Started, System-Specific Information,
>File Layout.) This will give you a private Mathematica folder and within
>that folder you will find an 'Applications' folder. Put all your packages
in
>the 'Applications' folder and Mathematica will automatically find them.
>
>Within the Applications folder make a folder for your package (and other
>files that may go with it). Say, make a 'spaceMaths' folder. Then put your
>package file directly in the 'spaceMaths' folder.
>
>Make you BeginPackage statement:
>
>BeginPackage["spaceMaths`METHODECN`"];
>
>Notice that this gives the path from the Applications folder. You can then
>load your package with
>
>Needs["spaceMaths`METHODECN`"]
>
>Mathematica will be able to find it because it automatically looks in the
>various Mathematica/Applications directories. This way you have a standard
>place for packages and applications and you don't have to use any
>SetDirectory statements, or wonder where that package was.
>
>You could also put other packages in spaceMaths or you could make
individual
>folders for each package.
>
>David Park
>djmp at earthlink.net
>http://home.earthlink.net/~djmp/
>
>
>From: abdou.oumaima at hotmail.com [mailto:abdou.oumaima at hotmail.com]
To: mathgroup at smc.vnet.net
>
>Hi to All,
>
>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"];
>psiplusCN::usage = "psiplusCN[cn] evaluate Psi+";
>psimoinsCN::usage = " psimoinsCN[cn,c]evaluate Psi-";
>
>Begin["`Private`"]
>
>Off[General::spell, General::spell1, General::precw];
>WorkingPrecision -> 40;
>
>(*** ** *** Module Psi + *******)
>psiplusCN[cn_] := Module[{i}, psiplus = Table[If[i == 1, 1, 0], {i, 1,
cn}];
>     Return[psiplus];];
>
>(*** ** *** Module ksi *******)
>ksi[x_] := Module[{£i, ksinum},
>     ksinum = FindRoot[1.0 - (x* ArcTanh[£i])/£i == 0.0, { £i,
>0.01}, \
>WorkingPrecision -> 20];
>      £i = £i /. ksinum;
>     Return[£i] ;];
>
>(*** ** *** Module Psi - *******)
>psimoinsCN[cn_, c_] := Module[{Zplus,
>     Zmoins, DomP, GlnP, GlnP2, Vp, Wn, delta, integpp, ...... M, A, Y,
>£i},
>
>....
>
>Return[LinearSolve[M, Y]]];
>End[];
>EndPackage[];
>
>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
>
>and this ouptput:
>psiplusCN[1]
>psimoinsCN[1, 0.8]
>
>Please help me to load my own package and evaluate my public function
>psimoinsCN and psiplusCN and to get numerical values.
>
>Thanks for all who take time to read this topic and to reply for help.
>
>
>Lian.


  • Prev by Date: Re: Packages--Problem in evaluating functions from my own package!!!
  • Next by Date: Re: Bugs--Bugs Report in List Operation
  • Previous by thread: Re: Packages--Problem in evaluating functions from my own package!!!
  • Next by thread: RE: Packages--Problem in evaluating functions from my own package!!!