tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
|
|
@ -0,0 +1,28 @@
|
|||
Procedure.d f(x.d)
|
||||
ProcedureReturn x*x*x-3*x*x+2*x
|
||||
EndProcedure
|
||||
|
||||
Procedure main()
|
||||
OpenConsole()
|
||||
Define.d StepSize= 0.001
|
||||
Define.d Start=-1, stop=3
|
||||
Define.d value=f(start), x=start
|
||||
Define.i oldsign=Sign(value)
|
||||
|
||||
If value=0
|
||||
PrintN("Root found at "+StrF(start))
|
||||
EndIf
|
||||
|
||||
While x<=stop
|
||||
value=f(x)
|
||||
If Sign(value) <> oldsign
|
||||
PrintN("Root found near "+StrF(x))
|
||||
ElseIf value = 0
|
||||
PrintN("Root found at "+StrF(x))
|
||||
EndIf
|
||||
oldsign=Sign(value)
|
||||
x+StepSize
|
||||
Wend
|
||||
EndProcedure
|
||||
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue