HP Forums
Replacing "x" is not right! - 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: Replacing "x" is not right! (/thread-8721.html)



Replacing "x" is not right! - Spybot - 07-22-2017 10:21 PM

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]


RE: Replacing "x" is not right! - Tim Wessman - 07-23-2017 12:11 AM

Have a value in x? (would assume not, but just thought I'd ask)


RE: Replacing "x" is not right! - roadrunner - 07-23-2017 12:22 AM

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.

-road


RE: Replacing "x" is not right! - Spybot - 07-23-2017 01:45 AM

Hello Tim!
Actually I don't have a value stored in "x". I double checked that.


RE: Replacing "x" is not right! - Spybot - 07-23-2017 01:57 AM

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. 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.


RE: Replacing "x" is not right! - parisse - 07-23-2017 07:42 AM

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())


RE: Replacing "x" is not right! - Carlos295pz - 07-23-2017 08:17 AM

I think the problem can be simple.
[Image: 35711777160_8401bdff27_o.png]


RE: Replacing "x" is not right! - DrD - 07-23-2017 12:03 PM

(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


RE: Replacing "x" is not right! - chazzs - 08-02-2017 10:45 PM

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

CHUCK


RE: Replacing "x" is not right! - Spybot - 08-04-2017 02:49 AM

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.


RE: Replacing "x" is not right! - Spybot - 12-12-2017 04:21 PM

Finally this issue has been fixed in this new FW 13217. Thank you parisse!


RE: Replacing "x" is not right! - webmasterpdx - 12-13-2017 01:59 AM

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


RE: Replacing "x" is not right! - webmasterpdx - 12-13-2017 02:07 AM

never mind....I found it above the Units key.....has a x|x choice....


RE: Replacing "x" is not right! - Rudi - 12-31-2017 02:36 PM

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