# HP Forums

Full Version: Replacing "x" is not right!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello!

I was Confidently doing a substitution on a polynomial... the result! on both emulator & physical device are not correct. FW:11226(on Emulator) and FW:12066 (on the physical one). Is this a bug?

[attachment=5060]
Have a value in x? (would assume not, but just thought I'd ask)
Spybot,

I could be wrong, but I don't think what you used is a replacement operator. It's a constraint operator. In words you asked the calculator to tell you what x^4-x^2+5 is if x=-x. The only time x=-x is when x=0 so it stuck in 0 for x and returned 5.

You probably want subst(x^4-x^2+5,x=-x) which returns (-x)^4-(-x)^2+5.

Hello Tim!
Actually I don't have a value stored in "x". I double checked that.
That's what I'm talking about, the Prime CAS takes "x" as a zero, but I haven't assigned any numeric value to it. if I use any other variable name... like "r" or "y" it does the replacement correctly, the problem comes in when replacing the "same" variable name.
And... yes! subst() certainly gets the job done, but I think that particular "constrain operator" should do it too.
Maybe I can improve that, but not sure. It's not easy because you are doing a recursive definition (| is implemented by doing a program where the variables to be substituted are declared local and assigned to the right member of =, I will try to replace occurences of the local variable by quote())
I think the problem can be simple.
(07-23-2017 01:57 AM)Spybot Wrote: [ -> ]Hello roadrunner!
That's what I'm talking about, the Prime CAS takes "x" as a zero, but I haven't assigned any numeric value to it.

My thoughts on this topic:

x^4-2*x^3+5|x = x; // where x is not sign changed ==> 5
plotfunc((x^4-2*x^3+5|x = -x); // Suggests a result of 5 (no labels)
plotfunc((x^4-2*x^3+5|x = x); // As above...

These expressions validate that x is assumed to have a value of zero, and thus is not symbolic. However, if:

(r^4-2*r^3+5|(r = (-x))); // ==> (-x)^4-2*(-x)^3+5 the variable x remains symbolic.

Is the original expression sufficiently well described, or is the expression a matter of interpretation, where both Spybot, and Road, have correct solutions? In short, perhaps the provided result IS right, but the expression itself needs better formulation?

Dale
Try putting the -x in quotes; x='-x' and then simplify.

CHUCK
Hi CHUCK!
You're right, putting x='-x' works as expected, it even reminds me the syntax on the 48-50G calculators. thank you for this new approach.
Finally this issue has been fixed in this new FW 13217. Thank you parisse!
I noticed the use of the | character. How do you get that on the Prime? I can get it from the chars but that's a bit of an obscure way to get a character. Anyone know a quick way to get that char?
Thx
never mind....I found it above the Units key.....has a x|x choice....
Dear All
My Softwareversions:
HP Prime Graphing Calculator Software Version: 2017 11 15 (13011) BETA
and HP Connectivy Kid software version: 2017 11 15 (13012) BETA

Valid only for the CAS View!
Basically, variables may not yet be initialized.
1. This can be done either with result () or purge ({list of variables})
2. Variables can then be used in formulas.
3. Only when values have been assigned to the variables are the variables automatically replaced by their values.

[attachment=5503]

Another Example:

[attachment=5504]

A happy and healthy new year.
Rudi
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :