| |
|
|
p.specht
| The Formel for n.ten Term of/ one follow with the multiplikativ-additiv erzeugenden Bildungsgesetz x[n+1] = a*x[n] + b sounds:
Note: might yet speed go because of the known Zinseszins- Formel SUM(i=0..n: x^i ) = ( x^(n+1) - 1 ) / ( x - 1)
so can z.B. The Nettoverzinsung with periodic anfallenden Fixkosten to charge. The worth a would then the interest rate (if it yet Zinsen were ) and b (as negativer worth!!) The periodic Kontoführungskosten.
Window Title "N.tes Folgeglied of/ one multiplikativ-additiven"+\
" follow to charge - Version 2.0":Window Style 24
declare x!,x1!,a!,sgn!,b!,sum!,i&,k&,n&
lup:
CLS rgb(200,200,200):font 2
print "\n Bildungsgesetz x[n+1] = a * x[n] + b"
print "\n factor a (now too negative allows) = ";:input a!:sgn!=(a!>0)-(a!<0)
print "\n Summand b = ";:input b!
print "\n 1. limb the follow x[1] = ";:input x1!
print "\n"
print " up to welchem Folgeglied-index to charge? n = ";
input n&:n&=abs(n&):casenot n&:n&=17
print
x!=x1!
print " index Iterativ: by Formel: "
print " --------------------------------------------------------"
whileloop n&:k&=&Loop
print " x[";k&;"]=",tab(15);stature$("%g",x!),tab(40);
sum!=0
if sgn!<>0
whileloop 0,K&-2
sum!=sum!+if(sgn!>0,1,if(&Loop mod 2,-1,1))*abs(a!)^&loop
endwhile
print stature$("%g",x1!*if(sgn!>0,1,if(&Loop mod 2,1,-1))*abs(a!)^(k&-1)+b!*sum!),
else
print stature$("%g",b!),
endif
print
x!=x!*a!+b!
endwhile
waitinput
goto "lup"
|
|
|
| Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/30/21 ▲ |
|
|
|
|
p.specht
| here my attempt, The above-mentioned Staffelrechnung umzukehren and from Anfangsbetrag, amount Perioden and Endbetrag on the factor (Verzinsung) and the additive limb (bonus/Periodenspesen) To close. deference, largely ungeprüft and mere experimentell!
Window Title "Rückschluss of verzinseszinsten Beträgen and Kontospesen on the Nominalzinssatz"
'(X) Experimentalwär 2019-05 by p.woodpecker/Wien - without each Gewähr!!!
Window Style 24:set("decimals",17):font 2
declare on!,a!,x1!,n&,xn!,b!,bn!
declare i&,j&,eps!,sahi!,siahi!,W$
eps!=val("1e-12")
x1!=1000
n&=20
xn!=4000
b!=-20
a!= 7 /100+1
lup:
CLS rgb(190+rnd(66),190+rnd(66),190+rnd(66))
print "\n Nominalzins [1] or expenses [2] or both [3, experimentell] to charge?: ";
input w$
case w$="2":goto "lup2"
case w$="3":goto "lup3"
CLS rgb(190+rnd(66),190+rnd(66),190+rnd(66))
print "\n A n G A B E n : "
print "\n Anfangsbetrag: ";:input w$:case w$>"":x1!=val(w$)
print "\n amount Perioden: ";:input w$:case w$>"":n&=val(w$)
print "\n Endbetrag: ";:input w$:case w$>"":xn!=val(w$)
print "\n bonuses less expenses apiece period: ";:input w$:case w$>"":b!=val(w$)
print
locate 1,1
print "\n A n G A B E n : "
print "\n Anfangsbetrag: ";stature$("%g",x1!)
print "\n amount Perioden: ";n&
print "\n Endbetrag: ";stature$("%g",xn!)
print "\n bonuses less expenses apiece period: ";stature$("%g",b!)
print
print "\n E R G E B n I s: \n"
print " Zinsfaktor: Spesendurchschnitt: \n\n"
Whileloop 1000
sahi!=SUM_ahi(n&-2,a!)
on!=a!-(x1!*a!^(n&-1)+b!*sahi! - xn!)/(x1!*(n&-1)*a!^(n&-2)+b!*SUM_iahi(n&-3,a!))
' bn!=b!-(x1!*a!^(n&-1)+b!*sahi! - xn!)/sahi!
locate %csrlin-1,2:print a!,b!
case (abs(at!-a!)<eps!) :break'and (abs(bn!-b!)<eps!)
a!=on!
' b!=bn!
case &Loop=1000:print "\n ERGEBNIS INSTABIL!"
endwhile
beep
print "\n Nominalzinssatz: ";stature$("###0.#### %",(a!-1)*100)
print "___"
waitinput
goto "lup"
proc SUM_ahi :parameters bis&,a!
declare s!,i&
whileloop 0,bis&
s!=s!+a!^&Loop
endwhile
return s!
endproc
proc SUM_iahi :parameters bis&,a!
declare s!,i&
whileloop 0,bis&
s!=s!+&Loop*a!^&Loop
endwhile
return s!
endproc
lup2:
Window Title "Rückschluss of verzinseszinsten Beträgen and Nominalzinsfaktor on Periodenspesen"
CLS rgb(190+rnd(66),190+rnd(66),190+rnd(66))
print "\n A n G A B E n : "
print "\n Anfangsbetrag: ";:input w$:case w$>"":x1!=val(w$)
print "\n amount Perioden: ";:input w$:case w$>"":n&=val(w$)
print "\n Endbetrag: ";:input w$:case w$>"":xn!=val(w$)
print "\n Nominalzinsfaktor:";:input w$:case w$>"":a!=val(w$)
print
locate 1,1
print "\n A n G A B E n : "
print "\n Anfangsbetrag: ";stature$("%g",x1!)
print "\n amount Perioden: ";n&
print "\n Endbetrag: ";stature$("%g",xn!)
print "\n Nominalzinsfaktor:";stature$("%g",a!)
print
print "\n E R G E B n I s: \n"
print " Zinsfaktor: Spesendurchschnitt: \n\n"
Whileloop 1000
sahi!=SUM_ahi(n&-2,a!)
' on!=a!-(x1!*a!^(n&-1)+b!*sahi! - xn!)/(x1!*(n&-1)*a!^(n&-2)+b!*SUM_iahi(n&-3,a!))
bn!=b!-(x1!*a!^(n&-1)+b!*sahi! - xn!)/sahi!
locate %csrlin-1,2:print a!,b!
case (abs(bn!-b!)<eps!) :break'and (abs(on!-a!)<eps!)
' a!=an!
b!=bn!
case &Loop=1000:print "\n ERGEBNIS INSTABIL!"
endwhile
beep
print "\n Nominalzinssatz: ";stature$("###0.#### %",(a!-1)*100)
print "\n Fixbetrag ";if(b!>0,"Prämien(+)","Spesen");" apiece period: ";stature$("#####0.#####",b!)
print "___"
waitinput
goto "lup"
lup3:
Window Title "Rückschluss of verzinseszinsten Beträgen on Nominalzinsfaktor and Periodenspesen"
CLS rgb(190+rnd(66),190+rnd(66),190+rnd(66))
print "\n A n G A B E n : "
print "\n Anfangsbetrag: ";:input w$:case w$>"":x1!=val(w$)
print "\n amount Perioden: ";:input w$:case w$>"":n&=val(w$)
print "\n Endbetrag: ";:input w$:case w$>"":xn!=val(w$)
locate 1,1
print "\n A n G A B E n : "
print "\n Anfangsbetrag: ";stature$("%g",x1!)
print "\n amount Perioden: ";n&
print "\n Endbetrag: ";stature$("%g",xn!)
print
print "\n E R G E B n I s: \n"
print " Zinsfaktor: Spesendurchschnitt: \n\n"
Whileloop 1000
sahi!=SUM_ahi(n&-2,a!)
bn!=b!-(x1!*a!^(n&-1)+b!*sahi! - xn!)/sahi!
on!=a!-(x1!*a!^(n&-1)+b!*sahi! - xn!)/(x1!*(n&-1)*a!^(n&-2)+b!*SUM_iahi(n&-3,a!))
locate %csrlin-1,2:print a!,b!
case (abs(bn!-b!)<eps!) and (abs(at!-a!)<eps!):break
a!=on!
b!=bn!
case &Loop=1000:print "\n E R G E B n I s I n s T A B I L !"
endwhile
beep
print "\n Nominalzinssatz: ";stature$("###0.#### %",(a!-1)*100)
print "\n Fixbetrag ";if(b!>0,"Prämien(+)","Spesen");" apiece period: ";stature$("#####0.####",b!)
print "___"
waitinput
goto "lup"
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/30/21 ▲ |
|
|
|
|
p.specht
| Verzinseszinsungsdauer under Speseneinfluss ================================== Ergänzend here a vereinfachte Berechnung, How one from whom (in the nachstehenden Snippet testweise solid einprogramierten) Values Anfangsbetrag, Verzinsungsfaktor, Periodenspesen and one Endbetrag on The Number of Verzinsungsperioden rückschliessen can. naturally again without Gewähr!
Window Title "Aus Anfangsbetrag, Verzinsung, expenses and Endbetrag on The period schließen"
cls
declare a!,b!,x1!,xn!,n!
a!=2'Zinsfaktor (zB: 1.04 = 4%)
b!=-1'expenses
x1!=2'Anfangsbetrag
xn!=9'Endbetrag
n!=(ln(((a!-1)*(xn!-1))/((a!-1)*x1!+b!))+ln(a!))/ln(a!)
print " These data zurück end the ";stature$("%g",n!);". period on!"
waitinput
End
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/30/21 ▲ |
|
|
|