ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 18 Feb 2019 15:54:59 -0600plot3d gives me a blank canvas, no plothttp://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/This is my function that i want to plot:
v_ges_rhs == -1/((d_e - x)*e_m) + 1/(e_m*x) + 1/(sqrt((d_e - x)^2 + 4*d_k^2)*d_k*(e_m/d_m + e_s/(d_k - d_m))) - 1/(sqrt(4*d_k^2 + x^2)*d_k*(e_m/d_m + e_s/(d_k - d_m)))
and this is my code for inserting values and finally plotting.
print v_ges_rhs
a=v_ges_rhs.diff(x).diff(d_k)
b=a.subs({
d_e : 1,
d_m : .15,
e_m : e_0 * 81,
e_s : e_0 * 3.5
})
b.show()
W = plot3d(b,(x,-1,-0.01),(d_k,.2,2))
W.show()
As you can see, I avoid the poles at `x == 0` and `x == d_e` by not plotting that part. (But actually i would like to plot from x = -1 to 2, including both poles, but limiting the range. I understand that is tricky... I will cross that bridge once I crossed this one.)
But the result I get is an empty canvas.
This is my worksheet. (Feel free to fix any issues you see, preferably with a comment. :-)
https://cocalc.com/share/f7766c5e-2f4d-4916-bb0d-74a7182e5fd5/2019-02-09-203517.sagews?viewer=share
Sat, 16 Feb 2019 05:20:32 -0600http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/Comment by Iguananaut for <p>This is my function that i want to plot:</p>
<pre><code>v_ges_rhs == -1/((d_e - x)*e_m) + 1/(e_m*x) + 1/(sqrt((d_e - x)^2 + 4*d_k^2)*d_k*(e_m/d_m + e_s/(d_k - d_m))) - 1/(sqrt(4*d_k^2 + x^2)*d_k*(e_m/d_m + e_s/(d_k - d_m)))
</code></pre>
<p>and this is my code for inserting values and finally plotting.</p>
<pre><code>print v_ges_rhs
a=v_ges_rhs.diff(x).diff(d_k)
b=a.subs({
d_e : 1,
d_m : .15,
e_m : e_0 * 81,
e_s : e_0 * 3.5
})
b.show()
W = plot3d(b,(x,-1,-0.01),(d_k,.2,2))
W.show()
</code></pre>
<p>As you can see, I avoid the poles at <code>x == 0</code> and <code>x == d_e</code> by not plotting that part. (But actually i would like to plot from x = -1 to 2, including both poles, but limiting the range. I understand that is tricky... I will cross that bridge once I crossed this one.)</p>
<p>But the result I get is an empty canvas. </p>
<p>This is my worksheet. (Feel free to fix any issues you see, preferably with a comment. :-) </p>
<p><a href="https://cocalc.com/share/f7766c5e-2f4d-4916-bb0d-74a7182e5fd5/2019-02-09-203517.sagews?viewer=share">https://cocalc.com/share/f7766c5e-2f4...</a></p>
http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?comment=45493#post-id-45493@Emmanuel Charpentier, the purpose of this site is for users to ask questions. I don't think berating them for doing so and telling them to (effectively) RTFD is helpful. I have edited your earlier answer to cut down somewhat on the hostility.Mon, 18 Feb 2019 05:14:40 -0600http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?comment=45493#post-id-45493Comment by Emmanuel Charpentier for <p>This is my function that i want to plot:</p>
<pre><code>v_ges_rhs == -1/((d_e - x)*e_m) + 1/(e_m*x) + 1/(sqrt((d_e - x)^2 + 4*d_k^2)*d_k*(e_m/d_m + e_s/(d_k - d_m))) - 1/(sqrt(4*d_k^2 + x^2)*d_k*(e_m/d_m + e_s/(d_k - d_m)))
</code></pre>
<p>and this is my code for inserting values and finally plotting.</p>
<pre><code>print v_ges_rhs
a=v_ges_rhs.diff(x).diff(d_k)
b=a.subs({
d_e : 1,
d_m : .15,
e_m : e_0 * 81,
e_s : e_0 * 3.5
})
b.show()
W = plot3d(b,(x,-1,-0.01),(d_k,.2,2))
W.show()
</code></pre>
<p>As you can see, I avoid the poles at <code>x == 0</code> and <code>x == d_e</code> by not plotting that part. (But actually i would like to plot from x = -1 to 2, including both poles, but limiting the range. I understand that is tricky... I will cross that bridge once I crossed this one.)</p>
<p>But the result I get is an empty canvas. </p>
<p>This is my worksheet. (Feel free to fix any issues you see, preferably with a comment. :-) </p>
<p><a href="https://cocalc.com/share/f7766c5e-2f4d-4916-bb0d-74a7182e5fd5/2019-02-09-203517.sagews?viewer=share">https://cocalc.com/share/f7766c5e-2f4...</a></p>
http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?comment=45477#post-id-45477Dear `stockh0lm`
perusing the worksheet you referred us to demonstratse that you have *not* taken the time to understand what you are trying to do.
For example, your first two code lines
e_0 = var('e_0', latex_name=r'\varepsilon_0')
e_0 = 8.854 * 10^-12
are contradictory:
* The first line creates an object representing a symbolic variable, whose name is `e_0` and affects it to the Python variable `e_0`
* The second line affects the numerical value `8.854*10^-12` to the same Python variable `e_0`, *thus losing any access to your symbolic variable.*Sat, 16 Feb 2019 09:49:33 -0600http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?comment=45477#post-id-45477Comment by stockh0lm for <p>This is my function that i want to plot:</p>
<pre><code>v_ges_rhs == -1/((d_e - x)*e_m) + 1/(e_m*x) + 1/(sqrt((d_e - x)^2 + 4*d_k^2)*d_k*(e_m/d_m + e_s/(d_k - d_m))) - 1/(sqrt(4*d_k^2 + x^2)*d_k*(e_m/d_m + e_s/(d_k - d_m)))
</code></pre>
<p>and this is my code for inserting values and finally plotting.</p>
<pre><code>print v_ges_rhs
a=v_ges_rhs.diff(x).diff(d_k)
b=a.subs({
d_e : 1,
d_m : .15,
e_m : e_0 * 81,
e_s : e_0 * 3.5
})
b.show()
W = plot3d(b,(x,-1,-0.01),(d_k,.2,2))
W.show()
</code></pre>
<p>As you can see, I avoid the poles at <code>x == 0</code> and <code>x == d_e</code> by not plotting that part. (But actually i would like to plot from x = -1 to 2, including both poles, but limiting the range. I understand that is tricky... I will cross that bridge once I crossed this one.)</p>
<p>But the result I get is an empty canvas. </p>
<p>This is my worksheet. (Feel free to fix any issues you see, preferably with a comment. :-) </p>
<p><a href="https://cocalc.com/share/f7766c5e-2f4d-4916-bb0d-74a7182e5fd5/2019-02-09-203517.sagews?viewer=share">https://cocalc.com/share/f7766c5e-2f4...</a></p>
http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?comment=45479#post-id-45479I would love constructive critizism. You point out that I use the variable e_0 incorrectly.Thanks. According to my understanding, the first line is for formating when showing the variable in latex fashion. the reason I write `e_0 = var ...` is that then there is no output from the var directive. I don't really care for that in the output below. How else could i achive that? I didn't see any "silent" option. The second line is for the numerical value. I do find that back and forth a little weired, but there are more things wired to me here, so who am I to judge? I know I still suck at this, and if you would please tell me how to do it correctly it would be great and I would gladly adopt your ways.
My main problems are the error/uncertainty propagation and RIF numbers and the solve thing.Sat, 16 Feb 2019 13:31:20 -0600http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?comment=45479#post-id-45479Comment by stockh0lm for <p>This is my function that i want to plot:</p>
<pre><code>v_ges_rhs == -1/((d_e - x)*e_m) + 1/(e_m*x) + 1/(sqrt((d_e - x)^2 + 4*d_k^2)*d_k*(e_m/d_m + e_s/(d_k - d_m))) - 1/(sqrt(4*d_k^2 + x^2)*d_k*(e_m/d_m + e_s/(d_k - d_m)))
</code></pre>
<p>and this is my code for inserting values and finally plotting.</p>
<pre><code>print v_ges_rhs
a=v_ges_rhs.diff(x).diff(d_k)
b=a.subs({
d_e : 1,
d_m : .15,
e_m : e_0 * 81,
e_s : e_0 * 3.5
})
b.show()
W = plot3d(b,(x,-1,-0.01),(d_k,.2,2))
W.show()
</code></pre>
<p>As you can see, I avoid the poles at <code>x == 0</code> and <code>x == d_e</code> by not plotting that part. (But actually i would like to plot from x = -1 to 2, including both poles, but limiting the range. I understand that is tricky... I will cross that bridge once I crossed this one.)</p>
<p>But the result I get is an empty canvas. </p>
<p>This is my worksheet. (Feel free to fix any issues you see, preferably with a comment. :-) </p>
<p><a href="https://cocalc.com/share/f7766c5e-2f4d-4916-bb0d-74a7182e5fd5/2019-02-09-203517.sagews?viewer=share">https://cocalc.com/share/f7766c5e-2f4...</a></p>
http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?comment=45478#post-id-45478Dear Emmanuel, you are right, I am far from understanding what I do. I do use Computational Mathematics with Sagemath, and I look for stuff in there before i come here. I like the index and look up topics in the book. The book does not answer many of the questions, like my "== vs =" question, for example. I do not think you seriously require people to read and understand a book before asking here, though. I did code a little python, but it is not my favourit programming language.
I use sagemath because I need it as a tool. It would be more useful to me if I could learn just parts of it in order to solve my math problems. I am very willing to learn, and I feel I got a lot better in the week since I started.
There are plenty of questions I do have, but there are some really pressing onesSat, 16 Feb 2019 13:08:36 -0600http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?comment=45478#post-id-45478Comment by Emmanuel Charpentier for <p>This is my function that i want to plot:</p>
<pre><code>v_ges_rhs == -1/((d_e - x)*e_m) + 1/(e_m*x) + 1/(sqrt((d_e - x)^2 + 4*d_k^2)*d_k*(e_m/d_m + e_s/(d_k - d_m))) - 1/(sqrt(4*d_k^2 + x^2)*d_k*(e_m/d_m + e_s/(d_k - d_m)))
</code></pre>
<p>and this is my code for inserting values and finally plotting.</p>
<pre><code>print v_ges_rhs
a=v_ges_rhs.diff(x).diff(d_k)
b=a.subs({
d_e : 1,
d_m : .15,
e_m : e_0 * 81,
e_s : e_0 * 3.5
})
b.show()
W = plot3d(b,(x,-1,-0.01),(d_k,.2,2))
W.show()
</code></pre>
<p>As you can see, I avoid the poles at <code>x == 0</code> and <code>x == d_e</code> by not plotting that part. (But actually i would like to plot from x = -1 to 2, including both poles, but limiting the range. I understand that is tricky... I will cross that bridge once I crossed this one.)</p>
<p>But the result I get is an empty canvas. </p>
<p>This is my worksheet. (Feel free to fix any issues you see, preferably with a comment. :-) </p>
<p><a href="https://cocalc.com/share/f7766c5e-2f4d-4916-bb0d-74a7182e5fd5/2019-02-09-203517.sagews?viewer=share">https://cocalc.com/share/f7766c5e-2f4...</a></p>
http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?comment=45484#post-id-45484You have first to *think* what you want from Sage. Let's take the case of your symbolic constant `e0`. You can either :
* keep it symbolic during your symbolic work (e.g. system solving in your case), and substitute its numeric value when computing numerics (e. g. plotting); or
* define it as a numerical contant : you won't get `e_0` in the output, but the numerical value.
You can't do both.
Getting a "nice" printed output is *yet **another** problem*. Peek at `LatexExpr` and string formatting. In your case, I'd be tempted by
var("e_0", latex_name="\varepsilon_0")
e_0_val={e_0:8.854 * 10^-12}
Print with, e. g. :
show(LatexExpr(r"\varepsilon_0={}".format(latex(e_0))))
and use the numerical value with, e. g. :
plot(SomeExpression.subs(e_0_val), (...)...)
HTHSun, 17 Feb 2019 17:09:30 -0600http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?comment=45484#post-id-45484Answer by stockh0lm for <p>This is my function that i want to plot:</p>
<pre><code>v_ges_rhs == -1/((d_e - x)*e_m) + 1/(e_m*x) + 1/(sqrt((d_e - x)^2 + 4*d_k^2)*d_k*(e_m/d_m + e_s/(d_k - d_m))) - 1/(sqrt(4*d_k^2 + x^2)*d_k*(e_m/d_m + e_s/(d_k - d_m)))
</code></pre>
<p>and this is my code for inserting values and finally plotting.</p>
<pre><code>print v_ges_rhs
a=v_ges_rhs.diff(x).diff(d_k)
b=a.subs({
d_e : 1,
d_m : .15,
e_m : e_0 * 81,
e_s : e_0 * 3.5
})
b.show()
W = plot3d(b,(x,-1,-0.01),(d_k,.2,2))
W.show()
</code></pre>
<p>As you can see, I avoid the poles at <code>x == 0</code> and <code>x == d_e</code> by not plotting that part. (But actually i would like to plot from x = -1 to 2, including both poles, but limiting the range. I understand that is tricky... I will cross that bridge once I crossed this one.)</p>
<p>But the result I get is an empty canvas. </p>
<p>This is my worksheet. (Feel free to fix any issues you see, preferably with a comment. :-) </p>
<p><a href="https://cocalc.com/share/f7766c5e-2f4d-4916-bb0d-74a7182e5fd5/2019-02-09-203517.sagews?viewer=share">https://cocalc.com/share/f7766c5e-2f4...</a></p>
http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?answer=45482#post-id-45482plotting does work when run locally. I assume cocalc does not provide the computing power for the rendering on the free plan or the local javascript renderer does not mesh well with my browser (chrome) or my OS (linux).Sun, 17 Feb 2019 14:26:11 -0600http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?answer=45482#post-id-45482Comment by stockh0lm for <p>plotting does work when run locally. I assume cocalc does not provide the computing power for the rendering on the free plan or the local javascript renderer does not mesh well with my browser (chrome) or my OS (linux).</p>
http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?comment=45502#post-id-45502The exact same code running locally on my debian stable opens a java app and shows a 3d plot. I am happy I have a result. If you say cocalc limiting the free tire is not the issue I belive you. The rest of my conclusion is still valid. I run this on worksheet on several boxes, and it works in none of them. One of the machines is highly controlled (a chromebook). I guess the downvote is ok because its not a constructive answer, but it is a true answer.Mon, 18 Feb 2019 15:54:59 -0600http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?comment=45502#post-id-45502Comment by Iguananaut for <p>plotting does work when run locally. I assume cocalc does not provide the computing power for the rendering on the free plan or the local javascript renderer does not mesh well with my browser (chrome) or my OS (linux).</p>
http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?comment=45492#post-id-45492Respectfully, this is not true (and I am saying so only so that no othe readers get confused). While I have not looked at your specific worksheet, 3D plotting works quite well in Sage Worksheets on CoCalc (better actually than on Jupyter Notebooks, generally), including on a free plan, on Chrome, on Linux. Have you tried starting with a more simple example to get that working first? If it still doesn't work--which for you it apparently isn't--there could still be some issue with your configuration to be sure. But in general there is no issue about "computing power" or anything like that.Mon, 18 Feb 2019 05:12:40 -0600http://ask.sagemath.org/question/45474/plot3d-gives-me-a-blank-canvas-no-plot/?comment=45492#post-id-45492