Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1997
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

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

Search the Archive

Re: "hidden" definitions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg5755] Re: [mg5728] "hidden" definitions
  • From: Sherman Reed <Sherman.Reed at worldnet.att.net>
  • Date: Tue, 14 Jan 1997 10:42:31 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

At 07:29 PM 1/11/97 +0000, you wrote:
>Is there some way that I can prepare a Notebook with some objects
>defined in it (via :=, say: f[x_] := Module[{...}, ...x....]) and save
>it, yet when the user opens it in Mathematica, she cannot see what the
>definition is although she can use the object so defined?
>
>I tried the obvious thing: making the definition, then setting its
>attributes to ReadProtected and Locked.  But that doesn't do what's
>needed: if I save the notebook and then open it again, of course the
>cell showing the definition is right there in bright daylight!
>
>Is including, too, some appropriate use of Encode what it takes and,
>if so, how?
>
>The specific application I have is for instructional use -- (1) students
>can execute and investigate "mystery" functions; (2) I can provide my
>"correct" versions of Mathematica programs against which students can
>test their own versions for giving the correct results.  (Evidently I
>cannot let them see my versions here.)
>
>A solution that works for Mathematica 2.2 as well as 3.0 would be
>highly preferable.
>
>--
>  Murray Eisenberg                       Internet:  murray at math.umass.edu
>  Mathematics & Statistics Dept.            Voice:  413-545-2859 (W)
>  University of Massachusetts                       413-549-1020 (H)
>  Amherst, MA 01003                           Fax:  413-545-1801
>
Murray,

I taught a Numerical Methods course using Mma for five years at
UTexasArlington. I have used two techniques to do what you desire.

The first:

I created a data file of the mystery function on either another session
of Mma, Mathcad, Excel or whatever.  I gave the data file to students
on a disk and also gave them the Mma code to read the data file.  I used
this after students had been exposed to Curve Fitting using Fit and 
Fast Fourier Transform.  The functions were linear combinations of 
Sines, Cosines, constants and time dependent bias plus a healthy dose of
random noise.  This kind of a project really taught students how to use
Fast Fourier Transform and Least Square Curve Fitting.  

This is basically bullet proof in terms of protection and works for Macs,
NeXTs, Windows, etc.  Also works for 2.0 and 3.0 Mma.

The second.

I created a package (.m) in another session of Mma, used SetAttributes to 
ReadProtect and used NumericQ to permit only numeric evaluation.  I put
the package in the Preload directory. (could be any directory, even a new
one).  Use DeclarePackage so that when students first access the package,
it is automatically loaded, but not visible. Now students can use the
package.

Not as bullet proof, but for average students, should do the job.  Smart
students will break it.  Does not work for students who have Mma away from
campus. (I had lots of students who owned Mma, or had Mma at work) 

Hope this helps

Sherman Reed

 



  • Prev by Date: Re: GroebnerBasis
  • Next by Date: M3 TeXSave
  • Previous by thread: "hidden" definitions
  • Next by thread: Joining matrices