Print message with Maxima - maxima

Is it possible to make Maxima print some message on the terminal?
For example make Maxima write something like Done with step n in order to know where it is in the program.

Related

Is it possible to show math formula codes in Moodle?

In moodle foruns, the string "\(" enters math mode and "\)" leaves it. Is it possible to use some kind of verbatim mode to prevent code compilation of a particular formula?
The goal is to teach students how to write math formulas, with texts like this:
In order to show 'x squared', you must write \\( x^2 \\)".

Are there anyone master in Python?

I know there are differences between print and return function, but sometimes, it does the same effect when you get the outputs. Under this condition, how do we differentiate between print and return?
There is a problem there, in fact you are confusing them, but also there are some changes between Python 2 and Python 3.
As Micha said, return is an statement, that would only work if it is inside a function, and would return a parameter list if it is present: return statement doc
And now we have print that depending on the version of Python you are using (Python 3 is the recommended version to use now), you will have either an statement or a function. As of Python 2, print is an statement that evaluates and prints the list of expressions directly to standard input: print doc
But in Python 3, print is a more complex function, which its default behaviour is to print directly to standard output i.e. screen; but you can modify it with its other arguments: print function doc Python 3
Print statement is not longer available in Python 3.

Can I change the way Maxima/wxMaxima displays the transpose operator?

Can I change the way Maxima displays the transpose operator? The (default) of just printing "transpose" uses very much space and makes the formulae harder to read.
When I enter:
transpose(M)
I would like it to print something like
MT.
I use Maxima through wxMaxima.
PS. There is no tag for wxMaxima on SO.
This is a great question. Unfortunately there isn't a way to handle it within Maxima itself, but if it's OK to do a little Lisp programming, we can solve it.
(%i1) :lisp (defun dimension-transpose (expr stuff) (dimension-superscript `((mexpt) ,(cadr expr) |$t|) stuff))
DIMENSION-TRANSPOSE
(%i1) :lisp (setf (get '%transpose 'dimension) 'dimension-transpose)
DIMENSION-TRANSPOSE
(%i1) transpose(A.B);
T T
(%o1) B . A
Essentially we just define a display function which constructs an MEXPT (i.e. "^") expression and displays that, and then tell Maxima to use the new function to display transpose expressions.
Be careful to copy the punctuation exactly as it is shown. Be careful to distinguish backtick from single quote.
EDIT: The above works for command-line Maxima. For wxMaxima probably there is some similar procedure, but I don't know it.

Calculate list of first derivative of function in Maxima for selected interval

I am facing a simple problem in Maxima: I want to calculate list of first derivatives of function / expression in various points. I know how to calculate list of "points" for normal expression:
float(makelist((x^2/sin(x-x/2),x,1,1000))
but when I run the expression through diff it changes expression to function and I don't know how to work with functions. I tried:
float(makelist(diff(x^2/sin(x-x/2)),x,1,1000))
which "zeroed" on me. Then I tried this:
float(makelist(''(diff(x^2)),x,1,1000))
which gives you right answer, but the result is not a number anymore. It's a list of something like:
[2.0 del(1.0), 4.0 del(2.0), 6.0 del(3.0), 8.0 del(4.0), ...
Would someone care to enlighten me about Maxima functions and numeric evaluation?
I know that this is a silly beginner's question, but I have never worked with Maxima before.
I think you want float(makelist(''(diff(x^2, x)),x,1,1000)) i.e. you need to write diff(expression, variable) instead of just diff(expression).

SBCL Switches print and read order (lisp)

I'm still learning lisp, so, when I came across this problem, it confused me.
I have a simple function where I want to print first and then read the input:
(defun ask()
(princ '?)
(read))
So, when I ran this with CLISP, it showed what was expected, it printed ?, and then, on the same line, I could write the input to the read function.
When I ran this with SBCL, it went wrong. First asks me the input and then prints ?. I figured it could be because I'm not making a newline, but I really wanted to know how can I make this work in SBCL in the same line. Also, I wonder why the result in CLISP is right and in SBCL is not.
Thank you for your help in advance.
It works in the proper order for me, but maybe your case can be connected with output buffering, performed by SBCL. You can add (finish-output) after princ to guarantee, that printing will be finished, before read is called.
For those stumbling upon this, I have found that the print / read statements seem to get out of order more often for me when running sbcl from inside an emacs shell. If I run my code from inside a gnome terminal, however, it seems to output correctly most of the time.

Resources