I have a sequence of steps that work in the main notebook:


In[708]:= f1x0 = 3.4
f1x0s = MakeSlope[f1der[f1x0]];
f1x0ydif = f1[f1x0] - f1x0s[f1x0]
f1x0t = f1x0s[x] + f1x0ydif

Out[708]= Function[x, 2 x]

Out[710]= 3.4

Out[711]= 6.8

Out[713]= 6.8 x

Out[714]= -11.56

Out[715]= -11.56 + 6.8 x

But inside a Module,


I get in return a function which seems ok mathematically, but with an appended $ code:

In[705]:= f1t = GetTangent[Function[x, x^2], 2]

Out[706]= -4 + 4 x$98923

When I try to plot it, I get an empty plot.

Any ideas as to what might be wrong?


closed as off-topic by mikado, Bill Watts, Kuba Jan 19 at 19:46

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – mikado, Bill Watts, Kuba
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Ok. I have added MakeSlope to the beginning of the code. $\endgroup$ – pedroos Jan 19 at 15:54
  • 3
    $\begingroup$ As written x is locally scoped to Module so that result is as it should be. Might instead make it an explicit argument to GetTangent. $\endgroup$ – Daniel Lichtblau Jan 19 at 16:07
  • $\begingroup$ Read up on how Module works reference.wolfram.com/language/tutorial/HowModulesWork.html That should explain why you get x$nnn. Second, what are you doing to plot it? Surely Plot[-4 + 4 x$98923, {x$98923,x_min, x_max} ] works? $\endgroup$ – void life Jan 19 at 16:09
  • 1
    $\begingroup$ I was just plotting the function directly: Plot[GetTangent[Function[x, x^2], 2], {x, -10, 10}], but I got an empty plot. @DanielLichtblau's comment solved it. $\endgroup$ – pedroos Jan 19 at 16:12

Browse other questions tagged or ask your own question.