Post Reply 
NewRPL: Complex Numbers in Cartesian Form r[x,y] , ...
03-27-2017, 01:31 PM (This post was last modified: 03-27-2017 01:35 PM by Claudio L..)
Post: #11
RE: NewRPL: Complex Numbers in Cartesian Form
(03-27-2017 06:50 AM)Han Wrote:  I imagine that creating a new object type (library) -- perhaps "symbolic complex" -- would be the "least complex" approach rather than to try to overload the current complex number object.

Do you mean an object that holds 2 symbolic expressions? Then we'd have to move terms that from one symbolic expression to the other depending on whether they have an 'i' or not?

If we were to create such object, then it should be generic: like a vector with N symbolic expressions, where the first column is always the real part, and each column has an associated complex unit vector (i,j,k...).
Operations would be defined as vectors, but at the end, the terms would have to be analyzed looking for the unit vectors i,j,k, and their products, then move terms from one expression to the others based on what we believe the result should be (???).
For example:
| 'x+1' , 'x/2' | could be such a vector.

Then if 'x' is 'a+b*i', the replacement would become:
| 'a+b*i+1' , '(a+b*i)/2' |
and the system would have to (automatically?) move the terms, knowing that i^2=-1:
| 'a+1-b/2' , 'a/2' |

However, this doesn't quite work because 'a' or 'b' could also be complex.
Questions arise:
How do we provide the "rules" for the complex unit vectors? are they fixed in the system or the user should be able to define them freely?

Perhaps instead of creating a new object, this should be an optional "pretty print-like" display for symbolic expressions.
Internally, the expression is still one single symbolic expression with a sum of terms. This way the CAS would process the expression normally, then the automatic simplification step would have to apply the algebra rules (i^2=-1, i*j=...) and finally factor the symbolic complex units out of the terms, then group them together:
(r1+r2+r3)+i*(im1+im2+im3)+j*(jm1+jm2+jm3...)

That pre-processing would remove the CAS work out of the compiler, which would simply (decompile and) display each group of terms as a separate expression in vector form:

| (r1+r2+r3) , (im1+im2+im3) , (jm1+jm2+jm3...) |

Still, this doesn't answer how a complex number would "expand itself" into the complex expression upon EVAL.
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-27-2017 01:31 PM



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