Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Fun with Riemann, problems with Freebasic DLLs

  1. #1

    Fun with Riemann, problems with Freebasic DLLs

    Hi all,

    Nothing serious, kind of toying with Riemann's Zeta function - TBGL data is placed in a List, so the animation works fine.
    However the calculation is slow (and complex).
    I could speed it up a lot when using the Gamma function if it accepts complex numbers.
    So on a website of a French university I found fbmath which is capable doing this.
    Now when compiling the FB source into a dll (fbc -dll .... ), the dll is created but TB can not read it (TB function are declared the way it should be etc ... ) TB gives no error upon declaration , but when calling the function ....
    FB creates Win32 DLL's or not ???? not ActiveX dlls ????
    ..; if someone else knows a DLL with Complex Gamma functions ... it may be lnGamma etc ... also fine ...

    In the animation it's all about where the "fingers" come to gether - the 1 M$ question is the proof that all non trivial roots are 0.5 + i(something).

    best Rob -- thanks in advance
    Attached Files Attached Files
    Last edited by RobbeK; 21-12-2013 at 15:10.

  2. #2
    Nothing serious ... the 1 M$ question ...
    Nothing serious, you say? Well, well...

    Looks very, very impressive though a bit slow indeed.

    Assuming 3eta is written in Russian ("З" is a Russian equivalent of "Z"), can I also have your sources for the offending FreeBasic library? I don't believe the DLL can't be properly compiled. The crowd would've had the FB devs decimated ages ago for such an outstanding failure.

    Thanks in advance,
    Last edited by mike lobanovsky; 21-12-2013 at 16:58. Reason: English grammar, hehe...
    Mike
    (3.6GHz i5 Core Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, x64 Windows 7 Ultimate Sp1)

  3. #3
    Hi Mike,

    Well, normally the Z is written in Greek, and as cyrillic is closer to Greek than Latin script ..... ;-)

    It's not a DLL yet - I attached the source of the modules,
    I probably do the things the wrong way in FB , the functions/subs are declared "export" and compiled with the "-dll" switch , the DLL is generated but trying 3 examples on the web (just copy/paste into FB : one for EXCELL , one for RapidQ and one I forgot for what - none of these works in TB ).

    The examples are rather confusing - one of them uses a function declaration at the start , the others not. (well, infact I don't understand it at all - one gives at the start
    Declare Function X Lib .... alias .... ( ) as .. and later (rather bizar you have to include the name of the DLL on forehand ?? )
    Function X (..) as .. EXPORT

    Anyway TB gives as error message ... X not found ....

    The intention is just to have something re-usable , with the source it will be no problem to write it in oxygen or so -- but if it's already done, imho it's a kind of waste of time ..

    The code I wrote is poor -- 3(x) grows very slow -- 3(0) -> infinity , but my method delivers (50 iterations iirc) only 50
    (for 3(-1) I only get 51*25 )
    Some what more difficult 3(1) -> infinity (the harmonic series) , but it grows even a lot slower (after 1000 iterations , only 1/1000 is added to the result) , maybe I reach 5 ? ;-)
    That 3(1) = inf. is not so difficult to prove ....
    but that 3(2)=piČ/6 is something else -- it was known as the Basel problem , Euler was to first to solve it -- many tried without success .

    The problem is that in the mean time dozens of hypothesi are proven only correct if the Riemann can be proven.
    There is a relation with prime numbers and the 3eta , found by Euler : as Riemann mentions here (first fomula)
    http://upload.wikimedia.org/wikipedi...r%C3%B6sse.pdf


    ;-) best Rob
    Attached Files Attached Files
    Last edited by RobbeK; 21-12-2013 at 21:59.

  4. #4
    hello RobbeK and mike lobanovsky
    I tried o compile the bmath ib as a dll but failed, however, it shouldn't be too hard to just extract the needed functions and convert them to thinbasic.
    <off topic>
    am I the only person that has problems with this forum?
    I mean missing keystrokes?
    I find myself having to constantly insert missing keystrokes, it's extremely annoying.
    </off topic>
    Last edited by jack; 22-12-2013 at 05:14.

  5. #5
    @Jack:

    1. Judging by the FB code, it isn't yet ready to be compiled as a DLL. Please see my requests to Rob below.
    2. Exactly. Yet not to thinBasic but rather to O2 as we need all the speed of machine code there is in its underlying assembly.
    3. No, I've got no problems with this forum except for its unusual and somewhat dizzying complexity. Perhaps you should address your question and symptoms explicitly to some mod or admin that's responsible for, or has access to, the forum's server in order to assist you.

    @Rob:

    Thanks for the FB code. But I'll have to distract you from your creative work some more:

    1. What are the exact function or functions that you need to be exportable from this library in order to resolve this thread's immediate tasks?

    2. What is the exact list of all fuctions in the source code, barring helper modules and functions, that you think should be exportable in order for this library to become multi-purpose and helpful from a scientific/mathematical point of view?

    And a final question to both of you:

    If you have a compiled FB binary for this library, either working or not, can you upload it here for me to dowload and investigate what's really wrong with its export table? We'll delete it from the forum as soon as I download it for my purposes. Hopefully we'll be able to upload another working version of it as soon as it's ready.


    Thanks,
    Mike
    (3.6GHz i5 Core Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, x64 Windows 7 Ultimate Sp1)

  6. #6
    Most of the complex functions could be run directly on the FPU. Oxygen has special macros for implementing FPU math directly without the overhead of calling functions. If your complex.bas algorithms are good, Rob then I would like to have a go at porting them into this high-performance format. Would that be useful?

  7. #7
    Thanks Charles, Jack & Mike ...

    Well , I only need a few things from the code, and I want to expand it with some new functions (Beta, Stirling approx. etc ... )

    @Mike : attached the source , the dll , the tbasic file and a copy from the FB's help file (as said probably I'm doing just something stupid).
    @Charles : yes , great -- I can make some extensions if you wish ..

    Also attached a more recent and complete source .

    best Rob

    Oops, yes , Charles .. when I use a by O2 generated DLL in TB, everything's fine - except TB exits with an error. (I mean on exit of the prog).
    and .. floating point oddities -- trying some other compilers to generate DDL's it seems the floating point formats sometimes do not match - O2 worked fine in TB and Lisp , the Aurora compilers outputs not compatible stuff (tried all the possible floating point possib. (Aurora is a kind of C compiler - I can give a copy if one likes, I have the freeware version ).
    Attached Files Attached Files
    Last edited by RobbeK; 23-12-2013 at 13:12.

  8. #8
    Hello Rob,

    Thanks for the zips. You can remove testdll.rar now as I've got my copy.

    See you,

    [EDIT] Rob,

    Your FB test DLL and also the one recompiled on my PC work perfect. You problem is incorrect thinBasic declaration of the function export. thinBasic "Alias" is case-sensitive (FBSL's are not) and must name the function exactly as it appears in the DLL's export table.

    Please use any PE executable header viewer, e.g. Dependency Walker to examine FB DLL exports. You'll see that FB capitalizes and also mangles exported function names (FBSL de-mangles them automatically).

    You should change your declaration as follows:
     Declare Function add2 Lib "testdll.dll" Alias "ADD2@8" (ByVal x As Long , ByVal y As Long ) As Long
     MsgBox (,Str$(add2(8,9)))
    
    and you'll get your test rig up and running flawlessly.

    The same principles apply to building and declaring the French university code.
    Last edited by mike lobanovsky; 23-12-2013 at 14:03. Reason: Results ready
    Mike
    (3.6GHz i5 Core Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, x64 Windows 7 Ultimate Sp1)

  9. #9
    That's simply fantastic ;-)

    Completely unaware about mangling - demangling I think there's a possibilty I gave it up after a few more tries.

    "Dependency Walker" ! - wow, great.

    OK - the door is open now , time for some coding.


    thanks again for your help and sharing your expert help - merry Xmas (but iirc in your country the 7th of Januar ?)
    Rob
    Last edited by RobbeK; 24-12-2013 at 00:28.

  10. #10
    It was my pleasure to help, Rob, and Merry Xmas to you too! Christmas is celebrated in my country twice; first by catholics on December 25 and then on January 7 by the orthodox Julian calendar. My date is December 25 but cheers to you on the both occasions!

    /
    Mike
    (3.6GHz i5 Core Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, x64 Windows 7 Ultimate Sp1)

Page 1 of 2 12 LastLast

Similar Threads

  1. Dimensions, from Riemann to M theory
    By Charles Pegge in forum Science
    Replies: 3
    Last Post: 27-05-2011, 15:23
  2. Loading Dlls on demand or ( absolute )
    By zak in forum thinBasic General
    Replies: 2
    Last Post: 25-10-2009, 16:28
  3. Debugging of DLLs
    By ibd in forum thinBasic General
    Replies: 7
    Last Post: 20-05-2008, 21:20
  4. Issues with transfering string from Delphi DLLs
    By Michael Hartlef in forum Turbo Delphi language SDK development
    Replies: 2
    Last Post: 15-12-2006, 18:14

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •