Post Reply 
NewRPL: Complex Numbers in Cartesian Form r[x,y] , ...
03-18-2017, 07:15 PM
Post: #6
RE: NewRPL: Complex Numbers in Cartesian Form
(03-17-2017 03:20 AM)Han Wrote:  I am not particularly sold on the benefits of being able to enter a "symbolic complex expression." For the same reason that multiplication should always be explicitly required, I believe that symbolic complex expressions should be entered as a+i*b; note here that I did not state that a and b had to be real values! This form merely factors out an 'i' wherever it is known to be an explicit factor.

In both cases (implicit multiplication and symbolic (a,b) form), there are too many ambiguous cases. I will just provide one example for each case... For implicit multiplication, should x(a+1) be x*(a+1) or should it be considered the evaluation of a function named x at an input of a+1? For complex expressions, how does one interpret x*(a,b)? Is that a scalar x multiplied with the complex number a+i*b? How would we know that x isn't itself a complex variable? If (hypothetically) x=(c,d)=c+i*d, then clearly x*(a,b) = (x*a, x*b) would be wrong because x*a would not be a real-valued expression. On the other hand, if x is a real number, then (x*a,x*b) would be exactly right. Even the expression (a,b) itself would be ambiguous. What if someone later stores c+i*d into a... then (a,b) would make no sense -- prior to storing anything into a, the real part of (a,b) would be a. On the other hand, as soon as we store c+i*d into a, then the real part of (a,b) is no longer a. Then there is the question of whether (a,b) should be a complex, symbolic type, or its own type? And which "type" has priority? I.e. given that there are already complex and symbolic type, when a user types in (a,b) should it be parsed as a symbolic object, or complex object? Just this question alone is a difficult programming problem in my opinion.

You completely got the picture. It's a mess and it's best to avoid it. However, I'm not sure yet there's a way to avoid the mess. For example a simple (innocent) expression like 'X+1' when X is the complex (a,b) replaces into the expression as '(a+i*b)+1', this means the complex number (a,b) would have to "convert" itself into a symbolic expression ('a+i*b') when EVAL is called within a symbolic. But how does EVAL know that X is being EVAL'ed within a symbolic expression or by itself in the stack?
Also, we have polar complex numbers, which would have to convert themselves to 'a*exp(i*b)', including the conversion of b from different angle systems to radians.
Perhaps we could avoid this conversion if we allow the complex object to live as a complex number inside the symbolic, perhaps simply with a "visual trick" that displays 'a+i*b' or 'a*exp(i*b*PI/180)' when decompiling the symbolic, but the object remains unchanged.
This has bad consequences when trying to simplify expressions, as the individual parts of the complex number won't be "seen" by the CAS, and also can't be separated unless the complex object number is broken in parts.

So it's a very complicated subject (I should say a *complex* subject).
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: NewRPL: Complex Numbers in Cartesian Form - Claudio L. - 03-18-2017 07:15 PM



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