Post Reply 
Advanced Graphing error?
12-31-2016, 05:47 PM
Post: #1
Advanced Graphing error?
The advanced graphing app plots 2 curves for X<0 for sin(x^(abs(-cos x))). I'm in radian mode. I'm under the impression that the function is defined only for multiples of pie for X<0. Should the advanced graphing app be drawing any full curves for X<0?
Find all posts by this user
Quote this message in a reply
01-02-2017, 05:37 AM
Post: #2
RE: Advanced Graphing error?
Hello,

sin(x^(abs(-cos x))) is not an advanced grapher expression. Do you mean sin(x^(abs(-cos x)))<0 or something like that?

it would help if you posted 2 screen shots. One of the symb view and one of the plot view.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
01-02-2017, 02:28 PM
Post: #3
RE: Advanced Graphing error?
I defined that function to equal Y as advanced graphing app requires. I was surprised that 2 full curves were plotted for X<0. It plotted as expected with 1 curve for X>0. I believe that no real curves exist for X<0. Individual defined points should exist for X<0 such as -pie, -2*pie, but no full curves...
Find all posts by this user
Quote this message in a reply
01-02-2017, 05:27 PM
Post: #4
RE: Advanced Graphing error?
The sin part is not essential, nor the - sign before the cos.

So we can study y=x^|cos(x)|.
Its behaviour is strange indeed, because it is impossible to have 2 y-values belonging to the same x value.

Moreover, when we study for example y=x^0.63 it gives no values for negative x.

In general x^|cos(x)|, for negative numbers is a complex number, and we can plot its absolute value: |x^|cos(x)||, which is real.

When we do this it turns out to plot the y-positive branch of our first function.
Because the plot of y=x^|cos(x)| is symmetric with respect to the x-axis it apparently plots for y its absolute value and its negative.

I think this is a bug.
Find all posts by this user
Quote this message in a reply
01-03-2017, 07:55 AM
Post: #5
RE: Advanced Graphing error?
Hello,

I think that I know what is happening.

indeed, in the general case, X^Y is complex when X<0 and Y is not a rational.

HOWEVER, please remember that the advanced graphing does not treat pixels as 'points', but as 'areas'... And since Z is dense in R, in any area, there is an infinity of rational numbers. Hence, for any given pixel with X<0, this pixel will represent an infinity of rational numbers. And these rational numbers will have both positive and negative real roots (depending if the numerator is odd or even).

This is why you are seeing the 2 graphs in the X<0 space.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
01-03-2017, 03:32 PM
Post: #6
RE: Advanced Graphing error?
I was guessing that this was what was happening...not sure if I'm happy about it or not! It's technically correct, but...

Thanks!
Find all posts by this user
Quote this message in a reply
01-03-2017, 06:30 PM
Post: #7
RE: Advanced Graphing error?
(01-03-2017 07:55 AM)cyrille de brébisson Wrote:  Hello,

I think that I know what is happening.

indeed, in the general case, X^Y is complex when X<0 and Y is not a rational.

HOWEVER, please remember that the advanced graphing does not treat pixels as 'points', but as 'areas'... And since Z is dense in R, in any area, there is an infinity of rational numbers. Hence, for any given pixel with X<0, this pixel will represent an infinity of rational numbers. And these rational numbers will have both positive and negative real roots (depending if the numerator is odd or even).

This is why you are seeing the 2 graphs in the X<0 space.

Cyrille
There is logics in this.

But strange is that y=x^(1/3) shows no graph for x<0 whereas y=x^cos(1) shows a double sided graph for x<0.

y=(-2)^(1/3) shows no line, y=³√-2 does not show a line either, but y=(-2)^cos(1) shows 2 lines and the numeric equivalent (-2)^0.540302305868 shows again no line.
Find all posts by this user
Quote this message in a reply
01-03-2017, 08:10 PM
Post: #8
RE: Advanced Graphing error?
Excellent example...Y=X^(1/3) and Y=3root X both demonstrate this behavior. I think that I have been puzzled on earlier occasions with behavior such as this.
Find all posts by this user
Quote this message in a reply
01-04-2017, 06:31 AM
Post: #9
RE: Advanced Graphing error?
Hello,

