programming a piecewise function on the 48 G - Printable Version +- HP Forums ( https://archived.hpcalc.org/museumforum)+-- Forum: HP Museum Forums ( https://archived.hpcalc.org/museumforum/forum-1.html)+--- Forum: Old HP Forum Archives ( https://archived.hpcalc.org/museumforum/forum-2.html)+--- Thread: programming a piecewise function on the 48 G ( /thread-19474.html) |

programming a piecewise function on the 48 G - Fernando Leyton - 06-30-2002
I'm taking a first calculus course at Paris VI and i want to programm a piecewise function on the HP 48 calculator.
F(x)= 3x if x<-5
I programmed:
But i don't get the numeric result, only the algebraic expression corresponding to the input domain?
Re: programming a piecewise function on the 48 G - Ellis Easley - 06-30-2002
Maybe you need to press "-> NUM"?
Re: programming a piecewise function on the 48 G - Rupert (Northern Italy, EU) - 06-30-2002
> But i don't get the numeric result, only the algebraic expression
<< ---> X << CASE 'X < -5' THEN '3*X' EVAL END
--
Re: programming a piecewise function on the 48 G - Vieira, Luiz C. (Brazil) - 06-30-2002
Hi;
Just to know: does the final expression, when evaluated, return the expected result? If so, a single ->NUM after the last END is enough, because all possible CASEs return an algebraic expression. Say, you could try: « -> X(the ->NUM can also come between both » and »). If you wanna try an RPL solution (no need of a ->NUM adding): « -> X(I know you did not ask for it, but I am a compulsive RPL programmer... my shrink said so.)
Hope you have success.
Re: programming a piecewise function on the 48 G - Arnold Steekelenburg - 07-01-2002
Hi Fernando, Another way is this: Type in: 'F(X)=IFTE(X<-5,3*X,IFTE(X>-5 AND X<0,X/2-5,EXP(X)))'
Then press left-shift STO (= Define) Type a value and press the softkey for F and this will be evaluated immediately. Right-shift F will give you the program the HP48 has created as a result of the DEFinition. IFTE = short IF THEN ELSE
Using this construction you can plot piecewise functions too. |