Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #5606
| From | "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Interesting problem looking for a solution. |
| Date | 2011-10-12 07:46 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j73gjv$fu6$1@smc.vnet.net> (permalink) |
| References | <j6rk1f$1nr$1@smc.vnet.net> <201110100825.EAA15268@smc.vnet.net> |
I took it as read that if the function is to be randomly generated, as
stated in the original post, then in the actual scenario under discussion
there will not exist any cell that shows the explicit definition of f
since it will have been arrived at algorithmically. The example given
below is just that, and intended to only demonstrate the (possibly useful)
behaviour of these attributes.
On Tue, 11 Oct 2011 09:23:03 +0100, Murray Eisenberg
<murray@math.umass.edu> 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@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.
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Interesting problem looking for a solution. "Church, Gary" <churchg@smccd.edu> - 2011-10-09 07:55 +0000 Re: Interesting problem looking for a solution. "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-10-10 08:26 +0000 Re: Interesting problem looking for a solution. "Dr. Wolfgang Hintze" <weh@snafu.de> - 2011-10-10 08:29 +0000 Re: Interesting problem looking for a solution. Murray Eisenberg <murray@math.umass.edu> - 2011-10-11 08:23 +0000 Re: Interesting problem looking for a solution. Murray Eisenberg <murray@math.umass.edu> - 2011-10-11 08:31 +0000 Re: Interesting problem looking for a solution. Andrzej Kozlowski <akoz@mimuw.edu.pl> - 2011-10-12 07:43 +0000 Re: Interesting problem looking for a solution. "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-10-12 07:46 +0000 Re: Interesting problem looking for a solution. DrMajorBob <btreat1@austin.rr.com> - 2011-10-12 07:49 +0000
csiph-web