Re: Using own package problem
- To: mathgroup at smc.vnet.net
- Subject: [mg16160] Re: Using own package problem
- From: Jan Krupa <krupa at alpha.sggw.waw.pl>
- Date: Tue, 2 Mar 1999 01:13:10 -0500
- Organization: http://news.icm.edu.pl/
- References: <7b8blf$52b@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Jan Krupa wrote: > BeginPackage["ExLinearProgramming`"] > > ExLinearProgramming::usage = > "LinearProgramming[c,A,b] finds the vector x which minimizes > the quantity c.x subject to the constraints A.x >= b and x >= 0. > ExLinearProgramming[c,A,b,d] may be used when the inequalities > in A.x >=b numbered by d[[1]],d[[2]],...,d[[Length[d]]] are > replaced by equalities." > > Begin["`Private`"] > > ExLinearProgramming[c_,A_,b_,d_]:= > Module[{k,A1,A2,b1,b2,x0,Fx0},k=Length[d]; > A1=Table[Part[A,d[[i]]],{i,1,k}]; > A2=Join[-A,A1]; > b1=Table[Part[b,d[[i]]],{i,1,k}]; > b2=Join[-b,b1]; > x0=LinearProgramming[c,A2,b2]; > Fx0=c.x0;{Fx0,x0}] > End[] > EndPackage[] > > I saved it: File/Save As Special/Package Format > I did not change the "Cell Properties" to "Initialization Cell" for the cell in ExLinearProgramming.m. Now when I changed the "Cell Properties" it seem that the package works. > using the name ExLinearProgramming.m and put it in the > directory /usr/local/mathematica/AddsOn/Applications > > Then in the Mathematica X Front end I type: > > In[1]:=<<ExLinearProgramming.m (shift enter) > > then > > In[2]:= ExLinearProgramming[c,A,b,d] > > Out[2]=ExLinearProgramming[{1,-2,3, > > 2},{{1,1,1,1},{3,1,-2,-1},{3,-2,4,-1},{2,3,-5,-1}},{1,10,3,-4},{1,4}] > > Now it works (after the changes of Cell Properties. > So the function ExLinearProgramming in the Package ExLinearProgramming.m > does > not work. > > I have tried also the following: > > In[4]:=$Packages > Out[4]={"ExLinearProgramming`","Global`","System`"} > > In[5]:=?ExLinearProgramming > Out[5]=Global`ExLinearProgramming > > The last command should give the description of usage of the package > from the file ExLinearProgramming.m: > Again now it works but I do not know how to end some line and start new line (the blank lines do not work: The following lines in ExLinearProgramming.m put between "..." In[5]:=something Out[5]=something give after command ?ExLinearProgramming In[5]:=something Out[5]=something Is there a way to seperate some regions of text by blank lines? > How to get the description and example of usage be available via the > Help Browser and Help Index, Master Index from the X Front End? Where can I find some explaination how to create the "BrowserCategories.m" file and "MyLinearProgramming.nb" in the directory /Documentation/English ? I have created some such files following the example of existing documentation but I could not get them working. Could someone please give some advise (www site, book, some hint,... Jan