| |
|
|
 p.specht
 | The ArcusSinus, it comes u.a. in Ellipsenformeln to, supply between whom Argumentwerten -1 and 1 The Umkehrung the Sinusfunktion, of course only on the first Wellenzug related. we're it say, how much % of/ one filled revolutions run is, part it us moreover The Bogenlänge on the Einheitskreis in Radiantmetern [wheel] with (lat. arcus is Yes 'Bogen').
an invention the Herrn Taylor allows it, so quite each multiple ableitbare function in a "unendliche" row to develop, The computer relatively rasch to charge can. not always access one thereby The geforderte accuracy, because: somewhere must The row in the reality Yes Cancel. too there different Reihen, The different well suitable are. a Test the standard-Reihenentwicklung around the point 0 around sees one hereinafter, beschleunigbar would the whole too still significantly...
Window Title "Test of/ one Eigenbau-ArcusSinus(x)-Funktion"
Font 2:randomize:set("decimals",17)
Cls rnd(8^8)
print " arcsin(x) with x=[-1.0..+1.0]: supply The Bogenlänge [wheel] the 1.Sinus-Wellenzugs"
print " math.inc-Nachbau: Eigenbau-TaylorArcSin(x) Abs.Error: "
WhileLoop -1000,1000
print &Loop,asin(&Loop/1000),
print tlrasin(&Loop/1000),stature$("%e",tlrasin(&Loop/1000)-asin(&Loop/1000))
if %csrlin>24:waitInput 10000:cls rnd(8^8):endif
Wend
WaitInput
End
proc ASIN : parameters x!' = Nachbau the suitable math.inc-function
var res!=0:var it$=""
var xx!=x!*x!
var wur!=1-xx!
if wur!>=0
wur!=sqrt(wur!)
if wur!<>0
res!=arctan(x!/wur!)
else
res!=val("10^-30")
it$="Div0 in asin()"
endif
else
res!=val("-1*10^-30")
it$="Nonreal root in asin()"
endif
print it$,
return res!
endproc
proc ACOS :parameters x!
return pi()/2-ASIN(x!)
endproc
Proc TlrASin : parameters x!' Eigenbau-arcussinus(x) through Taylorreihe
' The true ArcusSinus is definiert for Argumente -1 ,,, +1.
' Testergebnisse for Nachbau;
' On 5 to put exakt only +/- 0.833 around the Nulldurchgang
' On 3 to put exakt only within +/- 0.933
var tmp!=0:var x2!=x!*x!:var x3!=x2!*x!:var x5!=x3!*x2!:var x7!=x5!*x2!
var x9!=x7!*x2!:var x11!=x9!*x2!:var x13!=x11!*x2!:var x15!=x13!*x2!
var x17!=x15!*x2!:var x19!=x17!*x2!:var x21!=x19!*x2!:var x23!=x21!*x2!
var x25!=x23!*x2!:var x27!=x25!*x2!:var x29!=x27!*x2!:var x31!=x29!*x2!
var x33!=x31!*x2!:var x35!=x33!*x2!:var x37!=x35!*x2!:var x39!=x37!*x2!
tmp!=tmp!+x!
tmp!=tmp!+x3!/3 * 1/2
tmp!=tmp!+x5!/5 * 1/2*3/4
tmp!=tmp!+x7!/7 * 1/2*3/4*5/6
tmp!=tmp!+x9!/9 * 1/2*3/4*5/6*7/8
tmp!=tmp!+x11!/11 * 1/2*3/4*5/6*7/8*9/10
tmp!=tmp!+x13!/13 * 1/2*3/4*5/6*7/8*9/10*11/12
tmp!=tmp!+x15!/15 * 1/2*3/4*5/6*7/8*9/10*11/12*13/14
tmp!=tmp!+x17!/17 * 1/2*3/4*5/6*7/8*9/10*11/12*13/14*15/16
tmp!=tmp!+x19!/19 * 1/2*3/4*5/6*7/8*9/10*11/12*13/14*15/16*17/18
tmp!=tmp!+x21!/21 * 1/2*3/4*5/6*7/8*9/10*11/12*13/14*15/16*17/18*19/20
tmp!=tmp!+x23!/23 * 1/2*3/4*5/6*7/8*9/10*11/12*13/14*15/16*17/18*19/20*21/22
tmp!=tmp!+x25!/25 * 1/2*3/4*5/6*7/8*9/10*11/12*13/14*15/16*17/18*19/20*21/22*23/24
tmp!=tmp!+x27!/27 * 1/2*3/4*5/6*7/8*9/10*11/12*13/14*15/16*17/18*19/20*21/22*23/24*25/26
tmp!=tmp!+x29!/29 * 1/2*3/4*5/6*7/8*9/10*11/12*13/14*15/16*17/18*19/20*21/22*23/24*25/26*27/28
tmp!=tmp!+x31!/31 * 1/2*3/4*5/6*7/8*9/10*11/12*13/14*15/16*17/18*19/20*21/22*23/24*25/26*27/28*29/30
tmp!=tmp!+x33!/33 * 1/2*3/4*5/6*7/8*9/10*11/12*13/14*15/16*17/18*19/20*21/22*23/24*25/26*27/28*29/30*31/32
tmp!=tmp!+x35!/35 * 1/2*3/4*5/6*7/8*9/10*11/12*13/14*15/16*17/18*19/20*21/22*23/24*25/26*27/28*29/30*31/32*33/34
tmp!=tmp!+x37!/37 * 1/2*3/4*5/6*7/8*9/10*11/12*13/14*15/16*17/18*19/20*21/22*23/24*25/26*27/28*29/30*31/32*33/34*35/36
tmp!=tmp!+x39!/39 * 1/2*3/4*5/6*7/8*9/10*11/12*13/14*15/16*17/18*19/20*21/22*23/24*25/26*27/28*29/30*31/32*33/34*35/36*37/38
return tmp!
Endproc
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/07/21 ▲ |
|
|
|
|
 p.specht
 | It's all right but too differently:
