Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
02-25-2009, 05:07 PM
|
#1
|
Member
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110
Rep:
|
Help with plotting f(x,y) functions in KmPlot or Maxima
I know this is more of a math question than a Linux one, but it is involving Linux applications. Does anyone know how to plot a function with two variables (e.g. f(x,y) = (x^2)+(y^2)^2)−((x^2)−(y^2))) in a Linux software like KmPlot or Maxima?
Last edited by baldurpet; 02-25-2009 at 05:09 PM.
|
|
|
02-27-2009, 03:04 AM
|
#2
|
Member
Registered: Jun 2005
Location: U.S.
Distribution: xubuntu 8.10, linux 2.6.27-11-generic
Posts: 78
Rep:
|
It's been a while since I've been in calculus, so I'm not sure if these will help you.
Gnuplot says that it can do both parametric and 3d.
However, gnuplot is on of the more complicated programs and, IIRC, requires command line usage.
|
|
|
02-28-2009, 07:25 AM
|
#3
|
Member
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110
Original Poster
Rep:
|
Quote:
Originally Posted by shakezilla
It's been a while since I've been in calculus, so I'm not sure if these will help you.
Gnuplot says that it can do both parametric and 3d.
However, gnuplot is on of the more complicated programs and, IIRC, requires command line usage.
|
Ah thank you so much! I tried Scilab but that was way too buggy and Maxima always crashes when I try to plot 3D functions. Gnuplot is a great tool, and plotting the function was as easy as splot ((x**2)+(y**2)**2)-((x**2)-(y**2)) (my girlfriend actually asked me whether Linux could plot that function, so I guess now I can tell her to use gnuplot).
Of course having a GUI couldn't hurt (something like KmPlot would be great) but I'm not afraid to getting my hands a little dirty with the command line. Thanks a lot!
Edit: Btw, if anyone else happens to run into this thread don't hesitate to comment.
Last edited by baldurpet; 02-28-2009 at 07:45 AM.
|
|
|
03-11-2009, 01:08 PM
|
#4
|
LQ Newbie
Registered: Feb 2008
Location: Boulder, CO USA
Distribution: Ubuntu and Android
Posts: 10
Rep:
|
I am pretty familiar with Maxima, and am surprised that it crashed, ever. Really, the only way it can _crash_ is if it is running on a buggy Lisp implementation (unless the terminal/wx library/emacs actually crashes). But anyway, if Maxima is setup properly, this should work...
Code:
/* I think this is the function you actually wanted, maybe? */
f(x,y) := ((x^2)+(y^2))^2−((x^2)−(y^2));
plot3d(f(x,y), [x, lower_x, upper_x], [y, lower_y, upper_y]);
or, using the draw library (an arguably more powerful interface to gnuplot) http://www.telefonica.net/web2/biomates/maxima/gpdraw/
Code:
load(draw);
draw3d(explicit(f(x,y), x, lower_x, upper_x, y, lower_y, upper_y));
Of course, Maxima uses Gnuplot for all graphics output. In fact, most scientific programs do, as far as I know. I'm kind of surprised to hear that SciLab doesn't. Octave does. Perl Data Language (PDL) uses PGPLOT, which I thought was a pain to install. There is also GNU Plotutils, which may be good, I have never used it.
Anyway, hope this helps,
Zach S
|
|
|
03-12-2009, 10:21 AM
|
#5
|
Member
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110
Original Poster
Rep:
|
Quote:
Originally Posted by smithzv
I am pretty familiar with Maxima, and am surprised that it crashed, ever. Really, the only way it can _crash_ is if it is running on a buggy Lisp implementation (unless the terminal/wx library/emacs actually crashes). But anyway, if Maxima is setup properly, this should work...
|
Oh, well then I have half a mind to try installing Maxima again. I might have been doing something wrong. I actually used the wxMaxima which uses the wxWidgets interface, maybe I should have been using Maxima, or Maxima for the command line?
What I did:
Selected "_Plotting" > "Plot _3d ...", and write:
Expression: ((x^2)+(y^2))^2-((x^2)-(y^2))
Variable: x from: -5 to: 5
Variable: y from: -5 to: 5
Grid: 30 x 30
Format: inline
And then click "OK", and then the output screen just goes white and after a while prints thousands of "Maxima encountered a Lisp error: Error in PROGN [or a callee]: Couldn't protect"
The thing is that it often works the first time, but then when I try plotting the same plot again, it crashes.
Quote:
Originally Posted by smithzv
Code:
/* I think this is the function you actually wanted, maybe? */
f(x,y) := ((x^2)+(y^2))^2−((x^2)−(y^2));
plot3d(f(x,y), [x, lower_x, upper_x], [y, lower_y, upper_y]);
|
I tried this in the regular Maxima, and it worked great for the first time but then when I tried it again the same problem came up. I guess I'll just use regular terminal-gnuplot for plotting and Maxima for calculating equations.
Quote:
Originally Posted by smithzv
Of course, Maxima uses Gnuplot for all graphics output.
|
Oh, I didn't know that. Well in that case, why doesn't Maxima give you the option of rotating your plots with the mouse? Gnuplot lets you do that. Never mind, I just tried Maxima and it does this totally differently from wmMaxima. It creates a Gnuplot window whereas wmMaxima just plots it into a small box in the output area. Being a Gnuplot window you can obviously rotate your plot. (sorry for the long post)
Last edited by baldurpet; 03-12-2009 at 10:27 AM.
|
|
|
03-13-2009, 12:50 AM
|
#6
|
LQ Newbie
Registered: Feb 2008
Location: Boulder, CO USA
Distribution: Ubuntu and Android
Posts: 10
Rep:
|
Quote:
I might have been doing something wrong. I actually used the wxMaxima which uses the wxWidgets interface, maybe I should have been using Maxima, or Maxima for the command line?
|
Well, I find that command line Maxima can be a pain since you will often times want to save the work you have completed. I happen to use iMaxima (one of several Emacs modes for Maxima), but if you are not an Emacs fan, then wxMaxima might be your next best bet.
Quote:
And then click "OK", and then the output screen just goes white and after a while prints thousands of "Maxima encountered a Lisp error: Error in PROGN [or a callee]: Couldn't protect"
|
Yeah, I guess the other day I had an interesting definition of "crashing". This is a Lisp error, and I guess to the end user, this is basically a crash. But it should be recoverable, not that that will help you if plot3d isn't working.
Quote:
I guess I'll just use regular terminal-gnuplot for plotting and Maxima for calculating equations.
|
Sounds like a temporary fix. One of Gnuplot's greatest features is that it is easily driven by other programs.
Quote:
I tried this in the regular Maxima, and it worked great for the first time but then when I tried it again the same problem came up.
|
This is a puzzler, if you are getting errors when you issue the same plot command on the command line, maybe you have a bad install. Did you install by hand, or through a package manager? I guess the best advice I can give is to post to the maxima mailing list. Maxima has a very active mailing list and many new users post to it.
Other than that, I can confirm that this works with my install of Maxima and I may plot it as many times as I like without error.
Good luck,
Zach S
|
|
|
All times are GMT -5. The time now is 12:06 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|