Forum archive 2000-2006

Andy Wildenberg - functions with parts

Andy Wildenberg - functions with parts

by Arnold Pizer -
Number of replies: 0
inactiveTopicfunctions with parts topic started 11/19/2001; 11:23:49 AM
last post 11/20/2001; 12:19:30 PM
userAndy Wildenberg - functions with parts  blueArrow
11/19/2001; 11:23:49 AM (reads: 743, responses: 1)
I was trying to evangelize WebWork the other day to a person teaching a statistics class, and managed to show him that most of his homework problems could be made into WebWork if there was one extension: allowing students to define functions with parts. I was wondering if anyone had considered this sort of development or had tried implementing similar/equivalent technology.

One example of this functionality would be allowing students to type in an answer like

f(x)={ x^2 if x>=0, x if x<0}

The only ways that I can think of doing this would be fairly complicated in terms of the HTML generated and the evaluation scripts used to check the answers, but I thought I'd throw it out in case anyone had tried something similar.

<| Post or View Comments |>

userArnold K. Pizer - Re: functions with parts  blueArrow
11/20/2001; 12:19:30 PM (reads: 912, responses: 0)
In version 1.7 there is a step(x) function which is 1 if x > 0 and 0 if x <= 0. So having the student enter

x^2*step(x) + x*step(-x)

would give you your particular example above. Of course if you really need a function which is 1 if x >= 0 and 0 if x < 0, things become more complicated ( e.g. cos(x)*[1-step(-x)] ) and get more complicated still if the step or steps are off set from zero.

For fairly simple cases, it is probably not too hard to show students how to use this step function.

If we allowed functions of multiple variables [e.g. char(3,5,x) for the characteristic function on the interval (3,5)] and found a good way to denote what happens at the end points (e.g. char_oo, char_oc, char_co, char_cc where o means open and c closed), then having students use these functions would probably be reasonable and instructive. Such functions can be built from step(x), but not in a resonable manner.

<| Post or View Comments |>