Math Library

Lua comes already with a set of math functions. Would you like the idea to code some basic routines (functions, classes) in order to plot 1D functions, 2D functions (which is in fact a 3D problem) using colorplots or meshes (waterfall, …), parametric plots? Codea is also nice just for visualizing math (like the Mandelbrot example from alvelda). Since iPads are also used in schools it might be a perfect platform for such studies, since you can code your own problem with the help of the herein developed functions and classes. Would be nice to hear your opinions about that.

I like your idea. I went for something very basic.

Involving a teacher of the appropriate level would be good.

Once we get curved lines many more topics could be added. There’s still plenty that could be done with the current version.

It will still take a while until I will post some code here. For part of the code I am using translations of other code, and I am waiting for permission to share. Has anyone found a good way to draw facets yet? I am heavily struggling that a 3D mesh plot has too many lines. So far I simply have no idea how to detect, if a line is to be drawn or not. If the surface is closed then it is doable. Maybe Bortels “fill a polygon” project will help me out.

I have fill polygon working, but I’m redoing the interface slightly to make it easier to use. I hope to post code today (I was hoping to post last night, but I went to get a crown on my tooth and the pain made my body go into “hibernation mode”).

Uaaaa, that hurts already while reading this. I have found a small workaround and use filled ellipse to do the job. Try to post the code after cleaning up… It’s still a bit messy and not well organized.
Guess I cannot place a picture here?

A first version for a 3D mesh you will find here. Need to clean up code but wanted to post it here in order to get comments how to improve. Feedback more than welcome as well as changes.

Fixed link

Edit: contained a bunch of bugs … removed that

Wanted to bring that topic again to your attention: I have read in several posts that people are working on plotting graphs, make bar-histograms, … What you think, should we combine our efforts into a common math-library for students? Would perfectly fit to the educational activities of Apple, I think

Great idea @CrazyEd! About the images, do this: ![imagename](URL)
It comes out like this:
For videos, do this: <object width="320" height="180"><param name="movie" value=";hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src=";hl=en_US" type="application/x-shockwave-flash" width="320" height="180" allowscriptaccess="always" allowfullscreen="true"></embed></object>
You can see how that links to a certain youtube video. So it turns out like this:

@CrazyEd I’m working up a set of charting and graphing classes–nothing fancy, just the basic selection. Should have a draft up in the next few days.

Feel free to use any of it for a more coherent project (or to turn up your nose at my clumsy code).

Haha. @Mark - You think your code is clumsy? No… Not even close. At lease compared to mine. Also, with Spritely, that’s just about the most organized code i’ve ever seen!

@Mark: that sounds excellent. No worries about the code …

I have meanwhile a complex class, a matrix class and a somehow working vectorization for functions (e.g. Log accepts now a single real, a single complex, a vector of reals, or also vector of complex arguments, and gets the output into same format as input). The conversion between the argument types is a bit weired still, also the detection is. I used a bunch of metatables, but I guess there is room for improvement … The vectorization itself is just a support, there is no real parallel processing (would that work?), just a consecutive work on array arguments … It is by far not ready, still working out a unique way for argument detection…

My target/goal/wish/dream is to get a small version of an octave (or SciLab) alike number crunsher on the iPad … That was always a dream of mine, and with Codea it seems doable. 100% compatibility seems difficult, so I might request for a slightly different syntax, or I find a way to cut strings into its relevant pieces … No idea if one could write a parser, that reads the input line of the entered code (e.g. in a user defined function, I cannot imagine yet any interactive entering of code that is processed on the fly) and translates this one into the internally used language.

For the plotting routines I am currently working on a Smith Chart, Weibull graph, log-log graph, Bode plots, 2D vector field plots, … The difficulty here is to pack the graphs into a class so that I later on can allow placing multiple plots on the screen. Adjusting axes range, zoom in, zoom out, … Using gestures in a nice way … So using Codea abilities as much as possible. Any hints, tips, tricks, proposals, are more than welcome!

I have some struggles in coding such the user does not need to worry about the input at all. Whatever he does, the input should be correctly interpreted, and the result be correct, as far as the internal accuracy allows. And the number of input lines should be as little as possible. Rest should be done automatically in the background. It’s fascinating how many things, which look so simple, have some awesome pieces of code in the background which do the job right. Trying to code that by yourself increases the respect a lot, I must say.

Updated TrendGrapics with scrolling chart, gauges, and indicator lights.

Thanks! Just loaded 1.3, now I need to change lots of code to implement the new features. Will make things a bit easier, I guess, and faster, too.