Lizard - Script language for symbolic calculations, arbitrary large and precise numbers, parallel computing and more

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
STARGÅTE
Addict
Addict
Posts: 2067
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Lizard - Script language for symbolic calculations, arbitrary large and precise numbers, parallel computing and more

Post by STARGÅTE »

Preamble:
I worked on Lizard since 8 years. Lizard differs significantly from other script languages, as you can see in the features below.
Lizard is very similar to the mathematical and scientific program Mathematica. Lizard should make it possible to carry out calculations, data analysis and much more with a small script without much code. At the moment I am only providing you with the Lizard.dll (Lizard.so), its include file as well as some examples and a detailed documentation on Lizard. The publication of the source code is planned.
Please test Lizard at this early stage and give me feedback on the current features. I would also like to explicitly thank the following people who probably didn't even know that they helped me: Helle (ASM optimization), CSHW89 (idea and division algorithm)

Download:
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.
Lizard - Documentation (Documentation only, just for viewing)

Features of Lizard:
  • Full support of symbolic expression.
  • Support of arbitrary size integers.
  • Support of real numbers with arbitrary precision.
  • Support of rational and complex numbers.
  • Full unicode character string and binary string support as well as unicode collation algorithm.
  • Support of parallel computing using multiple cores.
  • Support of polymorphic or anonymous functions.
  • Powerfull pattern matching engine for assignments and replacements.
  • Overloading of built-in functions for custom definitions.
  • Support of named parameters in functions.
  • High flexibility in work with subparts of strings, lists or general expressions.
  • Numerous conversion functions, supporting different number formats and string formats under consideration of endianness and digit base.
Details:
In Lizard everything, really everything, is an expression consisting of a head and any number of arguments. That means also object types themselves, e.g. lists or well-known keywords such as If, And etc. are again just expressions and can also be used again as such. This makes Lizard very flexible and powerful, but on the deep level it is also slower than usual script languages, in which these things are clearly separated and differentiated.

