English
Source / code snippets

Ellipsenbogen-length via Romberg-Wegintegral

 

p.specht

Wenn´s therefore goes, The length one Bogenstückes the ellipsis between two through Zentriwinkel definierten Points To detect, there for want of plainer analytischer Formel (at circle z.B. L = r * alpha) only iterative Approaches. because numerische Integration explicit faster goes as The otherwise übliche MacLaurin-Reihenentwicklung with zusätzlicher Integralrekursion, bemühte I Prof. Werner Rombergs Integrationsalgorithmus.
Window Title "Ellipsenbogenlänge via Romberg-Wegintegral"
'{ Initialisierung
' (D) Demoware 2012-06 by P. woodpecker. without jedwede Gewähr!
Font 2:randomize:set("decimals",18)
Declare a!,b!,xu!,xo!,n!,g!,tmp!,Integral!,lambda2!,epsi!,epsi2!
var f!=pi()/180
'}

proc Fnk :parameters x!

    declare y!,it%,sq!
    sq!=sin(x!):sq!=sq!*sq!

    if (epsi2!*sq!)<=1

        ' ======= PROGRAMMTEIL A =============
        y! = a!*sqrt(1 - epsi2!*sq!)
        ' ====================================

    else

        y!=-1*10^-35

    endif

    return y!

endproc

'{ One/Ausgabeteil
Begin:
cls rnd(8^8):
print "\n Ellipsenbogenlänge: "
print "\n Grosse HALBachse a = "; :input a!
case a!=0 : goto "Begin"
print "\n small Halbachse b = "; :input b!
case b!=0 : goto "Begin"
case a!=b!:print " evident one circle as Test! "
epsi2!=1-(b!*b!)/(a!*a!)
epsi!=sqrt(epsi2!)
print "\n Numer. Exzentrizität Epsilon = "; epsi!
print "\n From Zentriwinkel alpha_1[° ] = ";:input xu!
print "\n   To Zentriwinkel alpha_2[° ] =";:input xo!
print "\n discontinue-accuracy [to put]: ";:input g!
case g!=0:g!=10
g!=1/10^g!
Integral! = Rhomberg(xu!*f!,xo!*f!,g!)
print "\n Result:\n"
print " The Bogenlänge between "
print " ";xu!;"And ";xo!; " [°strain]"
print " totals ";Integral!;"  or.  "; stature$("%e",Integral!)
print " with a Error <= ";stature$("%e",tmp!)

if (xu!=0) and (xo!=90)

    print "\n control for Winkel 0° - 90° with 1/4 the Ramanujan-UmfangsFormel: "
    lambda2!=(a!-b!)/(a!+b!):lambda2!=lambda2!*lambda2!
    print  " ";1/4*Pi()*(a!+b!)*(1+3*lambda2! / (10+sqrt(4-3*lambda2!) ) )
    print " with a rel. Error small ";
    case (epsi! >= 0) and (epsi! < 0.8820): print "10^-9"
    case (epsi! >= 0.8820) and (epsi! < 0.9242): print "10^-8"
    case (epsi! >= 0.9242) and (epsi! < 0.9577): print "10^-7"
    case (epsi! >= 0.9577) and (epsi! < 0,9812): print "10^-6"
    case (epsi! >= 0.9812) and (epsi! < 0.9944): print "10^-5"
    case (epsi! >= 0.9944) and (epsi! < 0.9995): print "10^-4"
    case (epsi! >= 0.9995) and (epsi! < 0.9999): print "< 0.000403"
    case (epsi! >= 0.99999) and (epsi! <=1): print "< -0.5%"

endif

WaitInput
Goto "Begin"
'}

proc Rhomberg : parameters xu!,xo!

    var anz&=10' GERADE ZAHL!
    Declare i&,j&,k&,n&[anz&+1],H![anz&+1],L![anz&,anz&],Q!
    n&[0]=2
    H![0]=(xo!-xu!)/n&[0]
    ' using Trapezregel:
    L![0,0]=H![0]/2*(Fnk(xu!)+Fnk(xo!)+2*Fnk(xu!+H![0]))

    WhileLoop Anz&:j&=&Loop

        H![j&]=H![0]/(2^j&)
        n&[j&]=n&[0]*(2^j&)
        Q!=0

        whileLoop 0,n&[j&-1]-1:i&=&Loop

            Q!=Q! + Fnk(xu!+(2*i&+1)*H![j&])

        endwhile

        L![0,j&]=L![0,j&-1]/2+H![j&]*Q!

    EndWhile

    WhileLoop Anz&:k&=&Loop

        whileloop 0,Anz&-1:j&=&Loop

            L![k&,j&]=1/(2^(2*k&)-1)*(2^(2*k&)*L![k&-1,j&+1]-L![k&-1,j&])

        endwhile

        tmp!=abs(L![k&,0]-L![k&-1,1])
        case tmp!<=g!:break

    Endwhile

    ' tmp! contains actually Fehlergrenze
    return L![k&,0]

endproc

 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/04/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

554 Views

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie