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. :-)
Dear
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
are contradictory:
The first line creates an object representing a symbolic variable, whose name is
e_0
and affects it to the Python variablee_0
The second line affects the numerical value
8.854*10^-12
to the same Python variablee_0
, thus losing any access to your symbolic variable.Dear 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 ...(more)
I 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.You 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 byPrint with, e. g. :
and use the numerical value with, e. g. :
HTH
@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.