-
Jan 29th, 2023, 01:48 AM
#1
Thread Starter
New Member
Last edited by ksmateer; Feb 9th, 2023 at 02:50 AM.
-
Jan 29th, 2023, 03:01 AM
#2
Re: Programmers wanted to test a numerical library
-
Jan 29th, 2023, 10:55 AM
#3
Re: Programmers wanted to test a numerical library
This VBCorLib project also has a BigInteger implementation: https://github.com/kellyethridge/VBCorLib
-
Jan 30th, 2023, 02:27 AM
#4
Thread Starter
New Member
Re: Programmers wanted to test a numerical library
I'd like to make it open source eventually.
-
Jan 30th, 2023, 02:29 AM
#5
Thread Starter
New Member
Re: Programmers wanted to test a numerical library
My library comes with BigInt, BigDec and BigCom object data types.
-
Jan 30th, 2023, 05:51 AM
#6
Re: Programmers wanted to test a numerical library
What is BicCom??
I would like to insert BigInt...to my M2000 Interpreter. I didn't like the VBCorLib library. For my interpreter I like to have objects, not UDT. In VBCorLibm, there is a public UDT:
Code:
Public Type BigNumber
Digits() As Integer
Precision As Long
Sign As Long
End Type
My expression evaluator works with pure types (boolean, integer, long, long long, single, double, currency, decimal), and with objects (user objects can define operators). So the expression evaluator can be expanded if there is an object which have all the functions on it (including function as operators).
-
Jan 30th, 2023, 09:28 PM
#7
Thread Starter
New Member
Re: Programmers wanted to test a numerical library
Hello georgecar. I am deleting this post and moving it to a more
appropriate forum that Elroy mentioned.
But to answer your question quickly, my library is completely object
oriented using COM architecture. BigCom is an object data type that
contains complex numbers (in the form a + bi where a nd b are real
values and i denoted the imaginary unit.)
From the code snippet you presented it seems you might be interested
in BigDec, an object data type for real values (up to 10,000 digits).
-
Jan 30th, 2023, 09:36 PM
#8
Thread Starter
New Member
Programmers wanted to beta test a numerical library
Hello, I'm looking for some programmers to beta test a numerical library, written as an ActiveX dll in VB 6 pro. The library provides all elementary functions for integer, floating point and complex arithmetics. Values can be calculated up to 10,000 digits though methods are optimized for 100 digits, hence the name Big Goo Numerical
Library. (Goo is for googol.)
It comes complete with a help file and a simple demo program. The library will be free to use and distribute. As for open source, I'm considering it but the intention is for mathematicians primarily.
If anyone is interested let me know and I'll send you a copy.
-
Jan 31st, 2023, 12:06 AM
#9
Re: Programmers wanted to beta test a numerical library
Can you post the help file? It might drum up some interest if the documentation looks interesting.
-
Jan 31st, 2023, 02:44 AM
#10
Thread Starter
New Member
Re: Programmers wanted to beta test a numerical library
That's a good idea. The help file is an HTML file. Is there a place where I can upload it so that users can download it?
If not then I can always email it to you.
-
Jan 31st, 2023, 05:25 AM
#11
Re: Programmers wanted to test a numerical library
This is my complex object, is small. Written in M2000 Interpreter which run on a VB6 application.
User objects are something more than an object. They are objects in the background, but it is a layer above it, where interpreter take charge of what these objects do. One thing is that they have objects inside. Properties are objects (group type) which are parts of groups.
Here the program make two type of complex numbers, single and double. Both of them are class type Complex.
Not only we make complex numbers but also arrays (one dimension). This Idea (the program written for version 11) give me the magic I need to create the Version 12.
So I show you this code to see the "interface". Please you can show some sample of the usage of the proposal library.
PHP Code:
Class Complex { Private: k, lim=0 Function copy { =group(this) } Public: Property Ptr { value {link parent k to k: value=k(0)} } Property Ubound { value {link parent lim to lim: value=lim} } Final Lbound=0& // we use clear to clear value variable which property define as double by default // using Property a { }=0& we can define the value as long // but here we use Real for two different buffers, one with type double and one with type single Property Real { value {clear:link parent k to k: value=eval(k,0)} } Group Real { operator "++" { link parent k to k: Return k, 0:=eval(k, 0)+1 } } Property Imaginary { value {clear:link parent k to k: value=eval(k,1)} } Group Imaginary { operator "++" { link parent k to k: Return k, 1:=eval(k, 1)+1 } } Property toString$ { value { Link parent k, lim to k, lim read ? where=0& if where<0 or where>lim then error "Index out of bound" where*=2 m=eval(k,where+1) if m==0 then value$=format$("({0})",eval(k, where)) else.if eval(k,0)==0 then u$="({1}i)" value$=format$("({0}i)",eval(k,where+ 1)) else if abs(m)==1 then u$="({0}{2}i)" else u$="({0}{2}{1}i)" value$=format$(u$,eval(k, where),abs(m), IF$(m<0->"-","+")) end if } } Function Export$() { =eval$(.k) } Module Import (This$) { m=len(This$)*2 if m>0 and m<=len(.k) then Return .k, 0:=This$ end if } Module SwapBuffers (&a as Complex){ if .len<> a.len then Error "Not compatible buffers" swap .k, a.k swap .lim, a.lim } Class: Module Complex { Error "Can't define objects" } } Class DoubleComplex as Complex { Private: len=16 Function newDoubleComplex(a as DoubleComplex, w) { buffer z as double*2 return z, 0:=eval$(.k, w*.len!, .len) let a.k=z, a.lim=0 // k is Private in a =group(a) } Function copyme(a as DoubleComplex) { buffer z as double*2*(a.lim+1) return z, 0:=eval$(.k) let a.k=z =group(a) } Public: Operator "+" { read a as Complex let this=.newFloatComplex(this, 0) return .k, 0:=eval(.k,0)+a.real, 1:=eval(.k, 1)+a.imaginary } Operator "-" { read a as Complex let this=.newFloatComplex(this, 0) return .k, 0:=eval(.k,0)-a.real, 1:=eval(.k, 1)-a.imaginary } Set () { read a as Complex read ? where=0& if where<0 or where>.lim then error "Index out of bound" else where*=2 if a is type FloatComplex then return .k, where:=a.real, where+1:=a.imaginary else.if a is type DoubleComplex then return .k, where:=eval$(a.k) else error "can't assign this group" end if } Module Redim (many as long) { if many<1 then error "Wrong Dimension" buffer clear .k as double*2*many: .lim<=many-1 } Module RedimPreserve (many as long) { if many<1 then error "Wrong Dimension" buffer .k as double*2*many: .lim<=many-1 } Function final copy { =.copyme(this) } value () { read ? where=0& if where<0 or where>.lim then error "Index out of bound" if where=0 and .lim=0 then =this else =.newDoubleComplex(this, where) end if } Class: Module DoubleComplex (r as double=0, i as double=0, many=1&) { if many<1 then error "Wrong Dimension" buffer clear .k as double*2*many: .lim<=many-1 return .k, 0:=r, 1:=i } } Class FloatComplex as Complex{ Private: len=8 Function newFloatComplex(a as FloatComplex, w) { buffer z as single*2 return z, 0:=eval$(.k, w*.len!, .len) let a.k=z, a.lim=0 =group(a) } Function copyme(a as FloatComplex) { buffer z as single*2*(a.lim+1) return z, 0:=eval$(.k) let a.k=z =group(a) } Public: Operator "+" { read a as Complex let this=.newFloatComplex(this, 0) return .k, 0:=eval(.k,0)+a.real, 1:=eval(.k, 1)+a.imaginary } Operator "-" { read a as Complex let this=.newFloatComplex(this, 0) return .k, 0:=eval(.k,0)-a.real, 1:=eval(.k, 1)-a.imaginary } Set () { read a as Complex read ? where=0& if where<0 or where>.lim then error "Index out of bound" else where*=2 if a is type DoubleComplex then return .k, where:=a.real, where+1:=a.imaginary else.if a is type FloatComplex then return .k, where:=eval$(a.k) else error "can't assign this group" end if } Module Redim (many as long) { if many<1 then error "Wrong Dimension" buffer clear .k as single*2*many: .lim<=many-1 } Module RedimPreserve (many as long) { if many<1 then error "Wrong Dimension" buffer .k as single*2*many: .lim<=many-1 } Function final copy { =.copyme(this) } value (){ read ? where=0& if where<0 or where>.lim then error "Index out of bound" if where=0 and .lim=0 then =this else =.newFloatComplex(this, where) end if } Class: Module FloatComplex (r as single=0, i as single=0, many=1&) { if many<1 then error "Wrong Dimension" buffer clear .k as single*2*many: .lim<=many-1 return .k, 0:=r, 1:=i } } def typename$(x)=type$(x) z1=FloatComplex(2,2) : print z1.toString$="(2+2i)" z2=DoubleComplex(-2,3) :print z2.toString$="(-2+3i)" print typename$(z2.real)="Double" z5=FloatComplex(10,-5) : print z5.toString$="(10-5i)" print typename$(z5.real)="Single" z5=FloatComplex(10) :print z5.toString$="(10)" z6=DoubleComplex() : print z6.toString$="(0)" z6=z5 :print z6.toString$="(10)" print z5 is type FloatComplex = true print z6 is type DoubleComplex = true z2.imaginary++ z2.imaginary++ print z2.toString$="(-2+5i)" z5=z2 print typename$(z5.real)="Single" print z5 is type FloatComplex = true z5.real++ print z5.toString$="(-1+5i)" zArray=FloatComplex(1,1,10) zArray(4)=FloatComplex(30,-5) zArray(5)=FloatComplex(3,-75) zArray(7)=zArray(4) for i=zArray.Lbound to zArray.Ubound print i, zArray.toString$(i) next z5=zArray(4) print z5.toString$="(30-5i)" print zArray(4).toString$ = zArray.toString$(4) print z5.toString$="(30-5i)" zk=z5+zArray+FloatComplex(5, 100) print zArray(4).toString$="(30-5i)" print zk.tostring$()="(36+96i)" zk=zArray // print zk.ubound, zk.ptr, zArray.ptr, zArray.Ubound zA=zArray.Copy() // copy 10 items zArray(5)=FloatComplex(3, 4) print zArray(5).toString$="(3+4i)" print za(5).toString$="(3-75i)" za(7)=zArray(5)+za(5) print za(7).toString$="(6-71i)" za(7)=za(7)-za(5) print za(7).toString$="(3+4i)" za(7)=za(7)-zArray(5) print za(7).toString$="(0)" z5.import z1.export$() print z5.tostring$="(2+2i)" zArray.import za.export$() print zArray.toString$(7)="(0)" print zArray.ptr<>za.ptr print zArray.Ubound=9, z5.Ubound=0 zArray.SwapBuffers &z5 // swap data only print zArray.Ubound=0, z5.Ubound=9, z5(5).toString$="(3-75i)"
-
Jan 31st, 2023, 11:49 PM
#12
Thread Starter
New Member
Re: Programmers wanted to test a numerical library
georgekar, here's an example of using the Big Goo Numerical Library to make complex calculations:
The 4th root of -2 is a complex number. To find it use the following code:
Dim Z As New BigCom
Z = Nrt(-2, 4)
Debug.Print Z
The result for Z will be
0.84089641525371454303112547623321489504003426235678 +0.84089641525371454303112547623321489504003426235676i
The default precision for the library is 50 digits (after the decimal point). To yield values in the range of a Double data type you can set the BigGooPrecision environment variable or the Precision property of the BigCom object. i.e., Z.Precision = 14 will yield values in the range of a Double data type (14 digits after the decimal point).
To find the inverse use the Pwr method:
Debug.Print Pwr(Z, 4)
The result will yield -2
When I get my website completed you will be able to download it from there. As for now I can send you a demonstration or just the help file for your perusal.
Last edited by ksmateer; Feb 1st, 2023 at 12:17 AM.
-
Jan 31st, 2023, 11:57 PM
#13
Re: Programmers wanted to beta test a numerical library
 Originally Posted by ksmateer
That's a good idea. The help file is an HTML file. Is there a place where I can upload it so that users can download it?
If not then I can always email it to you.
You can ZIP it and post it as an attachment here.
-
Feb 2nd, 2023, 03:30 AM
#14
Thread Starter
New Member
Re: Programmers wanted to test a numerical library
I uploaded my help file but when I click on the link to unzip and view it only the left pane containing the table of contents displays; there's no text on the right. Has this problem been reported before?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|