gomefun2 wrote: ↑Sun May 17, 2020 4:37 pm

I was looking at the WP43 code. It looks like it is written in C.

Indeed, it is.

gomefun2 wrote: ↑Sun May 17, 2020 4:37 pm

I was looking at the functions, for example, "cos.c".

I am not a professional programmer by any means, though I am curious how you are doing this. The only thing you #include is a reference to the wp34s file. None of these files contain the c library math.h. I'm guessing this means you are not using it?

Why?

is math.h bloated or slow?

Is it only because this is a microcontroller with limited space? If you had more space would you use the math.h library? does the math.h library not work with the higher precision DM43?

The hardware is quite fast:

The processor is a ST32L476 controller and is a Core: Arm® 32-bit Cortex®-M4 CPU.

The CPU runs at 25MHz when on battery power (1x CR2032 coin cell) or at 80MHz when drawing power from the USB port.

There is also enough space for calculations.

This is not the limiting factor.

The mathematical functions build upon the work done for the WP-34S project:

https://sourceforge.net/projects/wp34s/
We work with 34 and for some calculations 39 digit precision.

Math.h works on doubles, which have 15 digit precision.

So yes, math.h is not precise enough for our goal.

Cos is calculated using Taylor series.

gomefun2 wrote: ↑Sun May 17, 2020 4:37 pm

Also, for some of the more complex functions, such as the solver or integrator, how do you choose which algorithm to use?

The solver has not been build yet. So we can use any solution possible.

In general, with the solver you enter a function as a program into the calculator.

The solver then tries to find the points where the function is zero.

If you want to solve x^2 +5x = 5, for example, you first rearrange the formula to search for zero, so: x^2 +5x - 5 = 0

You can then enter this as the following program:

[ENTER]

[X^2]

[X><Y]

5 * 5 - +

The solver will generate values for the x register, run the program and tries to find the x where the program returns zero.