Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5545 > unrolled thread

Interesting problem looking for a solution.

Started by"Church, Gary" <churchg@smccd.edu>
First post2011-10-09 07:55 +0000
Last post2011-10-12 07:49 +0000
Articles 8 — 6 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  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

#5545 — Interesting problem looking for a solution.

From"Church, Gary" <churchg@smccd.edu>
Date2011-10-09 07:55 +0000
SubjectInteresting problem looking for a solution.
Message-ID<j6rk1f$1nr$1@smc.vnet.net>
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

[toc] | [next] | [standalone]


#5562

From"Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com>
Date2011-10-10 08:26 +0000
Message-ID<j6ua6q$etm$1@smc.vnet.net>
In reply to#5545
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.

[toc] | [prev] | [next] | [standalone]


#5568

From"Dr. Wolfgang Hintze" <weh@snafu.de>
Date2011-10-10 08:29 +0000
Message-ID<j6uadn$f1r$1@smc.vnet.net>
In reply to#5545
"Church, Gary" <churchg@smccd.edu> schrieb im Newsbeitrag 
news:j6rk1f$1nr$1@smc.vnet.net...
> 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
>

Are you looking for something like this?
To begin with, define the list lf of possible functions.
Then select a definition for f[x] at random from the list, and finally 
plot it.
Repeat the second step (In[219]) as often as you (and your students) 
like.

In[221]:=
lf = {x^2, Sin[x], Exp[-x]};


In[219]:=
f[x_] = lf[[Random[Integer, {1, 2}]]];
Plot[f[x], {x, 0, 5}];

If you wish to keep the list secret your can hide it from being viewed 
using the option inspector of the cell (right click > General 
Properties > Cell Open set to false > Apply).

Hope this helps
Wolfgang

[toc] | [prev] | [next] | [standalone]


#5590

FromMurray Eisenberg <murray@math.umass.edu>
Date2011-10-11 08:23 +0000
Message-ID<j70ud7$o3$1@smc.vnet.net>
In reply to#5545
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.
>

-- 
Murray Eisenberg                     murray@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

[toc] | [prev] | [next] | [standalone]


#5601

FromMurray Eisenberg <murray@math.umass.edu>
Date2011-10-11 08:31 +0000
Message-ID<j70utr$u8$1@smc.vnet.net>
In reply to#5545
With that proposed solution, all the student needs to do to see the 
function's definition is to open the closed cell.

Very low security!

On 10/10/11 4:26 AM, Dr. Wolfgang Hintze wrote:
> "Church, Gary"<churchg@smccd.edu>  schrieb im Newsbeitrag
> news:j6rk1f$1nr$1@smc.vnet.net...
>> 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
>>
>
> Are you looking for something like this?
> To begin with, define the list lf of possible functions.
> Then select a definition for f[x] at random from the list, and finally
> plot it.
> Repeat the second step (In[219]) as often as you (and your students)
> like.
>
> In[221]:=
> lf = {x^2, Sin[x], Exp[-x]};
>
>
> In[219]:=
> f[x_] = lf[[Random[Integer, {1, 2}]]];
> Plot[f[x], {x, 0, 5}];
>
> If you wish to keep the list secret your can hide it from being viewed
> using the option inspector of the cell (right click>  General
> Properties>  Cell Open set to false>  Apply).
>
> Hope this helps
> Wolfgang
>
>

-- 
Murray Eisenberg                     murray@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

[toc] | [prev] | [next] | [standalone]


#5604

FromAndrzej Kozlowski <akoz@mimuw.edu.pl>
Date2011-10-12 07:43 +0000
Message-ID<j73gf5$frh$1@smc.vnet.net>
In reply to#5545
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@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@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
>

[toc] | [prev] | [next] | [standalone]


#5606

From"Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com>
Date2011-10-12 07:46 +0000
Message-ID<j73gjv$fu6$1@smc.vnet.net>
In reply to#5545
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.

[toc] | [prev] | [next] | [standalone]


#5615

FromDrMajorBob <btreat1@austin.rr.com>
Date2011-10-12 07:49 +0000
Message-ID<j73gql$fva$1@smc.vnet.net>
In reply to#5545
He'd also need to know the random number chosen, would he not?

Bobby

On Tue, 11 Oct 2011 03:25:49 -0500, Murray Eisenberg  
<murray@math.umass.edu> wrote:

> With that proposed solution, all the student needs to do to see the
> function's definition is to open the closed cell.
>
> Very low security!
>
> On 10/10/11 4:26 AM, Dr. Wolfgang Hintze wrote:
>> "Church, Gary"<churchg@smccd.edu>  schrieb im Newsbeitrag
>> news:j6rk1f$1nr$1@smc.vnet.net...
>>> 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
>>>
>>
>> Are you looking for something like this?
>> To begin with, define the list lf of possible functions.
>> Then select a definition for f[x] at random from the list, and finally
>> plot it.
>> Repeat the second step (In[219]) as often as you (and your students)
>> like.
>>
>> In[221]:=
>> lf = {x^2, Sin[x], Exp[-x]};
>>
>>
>> In[219]:=
>> f[x_] = lf[[Random[Integer, {1, 2}]]];
>> Plot[f[x], {x, 0, 5}];
>>
>> If you wish to keep the list secret your can hide it from being viewed
>> using the option inspector of the cell (right click>  General
>> Properties>  Cell Open set to false>  Apply).
>>
>> Hope this helps
>> Wolfgang
>>
>>
>


-- 
DrMajorBob@yahoo.com

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web