(10<30@)/(15<80@)
Where < is actually an angle sign, and @ is really a degree sign. I can
enter/convert between complex (3+4i), polar (10<30@), and
radians/degrees.
My question is, where can I find documentation on doing similar
function in maxima?
Thanks!
David Logan
Try to read the maxima manual
http://maxima.sourceforge.net/docs/original/maxima_toc.html
mf
Admittedly, I have not read the manual from top to bottom, but I am not
going to. It's a lot of information that I don't need, don't
understand, and a complete waste of time. Reviewing sections that I
feel should contain the information, such as the section on "VECTORS",
I have not found the information I am seeking. I have also not found a
good searchable reference. So I still do not know how to, for example,
enter a vector as a magnitude and an angle, in degrees or radians. Or
add/subtrace/multiply/divide them, or convert them into polar values or
complex numbers. I did find "conjugate" in the VECTOR section though.
I was hoping for something more specific than a pointer to the entire
(non-searchable) manual.
David Logan
Ok, I think this should be the complex number
10*(cos(30°)+ j * sin(30°)), am I right?
You can define a function, which converts you a complex number
given by radius and angle (in degree) into the exponential form.
f(rad,deg):=rad*exp(%i*(deg*%pi/180));
Then you can type
f(10,30)/f(15/80);
and you get
4 %I %PI
- --------
%I SQRT(3) 9
2 (-- + -------) %E
2 2
-----------------------------
3
The result is correct of course, but I feel, you want to see the
complex number in rad/deg-form.
So lets define another function, which gives you radius and
phasor (in degree)[*]:
g(x):=[cabs(x),carg(x)*180/%pi];
when you want it numerically evaluated:
g2(x):=float(g(x));
So g2(f(10,30)) gets you
[10.0, 30.0]
note:
I'm not sure, if there are any other built-in commands or special packages
solving your problem in a better way, this is my first pragmatic suggestion.
Regards,
Martin
[*] Note that you should improve the definition of "g", 'cause
"carg" gets you negative results sometimes.
example: define "@" as a "degree"-Operator:
> POSTFIX("@");
> x@:=x*%pi/180;
Then you can type
> 30@;
and get
%PI
---
6
mf
I wasn't expecting a programming lesson though. I was already looking
at that option. What I was hoping was that there was already built-in
handling, like there is in my TI-89.
I'll assume from your previous posts that there is no built-in way. I
also appreciate the additional functions, carg, cabs, postfix. I hadn't
found two of them.
There are actually several ways cosines can be expressed in terms of
phasors:
A*cos(wt+p), giving A+pj or Ae^(jwt)
and back. My calculator cannot convert these directly as far as I know.
I would need to do custom programming in order to parse these and build
the alternative forms. I suspect the same would be true with Maxima, as
you provided examples of.
However, I was really looking for how Maxima would handle the complex
numbers, either rectangular (regular complex) or polar. I was looking
for operations on (which is going to be my second problem, and still
unknown how I'll do it in maxima), and conversions of, these phasors.
Examples are:
5+5j => 5sqrt(2),45degrees => 5sqrt(2),%pi/4
On my ti-89, I can do:
(5+5j) >Polar => (5sqrt(2) < 45)
(5sqrt(2) < 45) >Rect => (5+5j)
Another thing I can do on my ti-89 is this:
csolve((40-4j)*P=((5+5j)+(10<30deg)),P)
and it will return whatever P is, such as:
P=(34-2.8j)
Notice also that I can easily intermix the regular complex number
format with the polar format, and it all works.
David Logan
No one CAS is perfect.
Your problem seems not very hard to program, so maybe the
Maxima developers left it as an exercise. ;-)
Did you search the web for any third-party packages
concerning your computations?
> I'll assume from your previous posts that there is no built-in way.
I dont know. I'd never need it.
> However, I was really looking for how Maxima would handle the complex
> numbers, either rectangular (regular complex) or polar.
You can use both forms of course.
4+4*%i
vs.
4*sqrt(2)*exp(%i*%pi/4)
vs.
4*sqrt(2)*(cos(%pi/4)+%i*sin(%pi/4))
> I was looking for operations on
All this is explained in the Maxima manual.
> On my ti-89, I can do:
> (5+5j) >Polar => (5sqrt(2) < 45)
> (5sqrt(2) < 45) >Rect => (5+5j)
Use the built-ins
rectform(<expression>) and
polarform(<expression>)
to convert into rectangle resp. polar form.
Or write your own functions and operators.
It's easy.
> Another thing I can do on my ti-89 is this:
> csolve((40-4j)*P=((5+5j)+(10<30deg)),P)
> and it will return whatever P is, such as:
> P=(34-2.8j)
solve((40-4*%i)*p=(5+5*%i)+f(10,30),p);
(Where f is defined as above)
> Notice also that I can easily intermix the regular complex
> number format with the polar format, and it all works.
Of course it works in Maxima too, why shouldn't it?
I'm sure, that Maxima's power is greater than the power
of your ti.
But you should really glance through the manual.
Martin
So make me look stupid and point out where all of this is explained in
the manual. Then I will look stupid and thank you kindly. :)
David Logan
> I have *more* than "glanced through the manual". I have
> read the book, and reviewed the manual many times.
Which manual did you read?
> point out where all of this is explained in the manual.
I can't understand the problem of finding information
inside the maxima manual.
Go to the URL
http://maxima.sourceforge.net/docs/original/maxima_toc.html
you will see the table of contents of the maxima manual.
On
http://maxima.sourceforge.net/docs/original/maxima_5.html#SEC21
you can find some notes on complex numbers including
refferals to REALPART, IMAGPART, RECTFORM, POLARFORM,
ABS, CARG (the explanations you can find by using the
function index).
On
http://maxima.sourceforge.net/docs/original/maxima_4.html#SEC11
you can find explanations concerning operators.
mf
Function: DETERMINANT (M)
computes the determinant of M by a method similar to Gaussian
elimination. The form of the result depends upon the setting of the
switch RATMX. There is a special routine for dealing with sparse
determininants which can be used by setting the switches RATMX:TRUE and
SPARSE:TRUE.
OK, cool. Thus, I try:
(%i1) determinant([[10+6*%i,2-3*%i],[-5,-1+%i]]);
DETERMINANT called on a non-square matrix.
-- an error. Quitting. To debug this try DEBUGMODE(TRUE);
(%i2) determinant([[1,1],[2,2]]);
DETERMINANT called on a non-square matrix.
-- an error. Quitting. To debug this try DEBUGMODE(TRUE);
(%i3) determinant([1,1],[2,2]);
Maxima encountered a Lisp error:
Error in MACSYMA-TOP-LEVEL [or a callee]: MACSYMA-TOP-LEVEL [or a
callee] requires less than two arguments.
Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.
(%i4) determinant(((1,1),(2,2)));
(%o4) DETERMINANT(2)
(%i5) determinant(((1,1),(2,6)));
(%o5) DETERMINANT(6)
(%i6) determinant([(1,1),(2,6)]);
DETERMINANT called on a non-square matrix.
-- an error. Quitting. To debug this try DEBUGMODE(TRUE);
(%i7)
So much for the manual. This is normally my experience with the manual.
Sketchy doc, no examples, and what I would think would work never does.
You seem to be familiar with either Maxima, or CAS systems in general,
such that you don't understand how the sketchiness is difficult for
somebody unfamiliar with the software. Maybe this example will help.
David Logan
> OK, here is a great example of why I have so much trouble with the
> documentation. I want to try getting determinants of some matrices. On
> my calculator, I find the det() function, and matrices are specified in
> brackets, so I type: det([[10+6i,2-3i],[-5,-1+i]]), and viola, I get
> the answer. So I look in the Maxima manual, to see how this is done in
> Maxima. I get:
>
> Function: DETERMINANT (M)
> computes the determinant of M by a method similar to Gaussian
> elimination. The form of the result depends upon the setting of the
> switch RATMX. There is a special routine for dealing with sparse
> determininants which can be used by setting the switches RATMX:TRUE and
> SPARSE:TRUE.
...
> So much for the manual. This is normally my experience with the manual.
> Sketchy doc, no examples, and what I would think would work never does.
A reference manual is supposed to brief. Nevertheless, if you scroll
down a little (from the entry on determinants) you get the entry
on matrices:
<http://maxima.sourceforge.net/docs/original/maxima_26.html#SEC82>
Function: MATRIX (row1, ..., rown)
defines a rectangular matrix with the indicated rows. Each row
has the form of a list of expressions, e.g. [A, X**2, Y, 0] is a
list of 4 elements
...
The idea is that the Maxima book should contain more elaborate
explanations and examples, but the chapter on matrices is not
written yet:
<http://maxima.sourceforge.net/docs/maximabook/maximabook-19-Sept-2004.pdf>
Since you have a TI89, you ought to try the trial version of TI's
Derive.
<http://education.ti.com/us/product/software/derive/down/download.html>
Btw - I notice that Texas now have a new product "TI Interactive".
<http://education.ti.com/us/product/software/tii/features/features.html>
Have anyone tried it? Is so how does it compare with Derive?
--
Jens Axel Søgaard
Thanks for the info on matrix(). I would have never guessed that a
function was required to create a matrix. I guess that's why I prefer
the book to the manual. I consider the manual as a source to go when
you know what to do, but can't remember how. I consider the book as the
source to learn what you want to do.
Interesting that a matrix cannot be represented directly though.
David Logan
Hi David,
I like wmMaxima ( http://wxmaxima.sourceforge.net/index.html ),
a GUI for maxima. One 'Tip of the day' told me how to enter matrices
in a simple form:
"To enter a matrix A, type 'A : ' to input line and select
'Algebra->Enter maxtrix' from menus."
It's worth a try
--
Peter Pein
Berlin
> A reference manual is supposed to brief.
Missing examples seems to be a typical mistake that help document writers
make. Many-many man and info pages have long passages describing different
options and with no examples.
> The idea is that the Maxima book should contain more elaborate
> explanations and examples, but the chapter on matrices is not
> written yet:
Maxima primer seems to be a good place to start. In particular, it contains
a determinant example,
determinant(matrix([1,2],[3,4]));
Alec
On that last note, the only thing that I have had trouble with is the
fact that it's impossible to find information on Maxima like you can
with, say, Maple, because "maxima" is a math keyword, while "Maple"
isn't. So if you look up something like "integrals using maxima", you
get zero hits on Maxima software in the top 800,000 pages :)
David Logan
The documentation on Macsyma might be better, but don't expect
everything in the Macsyma manual to work the same way in Maxima:
<http://www.cs.berkeley.edu/~fateman/macsyma/docs/>
--
Jens Axel Søgaard
It appears on screen if you use xmaxima. Otherwise, you can find it in
xmaxima directory. The (end of the) path to it looks like
share/maxima/5.9.1/xmaxima/intro.html .
Alec