HP Forums
[CAS] Potential Bug with given (|). [SOLVED] - 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: [CAS] Potential Bug with given (|). [SOLVED] (/thread-7127.html)



[CAS] Potential Bug with given (|). [SOLVED] - CH3791 - 10-30-2016 02:19 AM

Good evening/morning to the good folk at HP,
For some maths questions, I have to restrict the domain. So I use the given symbol (|) in CAS. I would have something like:
solve(x^2-8=0,x)|(x>0)
That works perfectly.

But when I add another condition like so:
solve(x^2-8=0,x)|((x>0) AND (x<10))
The calculator creates a CAS variable called x, in the form of a matrix. And from this point on, the variable x will always have the "temporary" domain imposed onto it.
solve(x^2-8=0,x) will start to return 2*root(2) only.
solve(x+3=0,x) will give [].
and so on.

Unless this is an actual feature, can you guys fix this bug ASAP. Because I can already imagine how dangerous this would be for examinations...


RE: [CAS] Potential Bug with given (|). - Mark Hardman - 10-30-2016 05:03 PM

This would appear to be by design. The CAS system is converting the compound given statement into the following explicit assumptions:

assume(x>0) -> x
additionally(x<10) -> x

This creates the following permanent assumptions on x:

about(x) -> assume[[],[line[0,10]],[0,10]]

Which provides the correct solution:

solve((x^2-8) = 0,x) -> {2*√2}

To avoid future use of the assumptions on x, they must be purged:

purge(x) -> assume[[],[line[0,10]],[0,10]]
about(x) -> x

Mark Hardman


RE: [CAS] Potential Bug with given (|). - Nigel (UK) - 10-30-2016 07:28 PM

(10-30-2016 05:03 PM)Mark Hardman Wrote:  This would appear to be by design. The CAS system is converting the compound given statement into the following explicit assumptions:

assume(x>0) -> x
additionally(x<10) -> x

This creates the following permanent assumptions on x:

about(x) -> assume[[],[line[0,10]],[0,10]]

Which provides the correct solution:

solve((x^2-8) = 0,x) -> {2*√2}

To avoid future use of the assumptions on x, they must be purged:

purge(x) -> assume[[],[line[0,10]],[0,10]]
about(x) -> x

Mark Hardman

If this is intentional I think it is a bad idea. I think of the "|" operator as making a temporary assignment to a variable or applying a temporary restriction and I suspect that most people would feel this way too.

TI CAS calculators have got a menu function that clears single-character variable names (a-z). It would be a good idea to advise users to implement their own such function on the Prime, and to use it regularly! Thanks to CH3791 for pointing out this potential pitfall.

Nigel (UK)


RE: [CAS] Potential Bug with given (|). - parisse - 10-30-2016 07:37 PM

Well spotted, I'm fixing that in giac source.


RE: [CAS] Potential Bug with given (|). - CH3791 - 10-30-2016 11:27 PM

Wow... guys... Seeing this genuinely put a smile onto my face. Time and time again, you have read over my queries (no matter how stupid they may be), and within a day have come up with an awesome response! For me as a highschool student, it was quite a gamble to move from the Casio Classpad to this mysterious, high-powered machine, but so far everything has played out flawlessly.

Part of that of course, is due to the hospitality of this community and I can't thank you guys enough for that.


RE: [CAS] Potential Bug with given (|). [SOLVED] - compsystems - 11-03-2016 12:17 PM

Alphabetic variables capitalized does not work.

solve(X^2-8 = 0,X) | X>0 AND X<10; [enter] {-2*√(2),2*√(2)}
about(X); [enter] 0

now

x:=foo; [enter] ...
solve(x^2-8 = 0,x) | x>0 AND x<10; [enter] {2*√(2)} // This should display a message that says the "contents of the variable x will be deleted" [yes/no] or "error x is not empty" otherwise, it causes of data loss or overwriting
x; [enter] x =(