[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-math] input files, functions
From: |
Martin Rubey |
Subject: |
Re: [Axiom-math] input files, functions |
Date: |
Mon, 13 Dec 2004 19:46:45 +0100 |
Dear Constantine,
I tried your files, but it seems to me that they do work, in fact.
Given the two files
--testkinemat1.input
)read expandsincos.input
Acon := matrix([[1, 0, Lo2*cos(phi)+Lo1*sin(phi), -sin(delta1)*a, 0, 0, 0],_
[0, 1, Lo2*sin(phi)-Lo1*cos(phi), a*cos(delta1), 0, 0, 0],_
[0, 1, Lo2*sin(phi)+Lo1*cos(phi), 0, a*cos(delta1), 0, 0],_
[1, 0,-Lo2*cos(phi)+Lo1*sin(phi), 0, 0, -sin(delta2)*a, 0],_
[0, 1,-Lo2*sin(phi)-Lo1*cos(phi), 0, 0, a*cos(delta2), 0],_
[1, 0,-Lo2*cos(phi)-Lo1*sin(phi), 0, 0, 0, -sin(delta2)*a],_
[0, 1,-Lo2*sin(phi)+Lo1*cos(phi), 0, 0, 0, a*cos(delta2)]])
detAcon:=determinant(Acon)
--detAcon:=factor(detAcon)
detAcon:=expandsincos(detAcon)
detAcon:=simplify(detAcon)
-- expandsincos.input
-- Basic trigonometric expansion rules for axiom.
-- cos(2*x) == cos(x)**2 - sin(x)**2
expandsincos := rule (sin(x+y) == sin(x)*cos(y) + sin(y)*cos(x); _
cos(x+y) == cos(x)*cos(y) - sin(x)*sin(y); _
sin(2*x) == 2*sin(x)*cos(x); _
cos(2*x) == cos(x)*cos(x) - sin(x)*sin(x));
typing
)read testkinemat1.input
does what is expected. Note that there must not be a semicolon after the
filename!
> (1) I am trying to read expandsincos.input from within
> testkinemat1.input but this gives an error. Not clear why ??
I suspect that the error was something like
The file expandsincos.input; is needed but does not exist.
> (3) I tried to write the script testkinemat1.input like a function
> without input or output variables (see below) but this gave
> errors. Not clear why ??
No! )read is a system command, not a "usual" operation. Sytem commands always
start with a ")". I believe that the want to be quite on their own, one per
line.
> (4) Any examples of how to write user functions calling other user
> functions, etc would be much appreciated. Especially the case
> where a function can return multiple variables eg. in matlab:
>
> [x1,x2,x3] = func1(y1,y2,y3);
This just means that func1 is a function that returns a list. For example
(9) -> f:=(a,b,c)+->[a,b,c,a+b+c]
Loading /home/martin/axiom/mnt/linux/algebra/ANON.o for domain
AnonymousFunction
(9) (a,b,c) +-> [a,b,c,a + b + c]
Type: AnonymousFunction
(10) -> f(1,2,3)
(10) [1,2,3,6]
Type: List PositiveInteger
> (5) In axiom what is the instruction to "pause" after the execution of
> a line, and continue after hitting enter ? eg in matlab:
> a = 1
> pause;
> b = 3
> pause;
Sorry, I don't know. Quite possible that such a thing does not exist.
All the best,
Martin
PS: do you use the Windows or Linux version?