Maxima On Android really wasn’t designed, either to allow interactive rotation of 3D Plots, or, to allow animated, 3D Plots. But let us put ourselves in the position that it is the chosen Computer Algebra System, and that the user wants ‘interactive 3D Plots’.
What Maxima On Android has to offer natively, is a 3D Plot, but displayed from a static perspective. In fact, I’ve read that the way it works is, that Maxima On Android plots to a PNG File, and then displays the PNG File in a secondary window, from which the user may switch back to the CAS window / worksheet.
Various efforts I’ve made have failed, to get the viewing window for the plots to animate. One possible reason could be, the possibility that Maxima On Android actually waits, until the entire worksheet has finished executing, before allowing the viewing window to be opened. Repeated, iterative plotting locks up the app, until the loop has finished, at which point, at best, the last version of the plot can be viewed.
The following was the best that I could do, to get this port of Maxima to plot interactively:
i: 0$ Frame():= block ( plot3d(sin(%pi*(x+(i/4)))*cos(%pi*y), [x, -1, 1], [y, -1, 1]), i: i + 1 )$ Frame()$
This Maxima Batch File / Script requires some participation by the user, to work. The user may Load it from within the Maxima On Android GUI, after which the first iteration of the plot will display. After that, the user needs to tap on the ‘Back’ arrow, to get back to the worksheet. Then, tapping on the last ‘Frame()’ command, will cause it to display in the command field. Then, tapping ‘Enter’ will cause the next iteration of the plot to appear.
From the second point on, in the process, that the user has tapped on the ‘Back’ arrow, the command ‘Frame()’ should still be in the command field. Therefore, ‘Enter’ can just be tapped again, and the process repeated as often as desired.
(Updated 7/05/2020, 10h50… )
(As of 7/05/2020, 8h15: )
The user should not be worried, that the only way to animate a ‘Maxima On Android’, 3D Plot, would be, ‘to cause wavy motion to take place’.
The purpose of animating the plot was, to compensate for the fact that natively, the interactive rotation of a 3D Plot was not supported. This makes a 3D Plot incomplete, because any one viewing angle, only results in one, 2D view of the same plot. The ability to rotate it should actually be seen as a necessity and not a luxury, because, depending on how complex an eventual plot really is, being able to get multiple viewing angles could be the only way to comprehend it.
However, the reader should also know, that to rotate plots easily, actually requires the ‘draw’ package, which, unlike the ‘plot3d()’ function, needs to be loaded, before it can be used. Thus, the following Script does work, according to my own, recent verification, on a Samsung Galaxy Tab S6:
load(draw)$ explObj: explicit(sin(%pi*x)*cos(%pi*y), x, -1, 1, y, -1, 1)$ f: 30$ Frame() := block ( draw3d( enhanced3d=true,surface_hide=true,colorbox=false, view = [60, f], explObj ), f: f + 30 )$ Frame()$
This script is meant to be used exactly like my previous script above, except that, unlike the previous script, this one rotates the viewing angle around the Z-axis.
The parameter which accomplishes this is the:
view = [60, f]
Assignment. It takes a list of two values, which are in degrees. The first is the angle of rotation about the X-axis, from 0 to 180, and the second is the angle of rotation around the Z-axis, from 0 to 360.
In order to visualize what the direction of this viewing angle is better, I’d offer the explanation that, even though the object being viewed above is rotating ‘clockwise around the Z-axis’, the actual viewing angle, from which it’s being depicted, has two, advancing, counter-clockwise values, both facing the origin, but the first ‘vertically down’, and the second, ‘horizontally to the right’. Rotating the view to the right in this way, actually rotates what the user sees to the left. It’s as if the ‘view’ was a camera angle.
Actually rotating the plot in this way, comes closer to compensating for the initial inability to do so, than it did, ‘just to make the waves move’.
(Update 7/05/2020, 10h50: )
One fact which I should acknowledge is, that while I may like the colour-coded surface that the second script generates, not everybody will. The reason this happens is not the fact that ‘draw3d()’ has replaced ‘plot3d()’, but rather, that the parameters have been set, ‘
enhanced3d=true,surface_hide=true‘. What, exactly, ‘enhanced3d’ does, which was not available with ‘plot3d()’, is documented Here. Its behaviour is modified by the parameter ‘palette’. By default, this option can be left out, and a wireframe view will result. Whether ‘
surface_hide=true‘ should be set, remains a separate question.
This feature has been implemented exactly as it would be, with standard versions of Maxima, and is meant to give maximum flexibility to the user, in how he or she wants 3D surfaces highlighted. The function that chooses the colours, can be customized, as well as how the range of colours results from this numerical function (hence, the palette).
colorbox=false‘ was entirely my choice. By default, if ‘enhanced3d’ is enabled, the ‘colorbox’ parameter would be true, and would display a range of colours next to the actual plot, according to whatever palette has been chosen… While I find that the ‘colorbox’ is good for static, 3D Plots, I don’t feel the same when it comes to any sort of animation.