Both X^COS(1)=Y and X^(1/3)=Y show up for X<0 here for me in the advanced grapher:
   

Showing up in the normal function plotter is another issue.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
01-04-2017, 03:51 PM
Post: #10
RE: Advanced Graphing error?
X<0 part of the x^(1/3) plot does not show on my physical Prime device.
Find all posts by this user
Quote this message in a reply
01-06-2017, 06:52 PM
Post: #11
RE: Advanced Graphing error?
The results I mentioned in post #7 I obtained in the Advanced Graphing app, firmware version 11226, on my Android tablet.

As already pointed out defining (-1)^1/3 as (-1)^1/3= -1 has some serious disadvantages.
I will outline it once more.
When we follow the kind of reasoning which leads to this definition, (-1)^0.3333 would not exist, even though it differs only slightly from (-1)^1/3 because 0.3333=3333/10000, which is a fraction with an even denominator and an odd numerator, in which case the exponential would not exist.

On the other hand (-1)^(3334/10001) would exist, but is not –1 but +1.

So with this definition (-1)^a is not defined for general real numbers, nor for general rational numbers, but only on a subset of the rational numbers, Q, and the function is extremely discontinuous at every point.

This is not something which we like.

A mathematically more satisfying way is the complex definition, which makes use of the imaginary unit i, which satisfies the equation i*i= -1.

In that case the definition is:
(-1)^a=cos(π *a)+i*sin(π *a)

Now we have no discontinuities, and (-1)^a is defined for every a in R (even for every a in C)

This definition makes sense because when a in Z we get:
(-1)^n= cos(π *n)+i*sin(π *n)= cos(π *n)=(-1)^n, which is what we want.

Moreover it satisfies the exponential rule
(-1)^a * (-1)^b=(-1)^(a+b)

because
(-1)^a * (-1)^b=[cos(π *a)+i*sin(π *a)]* [cos(π *b)+i*sin(π *b)]=
[cos(π *a)* cos(π *b)- sin(π *a)* sin(π b)]+i*[ cos(π a)* sin(π b)+ sin(π a)* cos(π *b)]=
cos(π*(a+b))+i*sin(π*(a+b))=(-1)^(a+b)

We can now define the exponential for a general negative base as:
(-b)^a=(-1)^a * b^a.
Find all posts by this user
Quote this message in a reply
01-06-2017, 08:32 PM
Post: #12
RE: Advanced Graphing error?
Good explanation, of course.

Why does it not plot for X<0 when the expression is written Y=3Root X ? I was hoping the the CAS would recognize this, and plot both sides. I'm puzzled since the regular graph environment can handle this properly...I don't understand why both graphing apps don't plot the full plot. (This on physical device, latest publicly available version).
Find all posts by this user
Quote this message in a reply
01-09-2017, 06:01 PM
Post: #13
RE: Advanced Graphing error?
I think that this is a bug.
I do not have the impression that the Advanced Graphing app uses the CAS very much or at all.

But we can easily correct it by replacing 3Root(x) with SIGN(x)*3Root(ABS(x))

When you just want to plot the function y=3Root(x) you could also use
(X<0 AND y=-3Root(-x)) OR (x>=0 AND y=3Root(x))

Or
x=y^3

When we only want to plot functions the Function app is better.
The Advanced Graphing app is very good in plotting complicated relations between x and y, but the Function app can do some things it can not do.

For example, you can write a program which defines a function and you can let the Function app plot it.

The Function app can also deal with complex numbers.
Of course it can not plot complex numbers, but it can plot its real or imaginary part, like RE(1/(x+i)) or IM(1/(x+i)). Also ABS(1/(x+i))

