cancel
Showing results for
Did you mean:
Level 3
55 34 0 2
Message 1 of 7
1,344
Flag Post

Solved!

IFTE Bug HP 50g ROM 2.15

HP Recommended
HP-50g

I'm trying to plot IFTE(X<1,X,X^2) in algebraic mode it's imposible for me it's says "| Error: Bad Argument Type" how can I solve it ?

Tags (1)
6 REPLIES 6
Level 9
3,551 3,490 180 541
Message 2 of 7
Flag Post
HP Recommended

The IFTE function page 3-36 ... http://h10032.www1.hp.com/ctg/Manual/c00748644

The IFTE function is written as IFTE(condition, operation_if_true, operation_if_false) If condition is true then operation_if_true is performed, else operation_if_false is performed. For example, we can write ‘f(x) = IFTE(x>0, x^2-1, 2*x-1)’, to describe the function listed above. Function IFTE is accessible from the function catalog (‚N). The symbol ‘>’ (greater than) is available as (associated with the Y key).

To define this function in ALG mode use the command: DEF(f(x) = IFTE(x>0, x^2-1, 2*x-1)) then, press ENTER. In RPN mode, type the function definition between apostrophes: ‘f(x) = IFTE(x>0, x^2-1, 2*x-1)’ then press input DEF. Press J to recover your variable menu. The function "f" should be available in your soft key menu. Press ‚"f" to see the resulting program: << x ‘IFTE(x>0, x^2-1, 2*x-1)’ >>.

To evaluate the function in ALG mode, type the function name, f, followed by the number at which you want to evaluate the function, e.g., f(2), then press ENTER. In RPN mode, enter a number and press "f". Check, for example, that f(2) = 3, while f(-2) = -5.

Kind Regards !.
Have a nice day !.
Provost in HP Spanish Public Forum ... https://h30467.www3.hp.com/
Level 3
55 34 0 2
Message 3 of 7
Flag Post
HP Recommended

Level 6
140 139 29 60
Message 4 of 7
Flag Post
HP Recommended

I tried your example on my v2.15 50g and had the same results.  Something apparently changed in the v2.15 ROM with regards to using IFTE in an algebraic for graphs -- the exact same function on a v2.09 50g does not exhibit this behavior.

If there's an easy work-around, I didn't see it.  Here's a couple of alternatives:

1) (easiest, but ugly)  Change the equation so that IFTE isn't used.  One way this can be done is to take advantage of the fact that boolean expressions evaluate to either 0 or 1, which allows you to add both "parts" together as a single continuous function:

`((X<1)*X)+((X≥1)*X^2)instead ofIFTE(X<1,X,X^2)`

2) (harder, but much better in the long run) Change to RPN mode on your 50g and write the function as an RPN program:

```«
→ X
«      IF
X 1 <
THEN         X
ELSE         X SQ
END
»
»```

The problem seems to stem from IFTE being embedded in an algebraic object, so simply switching to RPN mode isn't good enough.  The function will still fail so long as it is written as an algebraic object (ie. a function within the 'quotes').

Hopefully others will know of a better/easier solution.

Level 9
3,551 3,490 180 541
Message 5 of 7
Flag Post
HP Recommended

Hi!, @Magnus512 :

Kind Regards !.
Have a nice day !.
Provost in HP Spanish Public Forum ... https://h30467.www3.hp.com/
Level 6
140 139 29 60
Message 6 of 7
Flag Post
HP Recommended

It appears that the Equation Writer is also part of the problem here.  If you don't mind bypassing the equation writer, there's another way to achieve this which allows you to keep the calculator in algebraic mode.  The following starts with a "factory fresh" 50g configuration (exact mode, algebraic mode, standard flag settings, etc.).

1) Create an "IFTE" expression by first opening a single quote and then typing in the expression from the keyboard:

Note: this will NOT work if you use the equation writer to create the above expression.  Typing it in directly between the opening quotes is required.  Likewise, if you later attempt to edit that expression with the equation writer, it will no longer function properly within the plotting environment.

2) Store the expression in a variable.  To keep things simple, I've used a variable name of "Q":

3) Activate the plotting environment from the "Y=" key (left-shift A):

4) Add a new equation by pressing the ADD/F2 key.  Use Q as the right side of the equation.  Press ENTER to accept:

5) Press ERASE/F5 and then DRAW/F6:

Success!

Tags (1)
Level 3
55 34 0 2
Message 7 of 7
Flag Post
HP Recommended

Works perfectly 😄 thank you n_n

† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation