Acron RPN announces v3.0 BETA
08-27-2017, 05:49 PM
Post: #1
 vanLudwig Member Posts: 50 Joined: Jun 2016
Acron RPN announces v3.0 BETA
Today we’re pushing out the first public BETA of Acron RPN Calculator v3.0 for Android. Highlights for this release:
• The most obvious change is that the ‘base’ button has been replaced with ‘mode’. This still contains options for switching to based-integer mode, but also now allows you to control the number format when in scientific mode. You can now choose whether you want to use the perfect number engine, on always want decimal answers; switch between normal, scientific, and engineering notations; switch between floating and fixed decimal places; and control the number of decimal places that will be displayed.
• The primary focus of this release is more subtle. All of the UI primitives have been completely rewritten so that the entire user interface can be defined in XML. You can now load a new layout XML file and completely replace the UI with whatever you want. I’ll have more details on this in a follow-up post soon.
• Having a fully customizable UI provided the freedom to create many new math functions without worrying about cluttering up the stock layout. There’s a bunch of new number theory and probability functions, including a complex gamma function. And the functionality suite I’m most proud of – a full set of numeric algorithms for finding function roots, derivatives, integrals, critical points, summations, and products. More on this in a follow-up post too. Again, none of these functions are available in the stock UI layout; you need a customized layout XML to expose them.
• An unlimited number of memory registers, scientific constants, and unit conversions can be defined in your layout XML.
As usual, all new development in Acron RPN is done on Android. When Android is ready for BETA, the code is turned over so that iOS porting can begin. iOS porting tends to take about the same amount of time as working out any bugs discovered during the BETA process, then we try to do a coordinated finalized release.

Want to be a BETA tester? Join here.
08-27-2017, 09:20 PM (This post was last modified: 06-08-2018 10:53 PM by vanLudwig.)
Post: #2
 vanLudwig Member Posts: 50 Joined: Jun 2016
RE: Acron RPN announces v3.0 BETA
UI layouts can be authored in XML, saved with the .acronrpn file extension, and loaded exactly like a saved stack .acronrpn file. Only the paid version of Acron RPN can change layouts. Here’s some useful downloads to get started:

A few things to remember:
• Regardless of what your layout looks like, Acron RPN is always an entry-style RPN calculator with an unlimited stack. Layouts give you a lot of flexibility on how the app looks, but minimal flexibility in how it acts.
• If there is a bug in your layout, Acron RPN will give an error message that should be sufficient to locate the problem. It will continue to use the previous layout until a new layout is successfully installed. Once a new layout is successfully installed, you will be forced to restart the app.
• Layouts can be loaded from the stack -> open button, or launched directly from Google Drive, Downloads, a web browser, etc. Launching from Google Drive, etc. becomes necessary if your installed layout doesn’t expose an open button.
• If something goes wrong, you can always get back to the stock layout by using “Clear Data” from Settings -> Apps -> Acron RPN Calculator -> Storage.
08-30-2017, 12:16 AM (This post was last modified: 10-06-2017 02:19 AM by vanLudwig.)
Post: #3
 vanLudwig Member Posts: 50 Joined: Jun 2016
RE: Acron RPN announces v3.0 BETA
I just pushed an update of BETA 1 to the Play Store. There was an over-aggressive try/catch block that was preventing users from getting properly notified of bugs in their layouts. It should be much easier to write a layout now that you aren't doing it blindfolded.

Here's a variant of the stock layout that adds 28 memory registers (a-z + theta and phi). Enjoy.
08-30-2017, 11:20 PM
Post: #4
 Nigel (UK) Senior Member Posts: 326 Joined: Dec 2013
RE: Acron RPN announces v3.0 BETA
Here's my first attempt (layout file attached; remove the ".txt" extension before use). It adds an extra row of keys above the numbers to give access to some of the new functions. The added keys are:
• x - a variable for use in the functions below;
• zero - finds the zero of a function of x;
• integ - integrates a function of x between specified limits;
• deriv - finds the numerical derivative of a function of x at a particular value of x;
• sigma - sums a function of x over a specified range.
For example, to find a zero of $$\tan(x)-\sqrt{x}$$:
• Enter this function onto the stack. Do this by pressing the "x" key, then "tan", then "x", then "$$\sqrt{}$$", then "-" (minus). Note that the default value stored in x is zero.
• Press "x" again; this tells the calculator which variable to solve for.
• Enter a starting value for x: 1, for example.
• Then press the "zero" key.
The answer appears in the stack.

The other functions work in a similar way, with the stack arguments being function, variable ("x" here, since I haven't put any others on the keyboard), and then one (zero, deriv) or two (integ, sigma) numerical values. These functions (and others) are described in the "Layout Documentation" linked to earlier in this thread.

I have many "classic" calculator apps on my phone and I enjoy using them all, but none of them are as convenient to use as AcronRPN when doing longer calculations. If you haven't seen it yet you really should give it a go. If RPN has a future, this is it!

Nigel (UK)

Attached File(s)
08-31-2017, 01:09 PM (This post was last modified: 08-31-2017 01:25 PM by vanLudwig.)
Post: #5
 vanLudwig Member Posts: 50 Joined: Jun 2016
RE: Acron RPN announces v3.0 BETA
Bravo - I hadn't expected anyone to figure out those solver methods until I wrote a tutorial. Glad to see that the weekend I spent writing that layout documentation wasn't for naught.

In case you hadn't noticed, the solver methods play nice together so that you don't have to keep re-entering the equation. For instance, immediately after finding the zero of tan(x)-sqrt(x) is 0.6949, you can press deriv to learn that the slope at 0.6949 is 1.095. Acron RPN will see the zero() on the top of the stack and assume those are the parameters you want for the deriv function.

You also might want to make room for the MathWhere function - it can be really handy too. For instance
• Create a function for sec(x*PI/10). Press x, PI, *, 10, /, sec
• Press x again as the variable for the Where
• Enter 0 as the value for the Where
• Press Where. You see that the sec(x*PI/10)|x=0 is 1.
• Now you can enter 1 and immediately press Where again. It computes the sec(x*PI/10)|x=1
• Enter 2 and press Where again. It computes the sec(x*PI/10)|x=2
08-31-2017, 08:02 PM
Post: #6
 Nigel (UK) Senior Member Posts: 326 Joined: Dec 2013
RE: Acron RPN announces v3.0 BETA
Here's a layout that includes the "where" function. As before, remove the ".txt" suffix from the attached file before running it on your Android phone / tablet. (If the phone pops up a menu, choose "open file" and then select AcronRPN as the application to open the file with.) This layout includes a row with six buttons, but to me it looks fine! I've added borders to the buttons and I've changed the "Change sign" key label from "(-)" to a more traditional "CHS".

The XML layout system works well. At first it looks completely incomprehensible but the documentation (and Notepad++ as an editor) allow simple changes without too much difficulty. It's not what I would call straightforward but I haven't had to invest days to get some decent results.

Thank you again for an excellent product with superb support.

Nigel (UK)

Attached File(s)
08-31-2017, 11:46 PM (This post was last modified: 10-06-2017 02:21 AM by vanLudwig.)
Post: #7
 vanLudwig Member Posts: 50 Joined: Jun 2016
RE: Acron RPN announces v3.0 BETA
Here's a pretty decent replica of an HP32SII. It obviously isn't programmable, and there's a few other buttons I had to change or repurpose, but it gives you a good idea of what's possible through layouts.

09-01-2017, 02:36 PM
Post: #8
 inaqui76 Junior Member Posts: 8 Joined: Oct 2015
RE: Acron RPN announces v3.0 BETA
(08-31-2017 11:46 PM)vanLudwig Wrote:  Here's a pretty decent replica of an HP32SII. It obviously isn't programmable, and there's a few other buttons I had to change or repurpose, but it gives you a good idea of what's possible through layouts.

I tried it, it's nice.. but how can I load other skins?
I didn't found any button to load.. I also delete the file but didn't work... any ideas?
09-01-2017, 02:51 PM
Post: #9
 vanLudwig Member Posts: 50 Joined: Jun 2016
RE: Acron RPN announces v3.0 BETA
From my earlier post
• Layouts can be loaded from the stack -> open button, or launched directly from Google Drive, Downloads, a web browser, etc. Launching from Google Drive, etc. becomes necessary if your installed layout doesn’t expose an open button.
• If something goes wrong, you can always get back to the stock layout by using “Clear Data” from Settings -> Apps -> Acron RPN Calculator -> Storage.
09-01-2017, 09:38 PM (This post was last modified: 10-06-2017 02:22 AM by vanLudwig.)
Post: #10
 vanLudwig Member Posts: 50 Joined: Jun 2016
RE: Acron RPN announces v3.0 BETA
Here's the last layout I have laying around (though I'll probably make more in the future). It pretty much looks like the stock layout, but there's an extra page of buttons in the x! toolbar, and A LOT of toolbar buttons can be long-pressed for second functions. Look for the shaded upper-right corner of toolbar buttons to indicate they can be long-pressed. Almost all of the fixed buttons can be long-pressed too, so I decided not to shade those. I realize this is a bit overwhelming to use - I mainly designed it just so that I could test all the built in functionality.

factor -> Return the x-th prime number
mod -> PI(x) i.e. the number of primes less than or equal to x
gcd -> Euler Phi function

round -> rationalize(y, x)
iPart -> ceiling(x)
fPart -> floor(x)
|x| -> sign(x)

x^2 -> x^3
sqrt(x) -> cbrt(x)
1/x -> x^-1

C(y, x) -> multichoose(y, x)
delta% -> %T
x!! -> !x (double factorial and subfactorial)

Σx -> maximum x
Σx^2 -> minimum x
mean x -> median x
population standard dev -> sample standard dev

7 -> Toolbar of scientific constants
8 -> Toolbar of unit conversions. Long-press unit conversion button for reverse conversion
4 -> Toolbar of calculus / solver functions
5 -> Toolbar of TVM financial functions. Tap variables to assign them; long-press to solve for them

09-04-2017, 06:29 PM
Post: #11
 vanLudwig Member Posts: 50 Joined: Jun 2016
RE: Acron RPN announces v3.0 BETA
I kinda glossed over the TVM financial toolbar in my last post, but I think it deserves a closer look. If you read though the reference documentation, you might have noticed that Acron RPN doesn't have any finical functions. So, how does this work?

There's an article in the October 1977 edition of Hewlett-Packard Journal on the math behind their financial calculators. Basically, they have an equation of five variables (n, I, PV, FV, and PMT). You fill in four values and solve for the fifth such that the whole expression equals zero.

Conveniently, Acron RPN already has MathZero for doing exactly that. If you look in the behavior section of ultimate.acronrpn, you can find that when you press the toolbar button to solve for one of those variables, it invokes a sequence of keypresses that create the generic TVM function on the stack, use MathZero to solve for the variable you want, stores the result of MathZero back into that variable, then deletes the TVM equation it authored. It isn't foolproof, but it is pretty impressive what you can create in your layout xml without changing the actual sourcecode.

Behavior for solving for FV (other variables are nearly identical):
Code:
     <button ref="finFV" event="longPress">         <!-- Push the general TVM formula to the stack -->         <StackBox.ClearConsole/>         <variable_push ref="financeI_YR"/>         <variable_push ref="financeP_YR"/>         <MathDivide.Action/>         <StackBox.Enter/>         <StackBox.Digit1/>         <MathAdd.Action/>         <variable_push ref="financeN"/>         <MathPower.Action/>         <StackBox.Enter/>         <variable_push ref="financePV"/>         <MathMultiply.Action/>         <StackBox.Swap2/>         <StackBox.Digit1/>         <MathSubtract.Action/>         <StackBox.Roll3Up/>         <MathDivide.Action/>         <variable_push ref="financePMT"/>         <MathMultiply.Action/>         <MathAdd.Action/>         <variable_push ref="financeFV"/>         <MathAdd.Action/>         <!-- Solve for FV -->         <variable_push ref="financeFV"/>         <StackBox.Digit0/>         <MathZero.Action/>         <!-- Clean Up-->         <StackBox.UpArrow/>         <StackBox.RightArrow/>         <StackBox.Enter/>         <variable_store ref="financeFV"/>         <StackBox.Swap2/>         <StackBox.Clear/>     </button>
09-05-2017, 08:03 PM
Post: #12
 Nigel (UK) Senior Member Posts: 326 Joined: Dec 2013
RE: Acron RPN announces v3.0 BETA
Here's another layout. It doesn't do anything particularly impressive but I've put the functions I use most often as long presses on number and operator keys (as you've done) and I've put labels on the keys to show this. The lower (and smaller) function label on a key is invoked by a long press.

(As with the previous layouts, remove the ".txt" extension before use.)

One slight issue - integrals appear to have a precision of around 1 part in 10^4 which is less than I'd expect, given the computing power available on a phone! Could this be tweaked in some way?

Nigel (UK)

Attached File(s)
09-05-2017, 11:18 PM (This post was last modified: 09-05-2017 11:26 PM by vanLudwig.)
Post: #13
 vanLudwig Member Posts: 50 Joined: Jun 2016
RE: Acron RPN announces v3.0 BETA
Cool - I like the two-toned button effect.

Do you have an example integral calculation you are having trouble with? I'm using a 10,000 iteration Riemann sum, which seems like it should be sufficient.
09-06-2017, 09:41 AM
Post: #14
 Nigel (UK) Senior Member Posts: 326 Joined: Dec 2013
RE: Acron RPN announces v3.0 BETA
For example:
$$\int_0^1 x^2\,{\rm d}x=0.33328\dots$$
rather than 0.333333;
$$\int_1^{10}{1\over x}\,{\rm d}x=2.30299\dots$$
rather than 2.30258.

Errors generally appear in the 4th or 5th significant figure.

Nigel (UK)
09-06-2017, 09:45 PM (This post was last modified: 09-06-2017 11:12 PM by vanLudwig.)
Post: #15
 vanLudwig Member Posts: 50 Joined: Jun 2016
RE: Acron RPN announces v3.0 BETA
I'm pretty sure I remember my numeric algorithms professor saying that doing a trapezoidal Riemann sum wasn't worth the added cost over rectangular - you were better off spending the extra time doing additional iterations. Not sure whether I mis-remember that, or if he was just wrong, but when I sat down and really thought about it, I was able to switch my algorithm to use trapezoids with almost no cost. That improved the precision by 3-5 decimal places

0.333283335000000 -> 0.333333335000000
2.302990159819040 -> 2.302585159819040

Then I changed from 10,000 iterations to 25,000 iterations. That improved the x^2 by two digits; it only improved the 1/x by half a digit.

0.333333335000000 -> 0.333333333600000
2.302585159819040 -> 2.302585103686040

That seems like a good improvement, and even with 25,000 iterations, I don't notice any slow down. I'm currently looking at releasing BETA 2 this weekend - these changes will be in it. Thanks for the great suggestion.

On a side note, how did you insert math equations in a forum post? That is really cool.
09-07-2017, 06:51 AM
Post: #16
 Dieter Senior Member Posts: 2,401 Joined: Dec 2013
RE: Acron RPN announces v3.0 BETA
(09-06-2017 09:45 PM)vanLudwig Wrote:  Then I changed from 10,000 iterations to 25,000 iterations. That improved the x^2 by two digits; it only improved the 1/x by half a digit.

Instead of thousands and tenthousands of function calls, why don't you just implement a decent integration algorithm like the Romberg method? It is iterative, i.e. you only have to do as many function calls as required for a given precision, and it does not evaluate the function at the integration limits which is another advantage.

(09-06-2017 09:45 PM)vanLudwig Wrote:  On a side note, how did you insert math equations in a forum post? That is really cool.

This forum supports Mathjax.

Dieter
09-07-2017, 10:34 AM
Post: #17
 Paul Dale Senior Member Posts: 1,443 Joined: Dec 2013
RE: Acron RPN announces v3.0 BETA
I'm with Dieter, pick a better algorithm. For example, a two point Gaussian quadrature is exact for cubic polynomials which includes the x2 example. Romberg is an easy choice and is adaptive. Also interesting are the Gauss–Kronrod quadratures, although they will need to be made adaptive.

As for trapezoidal vs rectangular, it depends how you define the latter. Using the function value at the middle of the rectangles for the height (rather than at the left or right edge) produces an error term twice that of the trapezoidal for one less function evaluation. Using either edge to define the rectangles is worse. Wikipedia illustrates this okay. Computationally, they are about the same (but trapezoidal requires one more function evaluation).

Pauli
09-07-2017, 06:29 PM
Post: #18
 Dieter Senior Member Posts: 2,401 Joined: Dec 2013
RE: Acron RPN announces v3.0 BETA
(09-07-2017 10:34 AM)Paul Dale Wrote:  Romberg is an easy choice and is adaptive.

"Adaptive" – that's what I meant when I said it was "iterative". #-)

(09-07-2017 10:34 AM)Paul Dale Wrote:  As for trapezoidal vs rectangular, ...

Let's not forget that the Romberg method is based on the Trapezoidal rule. It just does a clever extrapolation based on a quite good error estimate. ;-)

FWIW, I think something like the Trapezoidal method or even the much better Simpson rule really should not get implemented in a current calculator. That's like calculating trig and log functions with just five significant digits. My first calculator back in 1977 did so, but some things have changed since then. ;-)

Dieter
09-07-2017, 07:59 PM
Post: #19
 Dieter Senior Member Posts: 2,401 Joined: Dec 2013
RE: Acron RPN announces v3.0 BETA
(09-06-2017 09:45 PM)vanLudwig Wrote:  0.333283335000000 -> 0.333333335000000
2.302990159819040 -> 2.302585159819040

Then I changed from 10,000 iterations to 25,000 iterations. That improved the x^2 by two digits; it only improved the 1/x by half a digit.

0.333333335000000 -> 0.333333333600000
2.302585159819040 -> 2.302585103686040

So that's 25 000 iterations giving roughly 8–9 correct digits.

For the record: a standard Romberg implementation like the one in the WP34s requires merely 61 function calls for the x² integral or 511 calls for 1/x to return results with full 16-digit accuracy.

You really should switch to a better method. And virtually anything is better than rectangular or trapezoid.

Dieter
09-07-2017, 08:55 PM
Post: #20
 Nigel (UK) Senior Member Posts: 326 Joined: Dec 2013
RE: Acron RPN announces v3.0 BETA
(09-06-2017 09:45 PM)vanLudwig Wrote:  On a side note, how did you insert math equations in a forum post? That is really cool.

This thread shows how it can be done. If you want to see how the equations in each post were produced, press the "quote" button to see what the poster actually typed. It's basically $$\TeX$$.

I do think that switching to an adaptive algorithm for integration would be a good idea. It's not just that it requires fewer evaluations; it allows you to be confident that the desired degree of accuracy has been reached.

I'm looking forward to the next version!

Nigel (UK)
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)