It does this very nice with y=(-1)^x
It plots this function correctly by only plotting the discrete points at positions (2n,1) and (2n+1,-1).
When we check the complex checkbox in Home settings we can also plot RE( (-1)^x), which gives a COS graph, IM( (-1)^x), which gives a SIN graph and ABS( (-1)^x) which gives a straight line.
Find all posts by this user
Quote this message in a reply
01-10-2017, 08:44 PM
Post: #14
RE: Advanced Graphing error?
I am still puzzled about two curves being plotted for the function that I first mentioned: Y=sin (X^ABS(-cos X)).

For X=-1.05, for example, I can see how f(X)=~-.85449. Why is a second curve plotted, symmetrical to the X axis plotted with f(X)=~+.85449?

Intuitively, how would the second positive value be correct?
Find all posts by this user
Quote this message in a reply
01-11-2017, 07:27 PM
Post: #15
RE: Advanced Graphing error?
The reasoning is:

cos(-1.05)=0.497
So ABS(-cos(-1.05))=0.497
0.497≈498/1001

(-1.05)^( 498/1001)= (1.05)^( 498/1001)=1.024
sin(1.024)=0.854
Find all posts by this user
Quote this message in a reply
01-11-2017, 09:18 PM
Post: #16
RE: Advanced Graphing error?
My Prime and CASIO fx-CG10 both show (-1.05)^(498/1001)=-1.02457..., and show the same if I take -1.05^498, and then take 1001root of that answer. What is really odd to me is that 498 is even, and should produce the answer that you are reporting!

Is this a bug, or am I missing something, and both the positive and negative answers are correct, yielding both values when taking the sin (the double plot for X<0)?
Find all posts by this user
Quote this message in a reply
01-11-2017, 11:02 PM
Post: #17
RE: Advanced Graphing error?
I see what I was doing on the Prime and CASIO...I needed to put it as (-1.05)^(498/1001) instead of -1.05^(498/1001).

This results in the expected positive result.

In the advanced graphing, I'm guessing that I am seeing the positive and negative curves for X<0 due to infinitely close together even and odd roots based upon whether or not the 12th decimal point (or is it looking at a 15th digit) is odd or even. This would then be a correct plot as long as the user realized that it is not a continuous function for X<0.
Find all posts by this user
Quote this message in a reply
04-05-2017, 07:46 AM
Post: #18
RE: Advanced Graphing error?
The Advanced Graphing App is designed around real (not complex) arithmetic.

As surmised, the Advanced Graphing App allows (does not treat as uniformly undefined) applications of the power operator with negative bases and non-integer fractional exponents. Here is a labelled plot of y=x^x. (GrafEq and the Advanced Graphing App employ similar techniques and have code in common.)

Fundamental improvements to these sorts of plots are, of course, possible. I've implemented some experimental graphing engines which do produce richer plots for these sorts of "curves" but have yet to release any of them to the general public.

Even ignoring such fundamental improvements, there are still some 'i's to dot and 't's to cross when it comes to the Advanced Graphing App.
Find all posts by this user
Quote this message in a reply
04-05-2017, 11:17 AM
Post: #19
RE: Advanced Graphing error?
(04-05-2017 07:46 AM)jte Wrote:  The Advanced Graphing App is designed around real (not complex) arithmetic.

As surmised, the Advanced Graphing App allows (does not treat as uniformly undefined) applications of the power operator with negative bases and non-integer fractional exponents. Here is a labelled plot of y=x^x. (GrafEq and the Advanced Graphing App employ similar techniques and have code in common.)

Fundamental improvements to these sorts of plots are, of course, possible. I've implemented some experimental graphing engines which do produce richer plots for these sorts of "curves" but have yet to release any of them to the general public.

Even ignoring such fundamental improvements, there are still some 'i's to dot and 't's to cross when it comes to the Advanced Graphing App.

The graph of x^x is quite misleading. How would such a graph be useful? It appears continuous but is nowhere continuous; it is a function but does not look like a function due to the density of (ir)rationals.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 3 Guest(s)