
Lizard - Script language for symbolic calculations, arbitrary large and precise numbers, parallel computing and more
Re: Lizard - Script language for symbolic calculations, arbitrary large and precise numbers and more
Dear all,
after the bug-fix update from the last time, now I want to share a new feature update.
________________________________________
Lizard - Symbolic computation script language (Version 0.4.4-0002)
Contains the Lizard.dll (Windows x64 and x86), the Lizard.so (Linux x64), the Lizard.pbi, some examples for the integration in Pure Basic and a detailed documentation for Lizard with many examples.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
The new feature gives you the opportunity to run calculations on multiple cores at the same time, which is the first step towards "parallel computing".
Following my principle of handling everything very easy in Lizard, there will be a simply "parallel" version for a few commands, which automatically creates a thread pool, distributes the calculations there, collects the normal results and returns it, without the user having to worry about anything.
An example:
While "Iterate(f(x), {x, 1, 1000})" executes a time-consuming function f sequentially on only one core, "IterateParallel(f(x), {x, 1, 1000})" distributs this calculation automatically on many cores (threads). Depending on the ratio of the actual calculation time to the time required for the thread management stuff, the overall execution time is usually significantly faster. Of course, this does not fit to simple functions, where parallelization is a disadvantage.
An overview of the new parallel computing functions with examples can be found here:Lizard » Core Language » Parallel Computing
Please keep in mind that you can put any Lizard function into a e.g. parallel iteration, to spread them to multiple cores.
Besides, there are a few other new functions like reciprocal trigonometric and hyperbolic functions, some other mathematical functions, again a few bug fixes and I put function plots for numerical functions in the documentation. Lizard » History
So, have fun while testing these features and I will appreciate your feedback.
Edit: Hot-fix 0.4.4-0002
after the bug-fix update from the last time, now I want to share a new feature update.
________________________________________
Lizard - Symbolic computation script language (Version 0.4.4-0002)
Contains the Lizard.dll (Windows x64 and x86), the Lizard.so (Linux x64), the Lizard.pbi, some examples for the integration in Pure Basic and a detailed documentation for Lizard with many examples.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
The new feature gives you the opportunity to run calculations on multiple cores at the same time, which is the first step towards "parallel computing".
Following my principle of handling everything very easy in Lizard, there will be a simply "parallel" version for a few commands, which automatically creates a thread pool, distributes the calculations there, collects the normal results and returns it, without the user having to worry about anything.
An example:
While "Iterate(f(x), {x, 1, 1000})" executes a time-consuming function f sequentially on only one core, "IterateParallel(f(x), {x, 1, 1000})" distributs this calculation automatically on many cores (threads). Depending on the ratio of the actual calculation time to the time required for the thread management stuff, the overall execution time is usually significantly faster. Of course, this does not fit to simple functions, where parallelization is a disadvantage.
An overview of the new parallel computing functions with examples can be found here:Lizard » Core Language » Parallel Computing
Please keep in mind that you can put any Lizard function into a e.g. parallel iteration, to spread them to multiple cores.
Besides, there are a few other new functions like reciprocal trigonometric and hyperbolic functions, some other mathematical functions, again a few bug fixes and I put function plots for numerical functions in the documentation. Lizard » History
So, have fun while testing these features and I will appreciate your feedback.
Edit: Hot-fix 0.4.4-0002
Last edited by STARGÅTE on Sun Aug 28, 2022 6:40 pm, edited 1 time in total.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: Lizard - Script language for symbolic calculations, arbitrary large and precise numbers, parallel computing and more
Hello STARGÅTE
if I run my FreeBasic example here's what I get, if I repeatedly enter the expression IterateParallel(f(x), {x, 1, 10000})

