主題: dc計算機
顯示結果從 1 到 7 共計 7 條
-
07-13-2008 #1
dc: Desk Calculator
http://chw2video.com/mobile01/touch/dc.rar
安裝方法:解開 dc.rar 後將 dc 放到 iPhone/touch,login後:
chmod a+x dc
mv dc /usr/local/bin
這是我的第1個iPhone(touch) native application,用cygwin製成的。
dc是個計算機,用起來就和CASIO DOT MATRIX LCD Calculator一樣方便。
10年前我找不到PC上好用的計算機,於是寫了dc, dcw,10年後還是沒發現更好用的計算機,
於是把 dc port 至 touch/iPhone。
dc 比 iPhone/touch 內建的計算機,或者賣錢的 CalcPaper 好用多了,可看到自己
打了什麼,如果打錯了可以方便改正,還有其它許多便利的計算功能,像自訂函數…等。
line-editor(readline)除了常用的上、下、左、右,另外較少人知道的是:
Ctrl-A: 跳至行首 (remoteterminal 手勢往右下即可 Ctrl)
Ctrl-E: 跳至行未
建議先試試 dcw.exe ,這是個在 MS-Win 上的程式,有繪圖(函數)功能,
且可把看到的結果送至印表機,有高品質的輸出,或者copy至剪貼簿,
再做貼至 Word or WordPad...裏,由於是 WMF 格式,因此可任意放大縮小,
而不影響圖形品質。
此為 dc_cmd 應用的一個範例,另一個範例是 dc ,這是個純文字的計算機,
可在 DOS, UNIX (FreeBSD, SunOS, Linux...) 上跑。
iPhone(touch)上的dc,建議搭配 mobileterminal一起使用:
http://code.google.com/p/mobileterminal/
mobileterminal可自訂「手勢」讓操作更便利,我將「左下」定義成「+」。
如圖所示,(手勢)往上/下可叫出前幾次輸入的字串,(手勢)往左或右可編輯輸入字串,
[return]執行計算,類似doskey或readline等命令歷史編輯功能。
source code在這裡:
http://chw2video.com/mobile01/touch/dc.tbz
製作iPhone(touch) native app 的 cygwin 在這裡:
http://www.iphonetw.net/books/unoffi...ygwintoolchain
還有一個較小的範例是 integrate.c ,在 dc.h 裏也有個很小的範例。
簡單的說 dc_cmd 是一個 expression compiler,input 為文字,output 為
double (or Complex number)。
當下次在使用電腦時,若還在找 Casio 計算機的話,試試 dc 吧
其它安裝說明:
Just type:
make
And then do some necessary modifacation in rc.dc, then:
cp rc.dc ~/.dcrc
Test:
./dc
2k
=> 2000
NAME
dcw - Desk Calculator for MS-Windows
DESCRIPTION
dcw is a real-number calculator for engineer with:
+ Floating, scientific, engineer, hex, bin format
+ User-define variable, delayed-variable, 1-var function, 2-var function
+ Saving or Restoring user-defined variables & functions
+ Intergration & Summation
+ 2D plot & print
+ Root locating
+ Command history
+ Parenthesis matching & omitting
EXAMPLES
Calculator:
`2pi` => `6.28...` // `2pi` equal to `2*pi`
`a=12` => `12` // define a variable `a`
`2(3+a` => `30` // `2(3+a` equal to `2*(3+a)`
`b=2a` => `24` // define a var `b`
`c:=2a` // define a delayed-var `c`
`a=3` => `3` // modify a's value
`b` => `24` // `b` doesn't update according to `a`
`c` => `6` // `c` update according to `a`
`sind[x]=sin[x pi/180]` // define a 1-var function `sind`
`sind[30]` => `0.5`
`int[c x+1,x,1,2]` => `10` // integration
`sum[k,k,1,10]` => `55` // summation
`k` => `1000`
`m` => `1e-3`
`M` => `1e6`
.... // defined in `rc.dc`(auto-load script)
`1/2'k` => `0.005` // `1/2'k` equal to `1/(2*k)`
`0x10` => `16` // hex
`0b1011` => `11` // bin
`ans&0b1100` => `1000b` // AND operation
`?` // Show brief help message
`>aa` // SAVE user var's & fun's in `aa`
`<aa` // LOAD user var's & fun's from `aa`
Plot:
1) Fourier series expansion
xi: -2 // {TAB}
xf: 2 // {TAB}
f[x]: sum[cos[a[k]x]/a[k],k,1,20]; a[k]=(-1)^(k+1)(2k-1) // {ENTER}
2) Bandpass filter frequency response in log-scale (1e1..1e6)
xi: 1 // {TAB}
xf: 6 // {TAB}
f[x]: s/(s^2+w0/Q s +w0^2); w0:=2pi f0; f0=10k; Q=20; s:=2pi 10^x //{ENTER}
// Or use Semi-log plot
AUTOLOAD & AUTOSAVE
Each time dcw start, `rc.dc` will be load automatically.
Each time dcw end, user vars & funs are save in `last.dc`.
OPERATOR PRECEDENCE
+ - & |
* / %
\ ^
unary: + - ~
() []
FUNCTIONS
ANSI C math.h
1-var:
sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, log10,
log, sqrt, ceil, floor
2-var:
pow, atan2, ldexp, fmod
OTHERS
fabs
u[x]: unit step (Heaviside)
char[x]: (char) cast
fact[n]: factorial
SPECIAL
int[EXPR, NAME, FROM, TO]: integration
sum[EXPR, NAME, FROM, TO]: summation
INTEGRATION
It is suggested to integrate in `dc (DOS or UNIX environment)` to get
more information about what's going on. To change precision of integration,
set the var `eps_int` to proper value, for example: `eps_int = 1e-10`.
FILES
DCW.EXE => main executable file
DC_CMD.DLL => Desk Calculator engine
RC.DC => autoload script (~/.dcrc in UNIX)
Makefile => UNIX Makefile
+++ dc_cmd.c => Desk Calculator engine source (ANSI C)
dc_cmd.h => Private header file of dc_cmd.c
dc.h => Public header for dc_cmd.c
(calling interface)
Demo how to use dc_cmd (Desk Calculator Engine):
integrate.c => Integration
+ dc.c => Desk Calculator
libmy.c => Common routines
getline.c => emacs-like line-edit routine
DC_CMD
dc_cmd compile input char-string expression to postfix format with
optimization performed, for example:
"1+2x/3-4*5(6+7)" => -259 0.6666667 x * +
Next time, when the function is envoled, only simple postfix evaluation needed!
So dc_cmd has good performance in speed (see wave.c & aplot.c).
AUTHOR
Wu Ching-hong (chw)
Regards,
chw此篇文章於 07-14-2008 01:05 被 sm91kimo 編輯。
-
07-15-2008 #2
dc 配 iAcces 更好用(不需要自訂+手勢了,四則運算都很方便輸入):
http://www.iphone.org.hk/wiki/index.php/IAcces
iAcces的手寫真的很棒,吉米說比2.0內建的還好:
https://iphone4.tw/guide/content_vie...&page=1&cate=3
https://iphone4.tw/guide/content_vie...&page=1&cate=3
裝iAcces前得先移掉HWPen,移掉HWPen會讓SpringBoard跑不起來變白蘋果,
解法:
https://iphone4.tw/forums/showthread.php?t=6877
我用 t-pot 解的,com.apple.SpringBoard.plist 這裡也有:
http://chw2video.com/mobile01/touch/...pringBoard.rar
iAcces現在的版本還沒有嘸蝦米,所以我還留著NativeCN。
Regards,
chw
-
07-16-2008 #3
http://chw2video.com/mobile01/touch/dc.rar
有更新,將輸入長度設為 35 個字就捲動,讓touch上的dc更好用,
即使輸入超過100字仍能正常處理(上限500字)。
mobileterminal可設定一些常用function快速鈕,如下列幾張圖:
(請將mobileterminal字體調大為15較好看)
Regards,
chw
-
07-16-2008 #4
看你這篇真是「目眩神移」啊~ 要用移動的移,連靈魂都跑掉了啦...
好厲害的一個用法,不只技巧要高深,連要計算的算是也得複雜
雖然吉米是應用數學系畢業的,不過看到這些,還是頭昏眼花
-
07-17-2008 #5
哈~ 現在我用 dc(or dcw) 較常用的也只有四則運算,頂多再加幾個(),
典型的用途是,去家樂X買東西時,買兩千送兩百,用dc計錄、計算一下
已經買多少了。
英文Document是十年前還在ntuee時寫的(dc也是在那時候寫的),那時在
學校讀的電子、電磁、電路、工數、線代、… 現在幾乎全忘光了
dc for iPhone程式要做得較好的話,應該像 dcw 那樣建構較完整的GUI,
不過我現在沒多餘的心力寫好用的GUI程式,只好偷懶隨便先做個command line
版本的,還好mobileterminal很強,讓dc不致於太難用。
對iPhone GUI較熟的前輩們,可利用 dc_cmd engine 來寫真正好用的iPhone
計算機
Regards,
chw
-
07-17-2008 #6
woju有沒有辦法把 telnet給弄上iphone啊
我之前有異想天開把Mac上的telnet搬過來
想當然爾是不能用啦!!
-
07-17-2008 #7
touch 已經有內建 telnet 了喔,請問 iPhone 沒有 telnet 嗎?
Regards,
chw
2018蘋果iPhone發表會確定9/13凌晨一點舉辦
一天前 進 iPhone 最新消息