ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 16 Mar 2024 14:11:08 +0100Simple ReLU plothttps://ask.sagemath.org/question/76502/simple-relu-plot/I am trying to plot this simple ReLU function max(0,x).
But the line is struck at y=0. Can somebody help ?
Here is my code:
plot(max(0,x), -2, 2)Fri, 15 Mar 2024 06:10:57 +0100https://ask.sagemath.org/question/76502/simple-relu-plot/Comment by ramesh1600 for <p>I am trying to plot this simple ReLU function max(0,x). <br>
But the line is struck at y=0. Can somebody help ? </p>
<p>Here is my code: <br>
plot(max(0,x), -2, 2)</p>
https://ask.sagemath.org/question/76502/simple-relu-plot/?comment=76536#post-id-76536thanks. max_symbolic works.Sat, 16 Mar 2024 14:11:08 +0100https://ask.sagemath.org/question/76502/simple-relu-plot/?comment=76536#post-id-76536Comment by FrédéricC for <p>I am trying to plot this simple ReLU function max(0,x). <br>
But the line is struck at y=0. Can somebody help ? </p>
<p>Here is my code: <br>
plot(max(0,x), -2, 2)</p>
https://ask.sagemath.org/question/76502/simple-relu-plot/?comment=76512#post-id-76512sage: max_symbolic?Fri, 15 Mar 2024 15:29:30 +0100https://ask.sagemath.org/question/76502/simple-relu-plot/?comment=76512#post-id-76512Answer by Cyrille for <p>I am trying to plot this simple ReLU function max(0,x). <br>
But the line is struck at y=0. Can somebody help ? </p>
<p>Here is my code: <br>
plot(max(0,x), -2, 2)</p>
https://ask.sagemath.org/question/76502/simple-relu-plot/?answer=76516#post-id-76516You can try
f(x) = max_symbolic(x,0);
plot(f(x), -2, 2)Fri, 15 Mar 2024 16:49:32 +0100https://ask.sagemath.org/question/76502/simple-relu-plot/?answer=76516#post-id-76516Comment by ramesh1600 for <p>You can try</p>
<pre><code> f(x) = max_symbolic(x,0);
plot(f(x), -2, 2)
</code></pre>
https://ask.sagemath.org/question/76502/simple-relu-plot/?comment=76534#post-id-76534This worked. Thank you very much.
I went and read the max_symbolic documentation, I could not understand why max does not work, but the max_symbolic resolved my problem. Is there a simpler explanation for why python max does not work in the plotting ?Sat, 16 Mar 2024 13:58:40 +0100https://ask.sagemath.org/question/76502/simple-relu-plot/?comment=76534#post-id-76534