if I run my FreeBasic example here's what I get, if I repeatedly enter the expression IterateParallel(f(x), {x, 1, 10000})
Code: Select all
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time 0.8843369000005623 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time 0.8588957000010851 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time 0.8535100999997667 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time 0.8651286999993317 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time 0.8615126999993663 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time 1.376355700000204 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time 15.84586130000025 seconds
Last edited by jack on Tue Aug 30, 2022 2:33 pm, edited 1 time in total.
Re: Lizard - Script language for symbolic calculations, arbitrary large and precise numbers, parallel computing and more
Dear Jack,
I assume, you haven't define a function for f? So accually, you just create a large expression like:
"{f(1), f(2), f(3), f(4), ..., f(9999), f(10000)}" without any evaluation.
This means, no parallization is possible.
Let's try the following. Here, a function f is a function which needs ~10ms for evaluation:
Regarding the increase of time: You should use Lizard_FreeExpression(Expression) after you output them to release the memory. Otherwise, all expressions keep in memory.
However, I'm wondering, why the evaluation time increases at a certain evaluation rapidly.
I can confirm such behavior, when I print the all the results. It has nothing to do with the parallel computing. I have to check.
Edit: I have found the issue. The String-Return from the DLL was "wrong".
Lizard - Symbolic computation script language (Version 0.4.4-0002)
I assume, you haven't define a function for f? So accually, you just create a large expression like:
"{f(1), f(2), f(3), f(4), ..., f(9999), f(10000)}" without any evaluation.
This means, no parallization is possible.
Let's try the following. Here, a function f is a function which needs ~10ms for evaluation:
Code: Select all
In(1) := f(x?) := Pause(0.01)
evaluation time: 0.067ms
In(2) := Iterate(f(x), {x, 1, 100});
evaluation time: 1058.806ms
In(3) := IterateParallel(f(x), {x, 1, 100});
evaluation time: 144.861ms
However, I'm wondering, why the evaluation time increases at a certain evaluation rapidly.
I can confirm such behavior, when I print the all the results. It has nothing to do with the parallel computing. I have to check.
Edit: I have found the issue. The String-Return from the DLL was "wrong".
Lizard - Symbolic computation script language (Version 0.4.4-0002)
Last edited by STARGÅTE on Sun Aug 28, 2022 6:42 pm, edited 1 time in total.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
-
- User
- Posts: 70
- Joined: Mon Nov 11, 2013 11:07 am
- Location: Portugal
Re: Lizard - Script language for symbolic calculations, arbitrary large and precise numbers, parallel computing and more
Hi STARGÅTE,
First let me thank you so much, this is great. I am using your script language and it is amazing fast and very useful.
But I have some questions.I hope you or other users can help me out.
KR Al
First let me thank you so much, this is great. I am using your script language and it is amazing fast and very useful.
But I have some questions.I hope you or other users can help me out.
Code: Select all
XIncludeFile "../Lizard/Library/Lizard.pbi"
; Lizard always has to be initialized first.
If Lizard::Initialize("../Lizard/Library") ; Define here the path of the Lizard.dll location.
Debug "Lizard kernel has been initialized. Version "+Lizard::Version()
Else
Debug "Lizard kernel initialization failed!"
End
EndIf
Define In$, Out$, Dec$
;EX1
In$ = "Calculate(3 * 479207)"
Out$ = Lizard::Evaluate(In$)
Debug Out$ ; => 1.43762e6 ; did not ask for this scientific notation
;EX2
In$ = "ToInteger(Calculate(3 * 479207))"
Out$ = Lizard::Evaluate(In$)
Debug Out$ ; ==> 1437621 ; ok
;EX3
In$ = "ToInteger(Calculate(3 * 4657387907292887))"
Out$ = Lizard::Evaluate(In$)
Debug Out$ ; => 13972163721878660; wrong, should be 13972163721878661
;EX4
In$ = "ToInteger(Calculate(3 * 4657387907292887, 20))"
Out$ = Lizard::Evaluate(In$)
Debug Out$ ; => ok
;EX5
In$ = "ToInteger(Calculate(3 * 6825132555633339069956470743970633775870071, 20))"
Out$ = Lizard::Evaluate(In$)
Debug Out$ ; 20475397666900017209869403903378106225786880 => wrong so 20 is Not enough For long integer-strings
;EX6
Out$ = "6825132555633339069956470743970633775870071"
Dec$ = Str(Len(Out$))
In$ = "ToInteger(Calculate(3 * " + Out$ + ", " + Dec$ + "))"
Out$ = Lizard::Evaluate(In$)
Debug Out$ ; => ok
; Details
; Integer numbers can be of any size And are Not limited To the word size of the processor.
; Integer numbers are always exact values.
;Questions:
;1. Where is the documentation of Evaluate()? I did not find it.
;2. How can I force output to be string format like in EX2.
;3. What am I doing wrong in EX3?
;4. Is Ex6 the way to go? Can I make it better/faster?
;5. Integer numbers are always exact values says the documentation, is this correct or am I doing something wrong?
Re: Lizard - Script language for symbolic calculations, arbitrary large and precise numbers, parallel computing and more
Dear Al_the_dutch,Al_the_dutch wrote: Mon Oct 21, 2024 10:04 pm Hi STARGÅTE,
First let me thank you so much, this is great. I am using your script language and it is amazing fast and very useful.
But I have some questions.I hope you or other users can help me out.
Questions:
1. Where is the documentation of Evaluate()? I did not find it.
2. How can I force output to be string format like in EX2.
3. What am I doing wrong in EX3?
4. Is Ex6 the way to go? Can I make it better/faster?
5. Integer numbers are always exact values says the documentation, is this correct or am I doing something wrong?
KR Al
I'm so sorry that I missed your post last year, I didn't noticed it and then it was out of the active threads.
Now, I saw it and I hope you are still interested in using the script.
So I will try to answer your questions:
>> "1. Where is the documentation of Evaluate()? I did not find it."
Lizard::Evaluate() is a function from the Include file. It just evaluates the input string by the script language and outputs a string again.
>> "2. How can I force output to be string format like in EX2."
The Lizard function "Calculate" force a calculation to floating point numbers and returning scientific notation.
When you try to evaluate 2*Pi, the output will be just 2*Pi, because Pi is a constant. Calculate(2*Pi) forces the calculation and give 6.28319, like you get when you evaluate 2.0*Pi.
In general there is no need for using Calculate(). Lizard::Evaluate("3 * 479207") will also return 1437621.
>> "3. What am I doing wrong in EX3?"
Calculate() performs by default a (fast) calculation with double precision (roughly 16 decimal digits). Your number 3*4657387907292887 has more digits. So either you just write Lizard::Evaluate("3 * 4657387907292887") to perform exact integer calculation, or you force the number of decimal digits to be used, like you did in EX4.
>> "4. Is Ex6 the way to go? Can I make it better/faster?"
No. Simply use Lizard::Evaluate("3 * 6825132555633339069956470743970633775870071").
>> "5. Integer numbers are always exact values says the documentation, is this correct or am I doing something wrong?"
Yes that's true, as long as you don't mix them up with decimal numbers.
Last edited by STARGÅTE on Tue Jul 08, 2025 4:00 pm, edited 1 time in total.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
-
- User
- Posts: 70
- Joined: Mon Nov 11, 2013 11:07 am
- Location: Portugal