The setting was not defined, so we had white as foreground and
background, which made the selection hard to read.
Fixes: #1107
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Separated the demo in three sections of 30 seconds each:
- Basics of RPL and user interface (RPL, function keys, online help, catalog,
unicode, text editor)
- Mathematics (complex, vector, matrix, symbolic, based)
- Programming
Fixes: #1104
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When rendering the shift keys in color, we need to render a colorized
bitmap.
Fixes: #1100
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This releases focuses on improvements to the solver, with the completion of the
Columns and Beams section from the HP50G equation library.
**Features**
* equations: Add remaining equations from "Columns and Beams"
* loops: For loops on lists and arrays
* menus: Add `R→D`, `D→R`, `→Polar` and `→Rectangular`
* menus: Automatically select tools menu for library equations
* units: Allow `ubase` to work on expressions
* units: Graphic rendering of units
**Bug fixes**
* 48calc.org: Fix mouse click position
* `#ABC #DEF -` now correctly produces a based number with >64-bit wordsize
* conditionals: Parse and evaluate `IFTE` correctly
* equations: Fix Elastic Buckling
* files: Avoid crash in `file_closer` if file was not open
* istack: Enable Swap feature on top two levels
* menu: Update SolvingMenu when updating VariablesMenu
* parser: Deal with negation more "normally", parse `-a²` correctly
* solver: Compute units correctly for inputs
* solver: Do not change unit when storing in a solver variable
* solver: Emit correct error message in `EvalEq` if missing variables
* solver: Preserve errors reported by underlying function
* units: Do not evaluate/render units with names
* units: No longer read variables `m` and `s` while processing `1_m/s`
* units: Simplify units that convert to real numbers
**Improvements**
* Update .gitignore
* build: Add BMP files to the distribution
* complex: Optimize exit conditions for parentheses
* solver: Add test for equation library
* solver: Add tests for solving with units
* solver: Improve behaviour of `EvalEq`
* solver: Keep units and constants as-is in equation
* solver: Make precision relative to equation sides magnitude
* stack: Show vectors vertically by default
* ui: Do not persistently hide stack with current equation
* units: Keep power integral, i.e. avoid getting `1_m^2.0/s`
* units: Strip tags from unit conversion functions
* units: The `EvalEq` command should not evaluate dates
* wasm: Add logos to the repository
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Allow `for next` and `start next` to operate with a list as input.
For example, `{ 1 3 "ABC" } for i i 2 * 1 + next` pushes
`3`, `7` and `"ABCABC1"` on the stack.
This is an extension compared to classic RPL.
Fixes: #1079
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When we have a wordsize of 64 or more, we need to select the same
bignum type for the difference as the input.
Fixes: #1097
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Fix handling of mouse click position.
The coordinates were computed relative to the wrong dimensions, so the
buttons were all the more unreliable the more they were at the bottom
and to the right.
Fixes: #1096
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add the missing equations from "Columns and Beams" section of the
HP50G advanced reference manual.
Notice that some of the descriptions are incorrect in the manual, and
that the correct equations had to be fetched from the HP50G itself.
Foe example, the `Simple Moment` example defines `c`, which is not set
in the documented equation. The actual equation contains `IFTE`
expressions, which require the fix for #1093 to work.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
We were treating negation in a special way in the expression parser.
As a result, `-a²` was parsed as `(-a)²` instead of `-(a²)`.
Treat negation like a normal prefix, generating an object, which makes
it possible to deal with precedence the right way.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When we multiply or divide unit objects, or raise a unit object to
some power, we don't want to evaluate variables in the unit.
For example, if we have `1_N*m 2_m *`, the result should not depend on
the value of variable `m`.
Fixes: #1095
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
If the called function errors out, report that error instead of hiding
it behind `Invalid function` error.
Fixes: #1094
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `IFTE` is special in that it does not evaluate its arguments ahead
of time. For example `'IFTE(1;0;ln(0))'` should not result in an error
because of the `ln(0)` evaluation.
Fixes: #1093
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add the equation for Simple Slope from page 5-5/5-6 of the HP50G
advanced reference manual.
Refs: #1040
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The date differences evaluation is expensive, so we should avoid doing
it in `EvalEq`.
Fixes: #1092
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When we have an expression, it is useful to be able to convert all
values in it to their unit base.
Fixes: #1091
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When storing in a solver variable, we need to check that units are
compatible, but we should not change the unit selected by the user.
For example, the Simple Deflection equations example in the HP50G
advanced reference manual are given in obsolete units. We want the
units to remain as is, since it's the user's preference.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Now that we render units in variables correctly, do not remove units
and equations before solving. Instead, evaluate with units and
equations. This is a bit slower, but more precise.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When we are given a value like `1_cm/in`, it is OK to pass it as input
to the `sin` function or similar.
Fixes: #1089
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When we have an actual equation in the solver, e.g. `L=R`, then we can
make the epsilon of the solver relative to `L` or `R`.
This allows equations with large values for `L` and `R`, like the
Elastic Buckling examples given, to solve correctly (i.e. without a
`Sign reversal` error message) with the default settings.
Fixes: #1088
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When we compute powers for units with numerical results on, we may end
up with decimal powers in units for no reason.
Spotted by displaying the result of an `EvalEq` with `FIX 2`.
Fixes: #1086
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When parsing an expression that contains parenthese, which could be
interpreted as a complex number, check if this is indeed a complex
number or if this is just a real number.
Fixes: #1084
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Fix an off-by-one in the check for end of stack in the interactive
stack editor, so that we can swap the last two levels.
Fixes: #1067
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
We need to make sure that we have a chance to evaluate correctly
before actually evaluating each side.
Fixes: #1078
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add support for a "transient object" to be shown for context.
This object will be hidden the next time the stack is redrawn.
That way, we only see the equation when it's useful.
Fixes: #1077
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The solver and other operations return tagged objects.
It's practical that conversion functions accept to operate on them.
Fixes: #1076
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When we are given inputs that have units, make sure that we convert
them to the proper units before solving.
Fixes: #1075
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Now, For an expression like `Expr1=Expr2`, the result is given as
another equation `Left=Right+Delta`, which is a much more readable way
to present the result.
Fixes: #1074
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
If an expression contains something like `P_m`, it indicates that `P`
is a variable with a default unit of `m`. It does not mean that we
should evaluate `P` and apply `m` as a unit afterwards.
So when we have a variable name like that:
- Skip unit application during evaluation
- Skip unit rendering in text and graph mode, unless editing
Fixes: #1075
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
It is legitimate for the `file_closer` to be used on a file that could
not open (e.g. the file does not exist).
The `file_closer` must avoid trying to get the position or reopening
the file in that case.
Fixes: #1071
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
In practice, it's more useful to have vectors of values show
vertically by default. This is notably true for the results of
`EvalEq` when there is a left, right and diff result.
Fixes: #1069
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Select the solver menu when we have a library equation, as it's the
most appropriate tool for that type of object.
Fixes: #1068
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This release focuses on the equation solver, notably in interaction
with the equation library. The goal is to get one step closer to the
equation library in the HP50G, including the ability to have graphical
illustration and multiple equations.
**Features**
* doc: Add documentation for the equation library
* doc: Add images from HP50G equation library (to be used later)
* doc: Some help for the elastic buckling equations.
* equations: Accept lists of equations in library
* help: Add documentation for the various constants
* help: Do not exit help when opening URLs or missing topics
* lists: Add a setting to evaluate list as programs
* menu: Add menu entries for solver imprecision and iterations
* solver: Add support for multiple equation solving
* ui: Add settings to hide/show empty menus and clear menu on EXIT
* units: Add flow units (per user request) in Fluid section of units
**Bug fixes**
* blitter: Adjust the right margin
* blitter: Base horizontal adjust on scanline, not width
* characters: Display correct content for built-in menus
* constants: Close current file while parsing values
* constants: Update some outdated values
* doc: Show help for equations and constants
* help: Do not try to load PNG images
* rewrites: Avoid contradictory rules when reordering constants
* solver: Work correctly with units (when in variables but not equation)
**Improvements**
* build: Shorten the size of the version abbrev
* config: Use config files only for user configuration
* doc: Record performance data about unit conversion
* help: Avoid slowing down when scrolling through pages of help
* help: Record position for history even without a `\n`
* simulator: Add tweak to show RPL object details
* tests: Increase wait time for tests with blinking cursor
* units: Do not simplify while in unit mode
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
In order to save space, moved all fluid-related units to the `Fluids`
menu.
Fixes: #1060
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
For constant and equations menus, match the index in the help file.
Fixes: #1039Fixes: #1048
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Grabbed images from the HP50G advanced reference manual and converted
them to BMP format so that we can show them on DB48X in the help file.
Fixes: #1034
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The HP50G equation library contains equations list, e.g. the
Elastic Buckling set of 4 equations.
Make sure that NextEq and the solver behave correctly with those.
Fixes: #1063
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Parsing the values may require opening another file (units/ constants)
Close it before trying to parse anything.
Fixes: #1062
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add the possibility for the solver to contain a list of equations.
The `NextEq` command rotates the equation list.
Add the `EvalEq` command to evaluate the equation.
Add `EvalEq` and `NextEq` to the solving menu.
Fixes: #1050
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>