/gongshi.lua
https://code.google.com/p/google-pinyin-api/ · Lua · 274 lines · 237 code · 27 blank · 10 comment · 122 complexity · cc90d3f49313a5f4d623137e570dbea1 MD5 · raw file
- -- encoding: UTF-8
-
- ------------------------------------------------
- -- ??????????
- -- ??: 0.1
- -- ??: Mike
- -- ????: http://code.google.com/p/google-pinyin-api/
- --
- -- ?????GPLv3??
- ------------------------------------------------
-
- function liangjiaohe (input)
- if input == "a" then
- return {
- {["suggest"] = "a", ["help"] = "sin(A+B)"},
- {["suggest"] = "b", ["help"] = "sin(A-B)"},
- {["suggest"] = "c", ["help"] = "cos(A+B)"},
- {["suggest"] = "d", ["help"] = "cos(A-B)"},
- {["suggest"] = "e", ["help"] = "tan(A+B)"},
- {["suggest"] = "f", ["help"] = "tan(A-B)"},
- {["suggest"] = "g", ["help"] = "ctg(A+B)"},
- {["suggest"] = "h", ["help"] = "ctg(A-B)"},
- }
- end
- end
-
-
- function beijiao (input)
- if input == "b" then
- return {
- {["suggest"] = "a", ["help"] = "sin2A"},
- {["suggest"] = "b", ["help"] = "cos2A"},
- {["suggest"] = "c", ["help"] = "tag2A)"},
- {["suggest"] = "d", ["help"] = "ctg2A"},
- }
- end
- end
-
-
- function banjiao (input)
- if input == "c" then
- return {
- {["suggest"] = "a", ["help"] = "sin(A/2)"},
- {["suggest"] = "b", ["help"] = "cos(A/2)"},
- {["suggest"] = "c", ["help"] = "tag(A/2))"},
- {["suggest"] = "d", ["help"] = "ctg(A/2)"},
- }
- end
- end
-
-
-
- function hechahuaji (input)
- if input == "d" then
- return {
- {["suggest"] = "a", ["help"] = "sinA+sinB"},
- {["suggest"] = "b", ["help"] = "sinA-sinB"},
- {["suggest"] = "c", ["help"] = "cosA+cosB"},
- {["suggest"] = "d", ["help"] = "cosA-cosB"},
- }
- end
- end
-
- function jihuahecha (input)
- if input == "e" then
- return {
- {["suggest"] = "a", ["help"] = "sinAcosB"},
- {["suggest"] = "b", ["help"] = "cosAsinB"},
- {["suggest"] = "c", ["help"] = "sinAsinB"},
- {["suggest"] = "d", ["help"] = "cosAcosB"},
- }
- end
- end
-
- function wanneng (input)
- if input == "f" then
- return {
- {["suggest"] = "a", ["help"] = "sinA"},
- {["suggest"] = "b", ["help"] = "cosA"},
- {["suggest"] = "c", ["help"] = "tagA"},
- }
- end
- end
-
- function sanjiao (input)
- if #input == 0 then
- return {
- {["suggest"] = "a", ["help"] = "?????"},
- {["suggest"] = "b", ["help"] = "????"},
- {["suggest"] = "c", ["help"] = "????"},
- {["suggest"] = "d", ["help"] = "????"},
- {["suggest"] = "e", ["help"] = "????"},
- {["suggest"] = "f", ["help"] = "????"},
- }
-
- elseif input == "a" then
- return liangjiaohe(input)
- elseif input == "aa" then
- return "sin(A+B)=sinAcosB+cosAsinB"
- elseif input == "ab" then
- return "sin(A-B)=sinAcosB-sinBcosA"
- elseif input == "ac" then
- return "cos(A+B)=cosAcosB-sinAsinB"
- elseif input == "ad" then
- return "cos(A-B)=cosAcosB+sinAsinB"
- elseif input == "ae" then
- return "tan(A+B)=(tanA+tanB)/(1-tanAtanB)"
- elseif input == "af" then
- return "tan(A-B)=(tanA-tanB)/(1+tanAtanB)"
- elseif input == "ag" then
- return "ctg(A+B)=(ctgActgB-1)/(ctgB+ctgA)"
- elseif input == "ah" then
- return "ctg(A-B)=(ctgActgB+1)/(ctgB-ctgA)"
-
- elseif input == "b" then
- return beijiao(input)
- elseif input == "ba" then
- return "sin(A-B)=2sinAcosA"
- elseif input == "bb" then
- return "cos2A=(cosA)^2-(sinA)^2=2(cosA)^2-1=1-2(sinA)^2"
- elseif input == "bc" then
- return "tag2A=2tanA/[1-(tanA)^2]"
- elseif input == "bd" then
- return "ctg2A=[ctgA)^2-1]/2ctgA"
-
- elseif input == "c" then
- return banjiao(input)
- elseif input == "ca" then
- return "sin(A/2)=?[(1-cosA)/2]"
- elseif input == "cb" then
- return "cos(A/2)=?[(1+cosA)/2]"
- elseif input == "cc" then
- return "tan(A/2)=?[(1-cosA)/(1+cosA)]"
- elseif input == "cd" then
- return "ctg(A/2)=?[(1+cosA)/(1-cosA)]"
-
- elseif input == "d" then
- return hechaohuaji(input)
- elseif input == "da" then
- return "sinA+sinB=2sin[(A+B)/2]cos[(A-B)/2]"
- elseif input == "db" then
- return "sinA-sinB=2cos[(A+B)/2]sin[(A-B)/2]"
- elseif input == "dc" then
- return "cosA+cosB=2cos[(A+B)/2]cos[(A-B)/2]"
- elseif input == "dd" then
- return "cosA-cosB=-2sin[(A+B)/2]sin[(A-B)/2] "
-
- elseif input == "e" then
- return hechaohuaji(input)
- elseif input == "ea" then
- return "sinAcosB=(1/2)[sin(A+B)+sin(A-B)]"
- elseif input == "eb" then
- return "cosAsinB=(1/2)[sin(A+B)-sin(A-B)]"
- elseif input == "ec" then
- return "sinAsinB=-(1/2)[cos(A+B)-cos(A-B)]"
- elseif input == "ed" then
- return "cosAcosB=(1/2)[cos(A+B)+cos(A-B)]"
-
- elseif input == "f" then
- return wanneng(input)
- elseif input == "fa" then
- return "sinA=2tan(A/2)/[1+tan^2(A/2)]"
- elseif input == "fb" then
- return "cosA=[1-tan^2(A/2)]/[1+tan^2(A/2)]"
- elseif input == "fc" then
- return "tanA=2tan(A/2)/[1-tan^2(A/2)]"
-
- end
- end
-
-
-
-
-
- function daoshu (input)
- if #input == 0 then
- return {
- {["suggest"] = "a", ["help"] = "C(??)"},
- {["suggest"] = "b", ["help"] = "x^a"},
- {["suggest"] = "c", ["help"] = "a^x"},
- {["suggest"] = "d", ["help"] = "e^x"},
- {["suggest"] = "e", ["help"] = "loga(x)"},
- {["suggest"] = "f", ["help"] = "lnx"},
- {["suggest"] = "g", ["help"] = "sinx"},
- {["suggest"] = "h", ["help"] = "cosx"},
- {["suggest"] = "l", ["help"] = "tagx"},
- {["suggest"] = "j", ["help"] = "ctgx"},
- {["suggest"] = "k", ["help"] = "secx"},
- {["suggest"] = "l", ["help"] = "cscx"},
- {["suggest"] = "m", ["help"] = "arcsinx"},
- {["suggest"] = "n", ["help"] = "arccosx"},
- {["suggest"] = "o", ["help"] = "arctagx"},
- {["suggest"] = "p", ["help"] = "arcctgx"},
- }
- elseif input == "a" then
- return "(C)'=0"
- elseif input == "b" then
- return "(x^a)'=ax^(a-1)"
- elseif input == "c" then
- return "(a^x)'=a^xˇlna"
- elseif input == "d" then
- return "(e^x)'=e^x"
- elseif input == "e" then
- return "(loga(x))'=1/(xˇlna)"
- elseif input == "f" then
- return "(lnx)'=1/x"
- elseif input == "g" then
- return "(sinx)'=cosx"
- elseif input == "h" then
- return "(cosx)'=-sinx"
- elseif input == "i" then
- return "(tagx)'=(secx)^2"
- elseif input == "j" then
- return "(ctgx)'=-(cscx)^2"
- elseif input == "k" then
- return "(secx)'=secxtagx"
- elseif input == "l" then
- return "(cscx)'=cscxctgx"
- elseif input == "m" then
- return "(arcsinx)'=1/?(1-x^2)"
- elseif input == "n" then
- return "(arccosx)'=-1/?(1-x^2)"
- elseif input == "o" then
- return "(arctagx)'=1/(1+x^2)"
- elseif input == "p" then
- return "(arcctgx)'=-1/(1+x^2)"
- end
- end
-
- function jifen (input)
- if #input == 0 then
- return {
- {["suggest"] = "a", ["help"] = "?0ˇdx"},
- {["suggest"] = "b", ["help"] = "?x^aˇdx"},
- {["suggest"] = "c", ["help"] = "?1/xˇdx"},
- {["suggest"] = "d", ["help"] = "?a^xˇdx"},
- {["suggest"] = "e", ["help"] = "?e^xˇdx"},
- {["suggest"] = "f", ["help"] = "?sinxˇdx"},
- {["suggest"] = "g", ["help"] = "?cosxˇdx"},
- {["suggest"] = "h", ["help"] = "?(secx)^2ˇdx"},
- {["suggest"] = "l", ["help"] = "?(cscx)^2ˇdx"},
- {["suggest"] = "j", ["help"] = "?1/?(1-x^2)ˇdx"},
- {["suggest"] = "k", ["help"] = "?1/(1+x^2)ˇdx"},
- }
- elseif input == "a" then
- return "?0ˇdx=C"
- elseif input == "b" then
- return "?x^aˇdx=1/(a+1)ˇx(a+1)+C (a?-1)"
- elseif input == "c" then
- return "?1/xˇdx=ln|x|+C"
- elseif input == "d" then
- return "?a^xˇdx=1/lnxˇa^x+C (a>0, a?-1)"
- elseif input == "e" then
- return "?e^xˇdx=e^x+C"
- elseif input == "f" then
- return "?sinxˇdx=-cosx+C"
- elseif input == "g" then
- return "?cosxˇdx=sinx+C"
- elseif input == "h" then
- return "?(secx)^2ˇdx=tagx+C"
- elseif input == "i" then
- return "?(cscx)^2ˇdx=-ctgx+C"
- elseif input == "j" then
- return "?1/?(1-x^2)ˇdx=arcsinx+C=-arccosx+C"
- elseif input == "k" then
- return "?1/(1+x^2)ˇdx=arctagx+C=-arcctgx+C"
- end
- end
-
- ------------
-
- ime.register_command("fj", "jifen", "??????")
- ime.register_command("fd", "daoshu", "????????")
- ime.register_command("fs", "sanjiao", "??????")