HP Forums
Solve App and Piecewise function - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Solve App and Piecewise function (/thread-4974.html)



Solve App and Piecewise function - cclinus - 10-20-2015 12:43 PM

Hello,

I try to solve two equations in Solve App.
E1: E=C MOD 5
E2: F=PIECEWISE(E not equal 0,E,E==0,5)
[attachment=2677]
Then in Num view, uncheck C and enter C=5 and press Solve.
The answer of E is 0, OK
But, the answer of F is also 0, Wrong.
F is supposed to be 5.
[attachment=2678]
Did I do anything wrong?


RE: Solve App and Piecewise function - parisse - 10-21-2015 07:15 AM

You can not expect to solve these kind of systems/equations with a numeric solver (and it is not supported by the exact solver and won't be).


RE: Solve App and Piecewise function - cclinus - 10-21-2015 09:19 AM

Hi ,

Thanks for your reply!
If the Solve App allow user to solve multi equations, I will expect it can solve these equations.

See another example. If I modify the equations to as follows, the Solver work perfectly.
[attachment=2685]
[attachment=2686]

Sorry for my poor English.


RE: Solve App and Piecewise function - parisse - 10-22-2015 08:08 AM

You are wrong:-)
I can not add safeguards everywhere because that would disable using the calc for legitimate systems. If for example I returned an error as soon as the user enters a discontinuous fonction, then you would not be able to solve a system at a continuous solution with a function having discontinuities.
The user is assumed to be the brain and the calc is assumed to compute.


RE: Solve App and Piecewise function - cclinus - 10-22-2015 01:46 PM

Ok, but, why the second example work well?

Do you mean you make the Solve app? Or I misunderstand your meaning?

By the way, did you read my another post about solver , ABS() and IP().
I more concern that problem, because solver give wrong answer under some condition.

thanks!


RE: Solve App and Piecewise function - Han - 10-22-2015 04:08 PM

(10-22-2015 01:46 PM)cclinus Wrote:  Ok, but, why the second example work well?

In the second example, your piecewise function consists of two functions that are each continuous on either half-open or half-closed intervals. In the first example, your piecewise function has a piece that is nowhere continuous.

A lot of numerical solving algorithms tend to use some sort of Newton process, which requires that the auxiliary function for the system to be continuous over some interval. As an example,

2x+3y = 5
5x-4y = 1

This system is equivalent to solving \( \vec{F}(x,y) = 0 \) where
\[ \vec{F}(x,y) = \begin{bmatrix} 2x+3y-5 \\ 5x-4y-1 \end{bmatrix} \]

Generally speaking, the zeroes of \( \vec{F}(x,y) \) can be estimated by Newton's method; however \( \vec{F} \) must be differentiable (and hence continuous) near the zero. This is why systems with piecewise functions where the solution itself occurs at a point of discontinuity will likely never be found by numerical methods (that use Newton-like processes).