ArcSin iterativ detect ================== Dass one itself over a Iteration of/ one Quadratwurzel-Formel the Umkehrfunktion the SINUS almost discretionary annähern can, becomes in the subesquent Program demonstrating. there's Yes z.B. situations, where to the one Microprozessor procure would like.
Window Title "ArcSin by Iteration"
'From Pascal (by J.P.Moreau) to XProfan-11 by P.woodpecker/Vienna
'********************************************************
'* Program to demonstrate arcsine Iteration *
'* ---------------------------------------------------- *
'* Reference: BASIC Scientific Subroutines, Vol. II *
'* by F.R. Ruckdeschel, BYTE/McGRAWW-HILL, 1981 [1]. *
'* ---------------------------------------------------- *
'* SAMPLE RUN: *
'* X ARCSIN(X) STEPS ERROR *
'* ----------------------------------------------- *
'* 0.00 0.0000000 0 0.0000000000 *
'* 0.05 0.0500209 7 -0.0000000013 *
'* 0.10 0.1001674 8 -0.0000000025 *
'* 0.15 0.1505683 9 -0.0000000021 *
'* 0.20 0.2013579 10 -0.0000000013 *
'* 0.25 0.2526803 10 -0.0000000025 *
'* 0.30 0.3046927 11 -0.0000000011 *
'* 0.35 0.3575711 11 -0.0000000017 *
'* 0.40 0.4115168 11 -0.0000000025 *
'* 0.45 0.4667653 12 -0.0000000009 *
'* 0.50 0.5235988 12 -0.0000000012 *
'* 0.55 0.5823642 12 -0.0000000016 *
'* 0.60 0.6435011 12 -0.0000000021 *
'* 0.65 0.7075844 13 -0.0000000007 *
'* 0.70 0.7753975 13 -0.0000000008 *
'* 0.75 0.8480621 13 -0.0000000010 *
'* 0.80 0.9272952 13 -0.0000000012 *
'* 0.85 1.0159853 13 -0.0000000014 *
'* 0.90 1.1197695 14 -0.0000000004 *
'* 0.95 1.2532359 14 -0.0000000004 *
'* 1.00 1.5707963 0 0.0000000000 *
'********************************************************
Window Style 24:Cls:font 2:set("decimals",8)
Declare e!,x!,i&,m&,y!,pi!,u0!,u1!,u2!
print "\n X ArcSinIter(X) STEPS ERROR"
print "-------------------------------------------------------------------"
e!=val("1e-15")
x!=0
whileloop 1,21:i&=&Loop
y!=ArcSinIter(x!)
print " ";stature$("#0.00",x!),tab(9);stature$("%g",y!),\
tab(29);m&,tab(34);stature$("%g",sin(y!)-x!)
x!=x!+0.05
Endwhile
print
beep:Waitinput
End
Proc ArcSinIter :parameters x!
'************************************************
'* Arcsin(x) recursion subroutine *
'* Input is x (-1<x<1), output is y=arcsin(x), *
'* convergence criteria is e. *
'* -------------------------------------------- *
'* Reference: Computational Analysis by Henrici *
'************************************************
m&=0
pi!=Pi()
case e!<0:return y!'Guard against failure
case x!<>0:y!=Check_range(x!)
return y!
ENDPROC
Proc Check_range :parameters x!
case abs(x!)>=1:goto "G1300"
u0!=x!*sqrt(1-x!*x!)
u1!=x!
Repeat
u2!=u1!*sqrt(2*u1!/(u1!+u0!))
y!=u2!
m&=m&+1
case abs(u2!-u1!)<e!:BREAK
u0!=u1!:u1!=u2!
Until 0
G1300:
case abs(x!-1)<val("1e-10"):y!=pi!/2
return y!
Endproc
'End of file ArcsinIter.prf
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/28/21 ▲ |
|
|
|