Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Interesting problem looking for a solution.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122070] Re: Interesting problem looking for a solution.
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Wed, 12 Oct 2011 03:42:29 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j6rk1f$1nr$1@smc.vnet.net> <201110100825.EAA15268@smc.vnet.net> <201110110822.EAA00752@smc.vnet.net>

You  would need to encode the file containing the definition of f with 
Encode and have it loaded at the beginning of a session with Get.

Andrzej Kozlowski


On 11 Oct 2011, at 10:22, Murray Eisenberg wrote:

> I don't understand why that proposed solution would be satisfactory: 
the
> cell defining f is still there!
>
> On 10/10/11 4:25 AM, Oleksandr Rasputinov wrote:
>> On Sun, 09 Oct 2011 08:55:27 +0100, Church, Gary<churchg at smccd.edu>  
wrote:
>>
>>> Hello,
>>>
>>> I have an (I think) interesting problem for you Mathematica gurus.
>>>
>>> I'm trying to create a worksheet for my students and want to be able 
to
>>> display the plot of a randomly generated function f[x], without them
>>> being able to access the expression which defines f; In other words, 
I
>>> don't want them to be able to evaluate f[x].
>>>
>>> The idea is that each student will get a different function f[x] and
>>> will see a different graph and they have to determine the expression
>>> which defines f. They then have to plot the function they think is f
>>> against the actual function f[x] and turn in the two plots (or the 
one
>>> plot with the two graphs.)
>>>
>>> Is this possible?
>>>
>>> Thanks much,
>>> Gary
>>>
>>
>> Much easier than you probably think:
>>
>> In[1] :=
>> f[x_?NumericQ] := Sin[7 x] + Cos[3 x];
>> SetAttributes[f, {ReadProtected, Locked}];
>>
>> In[3] :=
>> Plot[f[x], {x, -Pi, Pi}]
>>
>> Out[3] =
>> <  Plots normally>
>>
>> In[4] :=
>> ??f
>>
>> Prints:	Global`f
>> 	Attributes[f] = {Locked,ReadProtected}
>>
>> In[5] :=
>> f[x]
>>
>> Out[5]
>> f[x]
>>
>> The key elements here are the restriction to numeric values of the
>> parameter and the ReadProtected and Locked attributes.
>>
>
> --
> Murray Eisenberg                     murray at math.umass.edu
> Mathematics & Statistics Dept.
> Lederle Graduate Research Tower      phone 413 549-1020 (H)
> University of Massachusetts                413 545-2859 (W)
> 710 North Pleasant Street            fax   413 545-1801
> Amherst, MA 01003-9305
>




  • Prev by Date: Re: Making a function out of repeated hyperbola integrations?
  • Next by Date: Re: Making a function out of repeated hyperbola integrations?
  • Previous by thread: Re: Interesting problem looking for a solution.
  • Next by thread: Re: Interesting problem looking for a solution.