LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 02-25-2009, 05:07 PM   #1
baldurpet
Member
 
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110

Rep: Reputation: 15
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.
 
Old 02-27-2009, 03:04 AM   #2
shakezilla
Member
 
Registered: Jun 2005
Location: U.S.
Distribution: xubuntu 8.10, linux 2.6.27-11-generic
Posts: 78

Rep: Reputation: 16
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.
 
Old 02-28-2009, 07:25 AM   #3
baldurpet
Member
 
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by shakezilla View Post
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.
 
Old 03-11-2009, 01:08 PM   #4
smithzv
LQ Newbie
 
Registered: Feb 2008
Location: Boulder, CO USA
Distribution: Ubuntu and Android
Posts: 10

Rep: Reputation: 1
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
 
Old 03-12-2009, 10:21 AM   #5
baldurpet
Member
 
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by smithzv View Post
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 View Post
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 View Post
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.
 
Old 03-13-2009, 12:50 AM   #6
smithzv
LQ Newbie
 
Registered: Feb 2008
Location: Boulder, CO USA
Distribution: Ubuntu and Android
Posts: 10

Rep: Reputation: 1
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can integrate kmplot/kalgebra/any other math prog with OO jabka Linux - General 0 06-21-2007 09:56 AM
Latex & with embedded maxima session bmeagle Linux - Software 0 02-27-2007 08:56 AM
LXer: The Road to KDE 4: Kalzium and KmPlot LXer Syndicated Linux News 0 01-31-2007 01:54 PM
maxima%#question ukyo Linux - Software 2 12-18-2004 05:53 AM
Maxima and lisp fettouhi Fedora 0 05-21-2004 07:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration