small bugfixes, add precision setting
This commit is contained in:
parent
61bf0003c2
commit
ca563886ec
2 changed files with 41 additions and 3 deletions
|
@ -11,14 +11,16 @@ func main { status | with args ;
|
||||||
clear if {
|
clear if {
|
||||||
"." [ 27 _int ] _str ".[H.[2J.[3J" :replace print
|
"." [ 27 _int ] _str ".[H.[2J.[3J" :replace print
|
||||||
}
|
}
|
||||||
"[-] mkpolynomial v0.2 by TudbuT" println
|
"[-] mkpolynomial v0.3 by TudbuT" println
|
||||||
"[-] commands: degree, match, delete <n>, list, ., clear, exit" println
|
"[-] commands: degree, match, delete <n>, precision <digits>, list, ., clear, exit" println
|
||||||
"[-] args: -d, -c, -h" println
|
"[-] args: -d, -c, -h" println
|
||||||
help if {
|
help if {
|
||||||
0 exit
|
0 exit
|
||||||
}
|
}
|
||||||
"[-] " println
|
"[-] " println
|
||||||
|
|
||||||
|
def precision 12 =precision
|
||||||
|
|
||||||
def f
|
def f
|
||||||
def vardecl
|
def vardecl
|
||||||
def degree "0" =degree
|
def degree "0" =degree
|
||||||
|
@ -57,7 +59,7 @@ func main { status | with args ;
|
||||||
}
|
}
|
||||||
"delete " expr:starts-with if {
|
"delete " expr:starts-with if {
|
||||||
def idx ("delete " _array:len) (expr _array:len) (expr _array:sub) _str _mega =idx
|
def idx ("delete " _array:len) (expr _array:len) (expr _array:sub) _str _mega =idx
|
||||||
idx 0 gt idx exprs:len lt and if {
|
idx 0 gt idx exprs:len ++ lt and if {
|
||||||
0 idx -- exprs:sub
|
0 idx -- exprs:sub
|
||||||
idx exprs:len exprs:sub
|
idx exprs:len exprs:sub
|
||||||
aadd =exprs
|
aadd =exprs
|
||||||
|
@ -79,6 +81,12 @@ func main { status | with args ;
|
||||||
vardecl println
|
vardecl println
|
||||||
2 stop
|
2 stop
|
||||||
}
|
}
|
||||||
|
"precision " expr:starts-with if {
|
||||||
|
("precision " _array:len) (expr _array:len) (expr _array:sub) _str _mega =precision
|
||||||
|
"==> epsilon = 1e-" print
|
||||||
|
precision println
|
||||||
|
2 stop
|
||||||
|
}
|
||||||
expr "list" eq expr "." eq or if {
|
expr "list" eq expr "." eq or if {
|
||||||
clear if {
|
clear if {
|
||||||
"." [ 27 _int ] _str ".[H.[2J.[3J" :replace print
|
"." [ 27 _int ] _str ".[H.[2J.[3J" :replace print
|
||||||
|
@ -94,6 +102,8 @@ func main { status | with args ;
|
||||||
def giac-out
|
def giac-out
|
||||||
[
|
[
|
||||||
"giac"
|
"giac"
|
||||||
|
"epsilon(1e-" precision _str concat ")" concat
|
||||||
|
"Digits:=" precision _str concat
|
||||||
"f(x):=" f concat
|
"f(x):=" f concat
|
||||||
vardecl ":=" concat
|
vardecl ":=" concat
|
||||||
"linsolve(" concat
|
"linsolve(" concat
|
||||||
|
|
28
polysine.txt
Normal file
28
polysine.txt
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
f(0) = 0
|
||||||
|
f(0.5pi) = 1
|
||||||
|
f(pi) = 0
|
||||||
|
f(1.5pi) = -1
|
||||||
|
f(2pi) = 0
|
||||||
|
f'(0.5pi) = 0
|
||||||
|
f'(1.5pi) = 0
|
||||||
|
f'(0) = sin'(0)
|
||||||
|
f'(pi) = sin'(pi)
|
||||||
|
f'(2pi) = sin'(2pi)
|
||||||
|
f''(0) = sin''(0)
|
||||||
|
f''(0.5pi) = sin''(0.5pi)
|
||||||
|
f''(pi) = sin''(pi)
|
||||||
|
f''(1.5pi) = sin''(1.5pi)
|
||||||
|
f''(2pi) = sin''(2pi)
|
||||||
|
f'''(0) = sin'''(0)
|
||||||
|
f'''(2/3pi) = sin'''(2/3pi)
|
||||||
|
f'''(4/3pi) = sin'''(4/3pi)
|
||||||
|
f'''(2pi) = sin'''(2pi)
|
||||||
|
f(0.5) = sin(0.5)
|
||||||
|
f(2pi - 0.5) = sin(2pi - 0.5)
|
||||||
|
f'(0.5) = sin'(0.5)
|
||||||
|
f'(2pi - 0.5) = sin'(2pi - 0.5)
|
||||||
|
f''(2pi - 0.5) = sin''(2pi - 0.5)
|
||||||
|
f(-pi) = 0
|
||||||
|
f(3pi) = 0
|
||||||
|
f(4pi) = 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue