No lines appear in the plot. I tried to define the function with F[x_,a_,b_] and all kinds of combinations but nothing works. I think I am doing something conceptually wrong, can somebody help?
but I am just guessing because if I look closely at your post I see “a (UnitStep -…” and I’m assuming something got corrupted in that.
Sometimes helpful hint: If you are trying to post code then hitting Enter a few times and positioning the cursor in the middle of those
blank lines and then clicking on the red “spikey ball” at the right end of the second row of buttons above the box you are typing in will
create a thin little outlined box. Paste code inside that box and the forum software will do less mangling of code inside the box than
if you put code in with the text of your message. Having more than one “spikey ball box” is more advanced and needs more instructions.
there’s actually a simple reason why your code doesn’t work: when you plot a function, you have to specify its arguments. Which means that this is wrong:
Plot[F,{x,0,1}]
…and here’s the correct version:
Plot[F[x],{x,0,1}]
The same goes for the UnitStep function in your first example, which also misses its argument and therefore won’t work.
that works, but keeps re-evaluating the function definition of F all the time even when a and b don’t change. The following trick avoids that, in case the OP wants to use your version:
Thank you very much for thorough expalanation.
So even if for me a and b are just parameters I have to define them as variables, very instructive… I will have to check on the documentation what TrackedSymbols is
Thanks.