Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I do this in Mathematica:

fr = HeavisideTheta[r];
data = somecoolfunctionsinmathematica[r,fr]

So that data now is in the form useful to Fit: {{r_1,fr_1},{r_2,fr_2},...}


share|cite|improve this question
up vote 1 down vote accepted

This is the correct way to use Table if you prefer it to Map:

Table[{i, HeavisideTheta[10 - i]}, {i, 0, 20, 0.013}]
share|cite|improve this answer

I've found it, albeit syntactically a bit... involved (but I've seen a lot worse):

data = Table[{r[i], HeavisideTheta[10-r[i]]}, {r[i], Range[0, 20, 0.013]}]
share|cite|improve this answer
Map will do it: {#,HeavisideTheta[10-#]}&/@Range[0,20,0.013] – Sasha Nov 9 '11 at 13:16
Also Transpose[{#, HeavisideTheta[10 - #]}]&[Range[0, 20, 0.013]]... – J. M. Nov 9 '11 at 13:44
Funny how the (IMHO) much worse pops up in comments under my answer :) – rubenvb Nov 9 '11 at 13:47
That's alright. IMHO taking a procedural approach when functional methods are available is a bit of a step backwards, but whatever, right? – J. M. Nov 11 '11 at 2:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.