MathGroup Archive 2008

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

Search the Archive

Re: How to use package without manually evaluating?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90543] Re: How to use package without manually evaluating?
  • From: jeremito <jeremit0 at gmail.com>
  • Date: Sat, 12 Jul 2008 05:33:16 -0400 (EDT)
  • References: <g54oia$etg$1@smc.vnet.net> <g54s0e$hfd$1@smc.vnet.net>

On Jul 10, 7:32 am, Jens-Peer Kuska <ku... at informatik.uni-leipzig.de>
wrote:
> Hi,
>
> you have to find *which* file. The Package *.m has no cells
> and the *.nb file has cells but it is not a package.
>
> Regards
>    Jens
>
Sorry, I'm not exactly sure what you mean.  Do I need a .m file as
well as a .nb file?

I have copied my .m file below for reference.  All the cells are
"Code".


Thanks,
Jeremy

(* :Title: Matrices *)

(* :Name: Matrices *)

(* :Author: Jeremy L. Conlin *)

(* :Context: Matricdes` *)

(* :Summary:
	This package was created to have a centralized location for all my
	special matrix definitions. *)

BeginPackage["Matrices`"];

UHessenberg::usage = "UHessenberg[n] will create a square, n by n, \
upper
Hessenberg matrix with increasing elements."

Begin["Private`"]

UHessenberg[n_] := Module[{H},
(* UHessenberg makes a square upper Hessenberg matrix with increasing
\

	elements. *)
k=1.0;
H = Table[If[i<=j+1,k++,0],{i,n},{j,n}];
Return[H];
]

F[n_]:=Module[{A},
(* This creates a sqaure matrix whose elements are linearly \
increasing.
	All elements are non-zero.*)
k = 1.0;
A = Table[k++,{i,n},{j,n}];
Return[A];
]

(* Standard creates a square matrix that is diagonal with linearly \
increasing
	elements---except for the [[3,2]] entry which is 1.*)
Standard[n_] := \
Module[{S},
S = DiagonalMatrix[Range[1.0,n]];
S[[3,2]] = 1.0;
Return[S];
]

(* Simple matrix from Fundamentals of Matrix Computatations, by David
\
S. Watkins
	pg. 357.*)
Watkins[] := Module[{A},
	A = {{8.,2.},{2.,5.}};
	Return[A];
]

End[]; (* End Private` context. *)

EndPackage[];

> jeremito wrote:
> > I just created a package called Matrices that has several functions
> > that creates matrices that I use frequently.  I placed the Matrices.m
> > file in my auto load directory so it will be loaded when I need it.
> > The problem is I have to find the file and execute all the cells in it
> > before I can use any of the functions.  I'm sure there is a way to
> > avoid this.  Can someone help?
>
> > Thanks,
> > Jeremy



  • Prev by Date: Re: Help with "If" statement within "Table"
  • Next by Date: Re: Help with "If" statement within "Table"
  • Previous by thread: Re: How to use package without manually evaluating?
  • Next by thread: Re: How to use package without manually evaluating?