ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi everybody I have some issue with this script.
the porpoise of this code is to plot a function called sin(z) where z is the generic complex number x+iy.
the function does not appear, everything else (windows, x,,y,z range and so on is fine excepted the function).
if someone have some idea would be great.
thank you in advance.
that is the code
Code:
set title "seno di z complesso"
unset key
set xyplane at 0
set xlabel "Rez"; set ylabel "Imz"; set zlabel "sin(z)"
set xrange [-5.:5.]; set yrange [-5.:5.]; set zrange [-5.:5.]
set xtics 1.0; set ytics 1.0; set ztics 2.0
set sample 50,50; set isosamples 50,50
set pm3d depthorder hidden3d
unset colorbox
set view 60,60,1,1
set size square 1.0,1.0
#a(x,y) = x+y
#b(x,y) = x-y
#c(x,y) = x*x
#d(x,y) = x + {0,1}*y
z(x,y) = (x+{0,1}*y)*{0,1}
w (x,y) = (-x +{0,-1}*y)*{0,1}
sinz(x,y) = (exp(z(x,y)) - exp(w(x,y)))/(2*{0,1})
splot sinz(x,y) w pm3d
#splot a(x,y),b(x,y),c(x,y) w pm3d
#splot d(x,y) w pm3d
As can be seen in your tests with the a, b, c and d functions, plotting with real numbers works fine while plotting with complex ones results in the function not appearing.
The function of a complex number is complex itself. Here, you are trying to map it on a single axis even though it has a real and an imaginary part. Thus, you need to plot them separately:
Code:
splot real(sinz(x,y)) w pm3d
for the real part and
Code:
splot imag(sinz(x,y)) w pm3d
for the imaginary part.
As a side note, directly plotting the sine function
Code:
i = {0.0, 1.0} #Define imaginary number
splot real(sin(x+i*y)) w pm3d #Real part
splot imag(sin(x+i*y)) w pm3d #Imaginary part
yields the same result as using the definition of the sine function with exponentials. In the code above, only the last plotted function will appear on screen. Comment the one you do not one to plot.
thank you very much, everything is fine now, I haven't test my scrip yet but a much simple one
I plot the real part of a generic complex number z=x+iy and as I expected a plane came out.
very good.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.