LiveCode Math Library
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
LiveCode Math Library
Hi again,
I discover LiveCode and it is still the best programming language for me.
I wonder , Does LiveCode support complex Math functions? (Foor example matrix calculation, transpose, inverse..)
If It has this capabilities , How I use these functions?
Thanks for reply.
I discover LiveCode and it is still the best programming language for me.
I wonder , Does LiveCode support complex Math functions? (Foor example matrix calculation, transpose, inverse..)
If It has this capabilities , How I use these functions?
Thanks for reply.
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: LiveCode Math Library
Some of these, like transpose, are in the language - see the dictionary.
There's also an old MetaCard library named joneslib.mc which has some useful stats functions, but it's not been updated in a while and has a few conflicts with the current set of language tokens. I've contacted the author to see if he'll allow me to distribute an updated version - I'll keep you posted.
In the meantime, the built-in functions may help get you started, and LiveCode's fast enough that most of the rest can probably be scripted with reasonable effort.
There's also an old MetaCard library named joneslib.mc which has some useful stats functions, but it's not been updated in a while and has a few conflicts with the current set of language tokens. I've contacted the author to see if he'll allow me to distribute an updated version - I'll keep you posted.
In the meantime, the built-in functions may help get you started, and LiveCode's fast enough that most of the rest can probably be scripted with reasonable effort.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: LiveCode Math Library
While you're working your way through the built-in functions, I can give you an update on JonesLib:
The author, Dr. David L. Jones of University of South Florida, has granted me permission to update JonesLib to work with current versions of LiveCode.
I have some client deadlines to meet for the next several days so I'm not sure exactly when I'll be able to get to it, but I don't think it'll take too long once I do.
I'll drop a note here when it's available.
The author, Dr. David L. Jones of University of South Florida, has granted me permission to update JonesLib to work with current versions of LiveCode.
I have some client deadlines to meet for the next several days so I'm not sure exactly when I'll be able to get to it, but I don't think it'll take too long once I do.
I'll drop a note here when it's available.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: LiveCode Math Library
Richard, while I don't have the math skills to track down any weirdness in that area of things, I grabbed the library and think I have things tweaked so that (hopefully) everything is now working.
Changed the name of transpose to transposeAFunc to remove the name conflict
Change the name of matrixmultiply to matrixmult to remove the name conflict
Adjusted sterr function to remove a variable naming conflict with livecode standarddeviation function.
Also set sterr to use the livecode standarddeviation but a simple comment change can revert to using the library stdv
My comments in the script are marked with ## at the start of each line.
I probably missed things (again do to a major lack of math skills) but hopefully this will save you a couple minutes when you get the time to check it.
The updated file is here: http://dl.dropbox.com/u/11957935/jonesLib.livecode
Changed the name of transpose to transposeAFunc to remove the name conflict
Change the name of matrixmultiply to matrixmult to remove the name conflict
Adjusted sterr function to remove a variable naming conflict with livecode standarddeviation function.
Also set sterr to use the livecode standarddeviation but a simple comment change can revert to using the library stdv
My comments in the script are marked with ## at the start of each line.
I probably missed things (again do to a major lack of math skills) but hopefully this will save you a couple minutes when you get the time to check it.
The updated file is here: http://dl.dropbox.com/u/11957935/jonesLib.livecode
FourthWorld wrote:While you're working your way through the built-in functions, I can give you an update on JonesLib:
The author, Dr. David L. Jones of University of South Florida, has granted me permission to update JonesLib to work with current versions of LiveCode.
I have some client deadlines to meet for the next several days so I'm not sure exactly when I'll be able to get to it, but I don't think it'll take too long once I do.
I'll drop a note here when it's available.
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: LiveCode Math Library
Good work. I appreciate your efforts, but I'm still going to do a revision of my own to take advantage of some opportunities for optimization.
For compatibility, I'll use your version as a starting point.
For compatibility, I'll use your version as a starting point.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: LiveCode Math Library
Hey Richard,
Was just wondering how you're getting on with the math library rewrite?
I'd love to be able to learn from your optimisations.
Thanks,
-Ken
Was just wondering how you're getting on with the math library rewrite?
I'd love to be able to learn from your optimisations.
Thanks,
-Ken
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: LiveCode Math Library
Thanks for the bump in this thread -- good reminder of one more thing on my to-do list.kcorey wrote:Was just wondering how you're getting on with the math library rewrite?
You can blame my clients for the current delay - been a busy season here (though I'm certainly not complaining; it's a good problem to have).
And before I dive into joneslib I need to first finish an article for LiveCodeJournal.com documenting the format for the output of LC's arrayEncode function.
With any luck I'll be able to complete both of those within the next two weeks, but if you don't see a post from me to that effect you're welcome to rattle my cage at ambassador -at- fourthworld.com to make sure it doesn't fall off my plate.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: LiveCode Math Library
! Muchly looking forward to that.an article for LiveCodeJournal.com documenting the format for the output of LC's arrayEncode
Post an update on the forum when you get that put together - LiveCodeJournal tends to get lost between the cracks and could use more publicity.
Re: LiveCode Math Library
I am completely new to livecode, I just downloaded the community version. How do I see the standard math functions available?
-
- VIP Livecode Opensource Backer
- Posts: 9676
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: LiveCode Math Library
Hi.
The best way is to use the dictionary. There is no filter there, however, for math functions and commands, So you have to pretty much find them yourself. But if you want to add two numbers, you might search for the "add" command, or the "+" operator. You get the point.
Of particular value to you might be the "see also" elements when you do find a math item. This will lead you to all sorts of others.
To find such things as "sqrt" or "matrixMultiply", you will need patience and luck. But they are all there. You can always ask here for particular things.
Craig Newman
The best way is to use the dictionary. There is no filter there, however, for math functions and commands, So you have to pretty much find them yourself. But if you want to add two numbers, you might search for the "add" command, or the "+" operator. You get the point.
Of particular value to you might be the "see also" elements when you do find a math item. This will lead you to all sorts of others.
To find such things as "sqrt" or "matrixMultiply", you will need patience and luck. But they are all there. You can always ask here for particular things.
Craig Newman
Re: LiveCode Math Library
Thanks Craig, how do you utilize the library they were talking about in this post: JonesLib?
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: LiveCode Math Library
Bump. Richard - has this indeed fallen off your plate?
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: LiveCode Math Library
Evidently. Or more specifically, I have the folder on my desktop and hilited in red to remind me to dive into that optimization when I have a chance, but this darn open source thing with LiveCode has been keeping my phone ringing with client work, so it's been idle way too long.mwieder wrote:Richard - has this indeed fallen off your plate?
If anyone else has time to take a stab at it please do so.
In addition to the conventional things we might look for, like using "repeat for each..." instead of "repeat with.." and making sure loops have as much work done outside of them as possible, etc., there are some interesting notes on performance from Wil Dijkstra's posts to the old MC list that may be worth reviewing:
http://lists.runrev.com/pipermail/metac ... 04415.html
http://lists.runrev.com/pipermail/metac ... 04469.html
http://lists.runrev.com/pipermail/metac ... 04539.html
One of the things I learned from those is the impact of variable initialization on calculations. We often take such things for granted, but I've found in some recent work that I was able to boost performance of some handlers by as much as 30% when I passed variables by reference rather than by value.
A more subtle benefit can come from exploring different ways of doing arithmetic on vars as described in the third link above. Interesting how small things can add up.
Of course such changes need to be considered on a case-by-case basis, but worth keeping in mind when revising JonesLib.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn