Saturday, 9 January 2016

Improved Answer Accuracy

When you try to reuse an answer from past calculations, TLCalc will first check to see if the answer was stored internally, and if not, TLCalc will reconstruct the value from the text. Restoring the value from text is less accurate as the internal values are stored with more decimal places than the text form. The text it reconstructs from is actually the text you see so the lower you set the number of decimal places to format in settings, the larger the rounding error when reusing past values (if the values aren't stored internally). Note that this does not affect variables and the insert ANS command which are always stored internally.

Storing the answers internally increases memory usage so 3 modes are offered:
  • Store no answers: no answers are stored and consequently has minimal memory usage. This is the only mode available pre V1.19.0.
  • Store constants only: only store answers if they evaluate to a constant like 2+3i. Values like matrices and expressions (2x) are not stored. This is the default mode. 
  • Store all answers: all answers are stored.

The retain answer mode setting is found the Main Calculator Settings screen

Note that if you reduce the type of answers to retain such as from Store all answers to Store constants only, the internal answers are not cleared from memory until you exit and restart the app. Once the answers are removed though, the loss is permanent and only the values available by reconstructing from text becomes available.

Extra info: when you tap on a history item to toggle between rectangular and polar output, you can test whether the answer is stored internally or not. If the answer is stored internally, toggling the output type will retain the answer in black. If the answer is not stored internally, the text once toggled goes grey. When toggling answers without the internal value available, you may notice the value deviate from the original value significantly if you cycle many times. In the image below, the retain answer mode is store constants only and so 2x is not stored internally and greyed out after toggling.

Tuesday, 5 January 2016

TLCalc Intersection Finder Limitations

You don't need to read this in order to use the intersection finding capability of TLCalc but you might be interested in some of the quirky behaviour or inner workings of it.

TLCalc offers the unique feature of being able to find intersections between functions, polar plots, parametric plots and even between plots of different types, but there are some limitations. These limitations are that:

  • it runs fairly slowly (the search is done in the background so it's less noticeable)
  • it has medium accuracy (expect 5-9 significant figures)
  • it has low stability (if you move the plots around, you will notice that some intersections get missed out, even if they were found earlier) and
  • plots which come very close together (closer than 0.00001) may be mistaken as intersections.

The limitations are due to algorithm which must optimise two independent and non-linear variables and I haven't found a good way to do this yet. Despite these limitations, the current one does reasonably well and you can find pretty much any intersection between different plots if you don't need super high accuracy and if you spend a second panning the plot around until the intersection you want gets picked up.

In V1.19.0, an intersection finder was added specifically for functions. This finder was the old finder from V1.15.1 which was much faster, more accurate and had much better stability than the generic finder (expect at least 9 significant figures of accuracy and zero misses). This finder replaces the generic finder when the intersection is between two functions which are in terms of the same variables. I.e. finding the intersections between f(x) and f(y) will use the generic finder with less accuracy. The obvious limitation is that the finder from V1.15.1 only works for functions.

You may be wondering whether implicit plots and statistical plots will be included in the future. Intersection of statistical plots is useless for all but the line and scatter plot, but even then, it doesn't really make any sense (intersection between discrete and continuous data is not something that is normally required). The implicit plot is also not available because I haven't found a way to do this yet. I haven't even implemented a way to do tracing of implicit plots (this is another 2 variable optimisation problem except this time I don't have a slope that is dependent on a single variable to work with which means my current algorithm is useless for this task).