Here are some examples of the features (many more in the documentation):
  1. Code: Select all

    In(1) := {2^100, 8/12, 1/4.0, (-2.0)^0.4}
    Out(1) = {1267650600228229401496703205376, 2/3, 0.25, 0.40775+1.25493*I}
  2. Code: Select all

    In(2) := {3*x - 2*x, a && True && b, Sin(Pi/6)}
    Out(2) = {x, a && b, 1/2}
  3. Code: Select all

    In(3) := 123.456 ^ 6789
    Out(3) = 1.889456296024e14199
  4. Code: Select all

    In(4) := Calculate(Pi, 60)
    Out(4) = 3.14159265358979323846264338327950288419716939937510582097494
  5. Code: Select all

    In(5) := Sort( {-3, 2, -1, 0, 4}, Abs(#1) <= Abs(#2) & )
    Out(5) = {0, -1, 2, -3, 4}
  6. Code: Select all

    In(6) := Select( {1, 2, 3, 4, y, 2.2}, #^2 < 6 & )
    Out(6) = {1, 2, 2.2}
  7. Code: Select all

    In(7) := Replace( a+b+c+d, a+d -> x )
    Out(7) = b + c + x
  8. Code: Select all

    In(8) := {a,b,c,d,e}[2..-2]
    Out(8) = {b, c, d}
  9. Code: Select all

    In(9) := "Hello World!"[-1..1..-1]
    Out(9) = "!dlroW olleH"
  10. Code: Select all

    In(10) := Iterate(i^2, {i, -3, 3} )
    Out(10) = {9, 4, 1, 0, 1, 4, 9}
  11. Code: Select all

    In(11) := ToString('\0a\x03» ¬', BinaryFormat->"UTF16", Endianness->1)
    Out(11) = "aλ€"
  12. Code: Select all

    In(12) := Sort({"NINO", "Nina", "Nino", "Ninu", "Niño"})
    Out(12) = {"Nina", "Nino", "NINO", "Niño", "Ninu"}
Have fun during testing.

ChangeLog
  • 0.4.4-0002: Functions for parallel computing, 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.
  • 0.4.3-0002: Large bug-fix update. Additionally, new functions like Count and Contain, Flatten and Nest as well as new numerical functions like ShiftLeft, Bernoulli, Numerator and queries like IsPrime.
  • 0.4.2-0001: There are a number of new functions, mainly of mathematical nature, such as the completion of the trigonometric and hyperbolic functions, Expand, Fibonacci and Binomial, more functions for complex numbers like Conjugate, Im or Re, constants like EulerMascheroni or GoldenRatio and functions for working with sets such as Union or Intersection.
    There are also SubDefine and SubDefineDelayed for a special way of defining functions (more in the help)
    In addition, a few functions have been renamed.
  • 0.4.0-0005: Some bug fixes and a first version for Linux.
  • 0.4.0-0001: Implementierung von unlimitierten Fließkommazahlen, neue Funktionen: Factorial(), Precision(), Cos(), Sin(), Cosh(), Sinh(), ArcTan()
  • 0.3.8-0012: x86 support!, small bug-fixes, two more examples for pure basic implementation, new Lizard-functions: Floor, Ceil, Trunc, Order
  • 0.3.8-0002: First publication
Last edited by STARGÅTE on Sun Aug 28, 2022 6:41 pm, edited 13 times 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 moreTypeface - Sprite-based font include/module
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Lizard - Script language for symbolic calculations and m

Post by infratec »

Just tried to test it and ... failed.

I use PB 5.73B4 x86
Maybe your included dll is x64.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Lizard - Script language for symbolic calculations and m

Post by Kwai chang caine »

+1 :|
Lizard kernel initialization failed!
ImageThe happiness is a road...
Not a destination
User avatar
STARGÅTE
Addict
Addict
Posts: 2067
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Lizard - Script language for symbolic calculations and m

Post by STARGÅTE »

The Library is for 64-bit processors only, I will add a CompilerError. Some parts are written in directly in ASM, and it would take some time to add 32-bit version.
But in my opinion in today's life 32-bit is not needed, isn't it?

@infratec: You have no 64 operating system or just using PB x86?
@Kwai chang caine: You started it also in 32-bit mode, or is it another failure?
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 moreTypeface - Sprite-based font include/module
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Lizard - Script language for symbolic calculations and m

Post by infratec »

I develop software for companies and ...

they use Win7, 8 and 10 and on some PCs cause of old database programs still WinXP.
To avoid different versions, I still compile only for x86 on windows.

Code is smaller, compatibility is higher, I can not measure any speed advantages.

For linux and OSX I use the 64bit compiler, because linux users always use the latest technology
and OSX users had no chance to decide :mrgreen:
User avatar
STARGÅTE
Addict
Addict
Posts: 2067
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Lizard - Script language for symbolic calculations and m

Post by STARGÅTE »

@infratec:
I see. I will take a look, how the source code can be made compatible with x86.
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 moreTypeface - Sprite-based font include/module
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Lizard - Script language for symbolic calculations and m

Post by Little John »

Very impressive, and very well done! Image
Thank you so much for this!
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Lizard - Script language for symbolic calculations and m

Post by Kwai chang caine »

Stargate wrote:You started it also in 32-bit mode, or is it another failure?
Yes :oops:
I have W10 X64 but i continue to use PB X86 for be sure of the maximum compatibility with another persons, like say INFRATEC :wink:
ImageThe happiness is a road...
Not a destination
User avatar
STARGÅTE
Addict
Addict
Posts: 2067
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Lizard - Script language for symbolic calculations and m

Post by STARGÅTE »

I am happy to present you a new version of Lizard, now supporting x86 processors!

Download:
Lizard - Symbolic computation script language (Version 0.3.8-0012, x64 and x86, Windows)

ChangeLog
  • 0.3.8-0012: x86 support!, small bug-fixes, two more examples for pure basic implementation, new Lizard-functions: Floor, Ceil, Trunc, Order
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 moreTypeface - Sprite-based font include/module
oyster
User
User
Posts: 13
Joined: Wed Mar 11, 2020 5:07 pm

Re: Lizard - Script language for symbolic calculations and m

Post by oyster »

sorry to ask, but is there any comparasion between Lizard and https://github.com/symengine/symengine ?
or they are absolutely 2 different things?
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Lizard - Script language for symbolic calculations and m

Post by BarryG »

STARGÅTE wrote:But in my opinion in today's life 32-bit is not needed, isn't it?
32-bit is still very current in these times. Don't forsake it.

Let's take the replies from infratec and KCC: both report it failed. Now, imagine they were non-PureBasic users who know nothing about computers: their reaction would be that your software is junk, buggy, and sucks - and will move on, and possibly even bad-mouthing it to anyone who asks about such a product in future. In other words, you get one chance to make a good impression and you've just blown it, and your reputation as a competent coder for those users is in the toilet. Why on earth would you do that?

Look at this comment on StackOverflow -> https://stackoverflow.com/a/41497867/7908170

And look at what the comment recommends to do:
Rather than making a commitment to either 32-bit or 64-bit when it comes to distributing your executable, you can do both: [...] have a 32-bit executable that contains the 64-bit binary as an embedded resource, and runs like so:

1. Is this a 32-bit OS? If so, then run as normal.
2. Otherwise, it's a 32-bit process on a 64-bit system, so extract the 64-bit .exe version to a temporary directory.
3. Start the extracted 64-bit version.
4. Self-terminate.
Sounds like the best plan to me. (Although, I'd extract the 64-bit to the same directory, instead of a temp one, to avoid anti-virus tools from panicking).
User avatar
STARGÅTE
Addict
Addict
Posts: 2067
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Lizard - Script language for symbolic calculations and m

Post by STARGÅTE »

oyster wrote:sorry to ask, but is there any comparasion between Lizard and https://github.com/symengine/symengine ?
or they are absolutely 2 different things?
I can not judge. Where can I find a list of the features of symengine or any documentation?


@BarryG:
Thanks for your comment. I also realized that 32-bit is still important.
Even though Lizard has less potential in 32-bit mode, I now offer also 32bit version.
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 moreTypeface - Sprite-based font include/module
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Lizard - Script language for symbolic calculations and m

Post by Kwai chang caine »

StarGate wrote: a new version of Lizard, now supporting x86 processors!
That works nice here !
I like the console mode :wink:
Thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
oyster
User
User
Posts: 13
Joined: Wed Mar 11, 2020 5:07 pm

Re: Lizard - Script language for symbolic calculations and m

Post by oyster »

STARGÅTE wrote:
oyster wrote:sorry to ask, but is there any comparasion between Lizard and https://github.com/symengine/symengine ?
or they are absolutely 2 different things?
I can not judge. Where can I find a list of the features of symengine or any documentation?
https://github.com/symengine/symengine is a C++ version of https://www.sympy.org

the feature of https://www.sympy.org can be found on https://www.sympy.org/en/features.html
however I don't know whether symengine has covered all features of sympy or not
User avatar
STARGÅTE
Addict
Addict
Posts: 2067
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Lizard - Script language for symbolic calculations and m

Post by STARGÅTE »

Thanks for the link.
To coming back to the original question: "but is there any comparison between Lizard and symengine"?:
Yes, the main intention is quite similar: The support of a computer algebra system (CAS).
However, the range of functionality of such CAS is currently quite small in Lizard, especially compared to sympy.
On the other hand, I would say Lizard has also some additional features like the pattern matching or the string handling, because Lizard is (and should) not only limited to the math area.
I saw that sympy also supports the "Wild"-symbol for pattern patching, similar to my Any-symbol, but I haven't read exactly what control you have with it, like my AnySequence or the attributes like Orderless or Flat.

I know Lizard is not completely new, of cause not. But at the end it also depends on the syntax which language you (somebody) choose, if the features are similar. Do you have experience with symengine or sympy?
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 moreTypeface - Sprite-based font include/module
Post Reply