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: [mg122035] Re: Interesting problem looking for a solution.
  • From: "Dr. Wolfgang Hintze" <weh at snafu.de>
  • Date: Mon, 10 Oct 2011 04:26:56 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j6rk1f$1nr$1@smc.vnet.net>

"Church, Gary" <churchg at smccd.edu> schrieb im Newsbeitrag 
news:j6rk1f$1nr$1 at 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




  • Prev by Date: Re: Interesting problem looking for a solution.
  • Next by Date: Re: Schroedinger EQ
  • Previous by thread: Re: Interesting problem looking for a solution.
  • Next by thread: Re: Interesting problem looking for a solution.