Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Ack, piecewise functions on lists?' topicStudent Support Forum > General > Archives > "Ack, piecewise functions on lists?"

Next Comment >Help | Reply To Topic
Author Comment/Response
Maneesh
05/06/03 10:32pm

Hi all, I have a table of values of the form:

thevalues={{1,2,3},{4,5,6},{7,8,9}}

Now if I define a simple function like:

sq[x_]:=x*x

and I say

sq[thevalues]

I get the expected result:

{{1,4,9},{16,25,36},{49,64,81}}

Now how come when I define a funtion like

Threshold[x]:=x/;x>0;
Threshold[x_]:=1;x<=0;

It works fine if I just give it a single argument,
but when I want to apply to all values in my Table it doesn't evaluate..?

Is there anything else I should do to my funciton definition?

URL: ,

Subject (listing for 'Ack, piecewise functions on lists?')
Author Date Posted
Ack, piecewise functions on lists? Maneesh 05/06/03 10:32pm
Re: Ack, piecewise functions on lists? Forum Modera... 05/12/03 9:43pm
Next Comment >Help | Reply To Topic