Hp50g emu : graph abs(x)^3 gives negative y-values - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: Hp50g emu : graph abs(x)^3 gives negative y-values (/thread-16041.html) |
Hp50g emu : graph abs(x)^3 gives negative y-values - Gil - 12-11-2020 09:07 PM On my EMU48, I want to graph the function y=abs(x)^3. But for negative x-values it gives negative y-values on the graph and also for F6-Table. Strange, because executing on the stack 'abs(x)' ENTER -5 ENTER 'x' STO EVALUATE gives the right answer 125 (and not -125). On my real HP 48 Gx calculator, the graph is correct for negative x, when writing y=abs(x)^3. What should I check to get positive / symmetric graph for y, like a U-shape, and not a wrong S-shape? Thanks for your help. Gil RE: Hp50g emu : graph abs(x)^3 gives negative y-values - 3298 - 12-11-2020 10:17 PM Simplification of ABS(X) to X? Looks like a \<< -119. CF \>> situation to me... RE: Hp50g emu : graph abs(x)^3 gives negative y-values - Gil - 12-11-2020 10:20 PM The same strange behavior in graphing or F6-Table occurs when writing the function as y=x^3 × sign(x). RE: Hp50g emu : graph abs(x)^3 gives negative y-values - Gil - 12-11-2020 10:23 PM You found the solution. I could not believe that a HP could present a such a "bug". Many thanks. Regards, Gil RE: Hp50g emu : graph abs(x)^3 gives negative y-values - grsbanks - 12-12-2020 02:33 PM Can it be classified as a bug when it's there for all to see in the documentation? Quote:-119 Rigorous mode Page C-8 of the AUR. Why one would want to simplify \(abs(x)\) to \(x\) in the first place is another matter. It does simplify things if you know that \(x\) is always going to have the same sign in the domain you're looking at, but if that is the case then why consider \(abs(x)\) in the first place... RE: Hp50g emu : graph abs(x)^3 gives negative y-values - Gil - 12-12-2020 02:48 PM You are right regarding my possible, wrong labelling or questioning, but the thing is that my first reflex was to partake my indue surprise. Regards and thanks for your quick insight. Regards, Gil RE: Hp50g emu : graph abs(x)^3 gives negative y-values - grsbanks - 12-12-2020 02:57 PM (12-12-2020 02:48 PM)Gil Wrote: You are right regarding my possible, wrong labelling or questioning Don't worry, it's not your sanity that I was questioning. I was wondering why HP would want to add that specific feature! RE: Hp50g emu : graph abs(x)^3 gives negative y-values - Gil - 12-12-2020 11:09 PM Anyway, for my instinctive, poor knowledge, it's not clear why when - 119 flag is set to "rigorous off" y=ABS(X) gives, in the stack, "correctly" +5 when X is equal to -5, whereas it is drawn like X = -5, or y=ABS(X)^3 gives, in the stack, "correctly" +125 when X is equal to -5, whereas it is drawn for a y-value = X^3 = -125. I do not see the point of having that flag with two different behaviours according to the context : - stack, programs —> absolute value taken into account ; - graphics —> absolute not taken into account. I wish I could use the existing flag in a concrete, useful case. Gil RE: Hp50g emu : graph abs(x)^3 gives negative y-values - franz.b - 12-14-2020 08:51 AM it's the same if you just draw or calculate abs(x) ... RE: Hp50g emu : graph abs(x)^3 gives negative y-values - Gil - 12-14-2020 09:17 AM No, at least not in my EMU48 Android application : two different behaviours, as mentioned, when Rigorous mode is OFF ( -119 flag is set to 1). Again, in other words : -119 SF ENTER -5 'X' STO then a) Graph will show point (-5,-5) [a negative part of y=f(x)], and not (-5,+5), but b) ABS(X) ENTER EVALUATE will give a positive number (+5). Well, when -119 is set, I would expect the same result in both cases a) and b). Or did I miss something? RE: Hp50g emu : graph abs(x)^3 gives negative y-values - franz.b - 12-14-2020 10:20 AM perhaps I was too concise in my contribution. I meant that the behavior is the same with ABS (x), you don't need the "^ 3". The problem is: why is the graph drawn wrong with the "rigorous" off mode? (besides the -119 flag the "rigorous" mode can also be changed from the CAS menu) RE: Hp50g emu : graph abs(x)^3 gives negative y-values - Gil - 12-14-2020 10:38 AM As a previous contributors on this forum made me understand, the graph behavior is consistent with the state flag. The question is why two DIFFERENT behaviours when -119 flag is set, I. e. "not rigorous" mode is on for a) stack/programme calculation b) drawing graphs. a) For stack/programme calculation : absolute value taken into account, indepently of - 119 flag status. b) And for drawing : absolute value not taken into account when - 119 is set. I don't argue the individual issue of the result, but I wish somebody could explain to me the difference of treatment between a) and b). Regards, Gil RE: Hp50g emu : graph abs(x)^3 gives negative y-values - ramon_ea1gth - 12-14-2020 02:07 PM (12-14-2020 10:38 AM)Gil Wrote: The question is why two DIFFERENT behaviours Flag -119 controls symbolic operations with the CAS. I find it interesting when doing symbolic simplifications on the stack or in a program and using parameters with a physical meaning. For example, the voltage across the terminals of an R-L series circuit can be written as: w·L·Ip·sin(w·t)+R·Ip·cos(w·t) Let’s consider that all the symbols in this expression are always positive (or zero) in practical applications. In fact, Ip is the amplitude of the current across the circuit. We want to rewrite that expression into something more compact like cos(w·t + phase). Let’s have the HP 50g in Real & Exact mode on (-103 CF -105 CF):
RE: Hp50g emu : graph abs(x)^3 gives negative y-values - Gil - 12-14-2020 03:46 PM Nice explanation and example. Remains the unexplained different behaviour — with non-rigorous option — when a) drawing graphs or when b) using the abs function directly on the stack/within programs. Regards, Gil RE: Hp50g emu : graph abs(x)^3 gives negative y-values - 3298 - 12-14-2020 09:57 PM I guess the graphing code tries to simplify the equation you throw at it. I haven't actually checked the code, but it wouldn't surprise me ... after all, the equation needs to be evaluated numerically over and over, for different values of X, so simplifying it might give it a nice performance boost if the equation is needlessly complex. Then the flag -119 thing would be nothing more than a side effect of re-using the existing simplification routines in CAS. RE: Hp50g emu : graph abs(x)^3 gives negative y-values - Gil - 12-14-2020 10:08 PM A "pitfall" that makes sense. Thank you. |