 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
majkinetor
Joined: 24 May 2006 Posts: 3652 Location: Belgrade
|
Posted: Sat Jan 19, 2008 3:16 pm Post subject: |
|
|
| ok.... |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5390 Location: /b/
|
Posted: Sat Jan 19, 2008 3:19 pm Post subject: |
|
|
I didn't expect you to write a symbolic engine but to reuse one. Perl has Math::Symbolic as does Java and Maple too has it's own API. I thought you'd know of a good free library, alas they're hard to find.
| Laszlo wrote: | | If f depends on only one unknown, one could use fsolve to get its numerical inverse, but in general the f’ syntax is ambiguous, and easy to be mistaken with differentials. | It doesn't need to be - you could have a unique function for finding derivatives of an implicit variable, similar to Maples' dsolve().
| Laszlo wrote: | | I developed this script for my own needs. | Would you be interested in opening this up for others? majkinetor and I have expressed interest and willingness to contribute source code and mods, so what say you about an SVN project for calc.ahk? _________________
 |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4078 Location: Pittsburgh
|
Posted: Sat Jan 19, 2008 4:00 pm Post subject: |
|
|
The source is free (I will upload version 3 later today), so anyone can modify it. It is a really good idea to provide a few alternative user interfaces, so people can chose what they like. Your (or anyone’s) contribution is most welcome. The most useful areas are
- Better help (html with links, index, tutorial)
- Alternative user interfaces
- Optional wrapper for scientific functions from GSL or other free external dll
- True function definitions (dynamic AHK functions), with local variables
- Hidden mode (as in my other calculator scripts): selection is evaluated, pasted to the active application (lists and graphics are not trivial)
The compiled script is now only 215 KB, and does not need any other files but the Windows API. It loads and pops up instantly, faster than the Windows calculator. I spent a lot of time to make it small: relied on the built in AHK functionality, avoiding external dll’s or complex code, e.g. not allowing general cell editing in array lists or not making windows resizable. I think it is important to keep it pithy and fast, so a symbolic engine is probably better provided in a separate project. I don’t know of any good free library, either. Anyone who does, please post a link here. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4078 Location: Pittsburgh
|
Posted: Sat Jan 19, 2008 4:39 pm Post subject: |
|
|
Version 3.0 is uploaded, with many significant changes, new functions:
- ESC: Clears expression field
- Ctrl-Home/End: highlights first/last history entry
- F1, Alt-H: help
- Ctrl-F1: help about function under cursor in the Calc window
- Restructured Help (categorized functions)
- Help extended with AHK variables, operators, functions
- Help is made searchable
- New output line above hex: signed ¦ unsigned 64-bit integer
- Output is now labeled: AHK string, 0.6e¦0.17e, Int¦Uint 64, Hex¦-Hex, Binary
- Graph cursor stable on old graphic cards, too ~ majkinetor's SetCursor (check WM_SETCURSOR)
--- http://www.autohotkey.com/forum/viewtopic.php?t=27257
- Customizable default window positions, hotkeys by editing CALC.INI
- Customizable font, fontsize by editing them under [Font] in CALC.INI
- [Graph Defaults] are set in CALC.INI
--- width=600 (width of graph paper in pixels)
--- height=400 (height of graph paper)
--- xTicks=10 (number of vertical grid lines)
--- yTicks=10 (number of horizontal grid lines)
--- BgColor=0xFFFFFF (BackGround color: white)
--- LnColor=0xFF0000 (Line color: blue)
--- LnWidth=2 (Line width)
- _, _1: last output, _2,_3..._9 previous outputs
- list() lists last outputs (AHK format)
- Clear(array) removed
- sec, cosec, asec, acosec(x) added
- ModMul(a,b, m) : unsigned a*b mod m, no overflow if a*b < 2**127
- ModPow(a,e, m) : unsigned a**e mod m, no overflow!
- MsMul(a,b) : Most Significant Int64 of unsigned a*b
- Reci64(m [, ByRef ms]) : 2**ms/m: Int64 normalized (negative), m: UNSIGNED written with sign
- uMod(x,m) : unsigned mod (umod((2**32-1)*(2**32-1),9) -> 0)
- uCmp(a,b) : unsigned 64-bit compare. a <|=|> b: -1|0|1
- MSb(x) : Most Significant bit: 1..64, (0 if x=0)
- LSb(x) : Least Significant bit: 1..64, (0 if x=0)
There are a bunch of functions treating large integers as unsigned, although AHK shows them signed. They are useful if intermediate results could grow to more than 64 bits. The ModPow function is accurate in computing a**e mod m, even when a**e could not be computed by any computer in the world, like 12345678901234**9876543210987. |
|
| Back to top |
|
 |
Dragonscloud
Joined: 16 Jul 2005 Posts: 97
|
Posted: Sun Jan 27, 2008 7:42 am Post subject: |
|
|
I'm amazed at how far this project has come. Even the first version was extremely useful and versatile.I'm still using it at work as a replacement for Calc.
Bug report:
I tried out the Asc() function. It yielded the same result for uppercase as it did for lowercase.
Thanks for adding AHK variables.
I see that you fixed the bug regarding certain decimal inputs crashing the script. Great work.
I have some questions regarding arrays and graphing that I'll post another time when I can figure out how to phrase them. _________________ “yields falsehood when preceded by its quotation” yields falsehood when preceded by its quotation. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4078 Location: Pittsburgh
|
Posted: Sun Jan 27, 2008 6:48 pm Post subject: |
|
|
This is a “feature” of ComboBox: if the expression you type in happens to be already in the history list disregarding capitalization, the history version is taken, not the typed in expression (both with GuiControlGet and Gui Submit):
| Code: | Gui Add, ComboBox, vVar, G|A ; type g{Enter} or a{Enter}: MsgBox shows G or A
Gui Add, Button, Hidden Default, Evaluate
Gui Show
Return
ButtonEvaluate:
GuiControlGet Var
MsgBox % Var
Gui Submit, NoHide
MsgBox % Var
Return | A workaround is to include a space anywhere in the expression to make it different from the ones already in the History: e.g. Asc("a" ) may not be in the history list.
Disregarding spaces in the history was meant for normal calculator functions, not string manipulations. If you often work with strings only different in their internal spaces, this could become annoying.
Does anyone have an opinion: should the history contain each expression entered, even if they only differ from others in some spaces?
I will post a fix of the “Asc("A")” vs. “Asc("a")” problem later today. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4078 Location: Pittsburgh
|
Posted: Mon Jan 28, 2008 3:09 am Post subject: |
|
|
Version 3.1 is posted with a bugfix, basic polynomial functions, some others...
- Bugfix: Work around upper/lowercase conflicts in ComboBox (Dragonscloud’s report, Bobo's solution)
- Added xGCD(c,d, x,y) : Extended GCD, return GCD(x,y), compute c,d: GCD = c*x + d*y
- Added assign('x',v1,v2...) : assign values to array x
- Ctrl-F1 now searches for "space WORD (" with WORD found around the caret
- Added Alt-R and Context menu item "Refresh" in list window to refresh ListView after data change
- List simplified: use default width, static header
- POLYNOMIALs: Representation by vectors. p[0] = LEN = degree+1, p[1] + p[2]*x + ... p[LEN]*x**(LEN-1)
- Changed @() to pad the shorter vector with 0's ( @(`z,y,'+',x) ~ polynomial addition )
- Added pleval(p,x): evaluate polynomial, <- p(x), (Horner's method)
- Added plmul('z',y,x): z <- polynomial y*x (~ convolution, FIR filter)
- Added pldiv('q','r',y,x): polynomial division,mod: q <- y/x; r <- mod(y,x) |
|
| Back to top |
|
 |
Trikster
Joined: 15 Jul 2007 Posts: 1224 Location: Enterprise, Alabama
|
Posted: Mon Jan 28, 2008 3:29 am Post subject: |
|
|
Use This for pi. _________________ ScriptPad | ~dieom | dieom | izwian2k7 | Ian | God |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4078 Location: Pittsburgh
|
Posted: Mon Jan 28, 2008 3:35 am Post subject: |
|
|
| Why? |
|
| Back to top |
|
 |
Trikster
Joined: 15 Jul 2007 Posts: 1224 Location: Enterprise, Alabama
|
Posted: Mon Jan 28, 2008 3:57 am Post subject: |
|
|
Because it has it to 1mil digits? The article wasn't what I meant. I meant the DLL. (pi.dll) _________________ ScriptPad | ~dieom | dieom | izwian2k7 | Ian | God |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4078 Location: Pittsburgh
|
Posted: Mon Jan 28, 2008 4:10 am Post subject: |
|
|
| Thanks for the link, but we can generate more than 900 million digits of pi with a pure AHK script, too. With a little more complicated function the only limit on the number of digits computed is the memory in the PC. But what do you want to do with that many digits? The calculator cannot show them. Those digits are rarely needed, and when they are, you just fire up the script above. |
|
| Back to top |
|
 |
Trikster
Joined: 15 Jul 2007 Posts: 1224 Location: Enterprise, Alabama
|
Posted: Mon Jan 28, 2008 4:17 am Post subject: |
|
|
I knew there was a function like that somewhere on the forums. My search skills just aren't mad (good, if you're not up to-date on slang) as yours. _________________ ScriptPad | ~dieom | dieom | izwian2k7 | Ian | God |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1249 Location: USA
|
Posted: Mon Jan 28, 2008 4:19 am Post subject: |
|
|
| Code: | FileAppend, % pi(1000000000000000000000000000000000000000000000000000000000), PI.TXT
|
THIS GET STUCK IN A LOOP??? _________________
ʞɔпɟ əɥʇ ʇɐɥʍ |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4078 Location: Pittsburgh
|
Posted: Mon Jan 28, 2008 4:35 am Post subject: |
|
|
You are a little too optimistic. The parameter of the pi function is the number of digits you request. Even if your PC has 16GB memory the function cannot handle more than 905,000,000 digits. There is a loop running 500 million times, working on billion digit numbers, so leave your PC on for a couple of months...  |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1249 Location: USA
|
Posted: Mon Jan 28, 2008 4:39 am Post subject: |
|
|
o rly. roflmao.......i was like wow this is takin forever. _________________
ʞɔпɟ əɥʇ ʇɐɥʍ |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|