|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 | Next > |
|
|
Axiom: Printing multiple variables in axiom.In the function below, I tried to use the following commands )display value Acon print(['Acon = Acon]) to print one or more variable. However, I get very strange behaviour and error messages, so had to comment them out. There might be a bug somwhere in my program. If an axiom expert could implement a simplified version of the Maxima display() function (probably a lisp function) in lisp/axiom, then this would be very useful. In Maxima: x1:1; x2:2; x3:3; display(x1,x2,x3); -> x1 = 1 x2 = 2 x3 = 3 Any assistance would be appreciated. TIA C. Frangos. testkinemat1 == --)read expandsincos.input Acon := matrix([[1 , 0 , Lo1*sin(phi) , -sin(phi)*a , 0 , 0 , 0 , 0 , 0],_ [0 , 1 , -Lo1*cos(phi) , a*cos(phi) , 0 , 0 , 0 , 0 , 0],_ [1 , 0 , -Lo1*sin(phi) , 0 , -a*sin(phi), 0 , 0 , 0 , 0],_ [0 , 1 , Lo1*cos(phi) , 0 , a*cos(phi) , 0 , 0 , 0 , 0],_ [1,0,-Lc*cos(phi)+Lo1*sin(phi),0,0,0,-a*sin(phi)*cos(delta3)_ -a*cos(phi)*sin(delta3),0,0],_ [0,1,-Lc*sin(phi)-Lo1*cos(phi),0,0,0,a*cos(phi)*cos(delta3)_ -a*sin(phi)*sin(delta3),0,0],_ [1,0,-Lc*cos(phi)-Lo1*sin(phi),0,0,(-2*sin(phi)*Lo1*sin(delta3)-sin(phi)*_ Lc*cos(delta3)-cos(phi)*Lc*sin(delta3))*a/sqrt(4*Lo1^2*sin(delta3)^2+_ 4*Lo1*sin(delta3)*Lc*cos(delta3)+Lc^2*cos(delta3)^2+Lc^2*sin(delta3)^2),0,0,0 ],_ [0,1,-Lc*sin(phi)+Lo1*cos(phi),0,0,a*(2*cos(phi)*Lo1*sin(delta3)+_ cos(phi)*Lc*cos(delta3)-sin(phi)*Lc*sin(delta3))/sqrt(4*Lo1^2*sin(delta3)^2+_ 4*Lo1*sin(delta3)*Lc*cos(delta3)+Lc^2*cos(delta3)^2+Lc^2*sin(delta3)^2),0,0,0 ],_ [0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , -k]]) pause() Acon := map(simplify,Acon) --)display value Acon -- print('Acon = Acon) print(Acon) pause() rankAcon := rank(Acon) -- print('rankAcon = rankAcon) print(rankAcon) pause() Acone := rowEchelon(Acon) --)display value Acone -- print('Acone = Acone) print(Acone) pause() Aconnull := nullSpace(Acon) --)display value Aconnull -- print('Aconnull = Aconnull) print(Aconnull) pause() Aconnullity := nullity(Acon) --)display value Aconnullity -- print('Aconnullity = Aconnullity) print(Aconnullity) _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Axiom: Printing multiple variables in axiom.Constantine Frangos <cfrangos@...> writes:
> In the function below, I tried to use the following commands > > )display value Acon > print(['Acon = Acon]) > > to print one or more variable. > > However, I get very strange behaviour and error messages, so had to comment > them out. There might be a bug somwhere in my program. > > If an axiom expert could implement a simplified version of the Maxima > display() function (probably a lisp function) in lisp/axiom, then this would > be very useful. > > In Maxima: > > x1:1; > x2:2; > x3:3; > display(x1,x2,x3); -> > x1 = 1 > x2 = 2 > x3 = 3 Well, axiom functions always evaluate all it's arguments first. So, for debugging I usually use output ["x1: ", x1, " x2: ", x2] If you want cleaner output, you'll have to look into OutputForm. For example, to print a string without the quotes, you can use message$OUTFORM: (1) -> message("1")$OUTFORM (1) 1 Type: OutputForm At least for expressions there is a way to quote and unquote, but I don't have it present right now. Martin _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Axiom: Printing multiple variables in axiom.On 11/8/07, Constantine Frangos <cfrangos@...> wrote:
> > In the function below, I tried to use the following commands > > )display value Acon > print(['Acon = Acon]) > > to print one or more variable. > > However, I get very strange behaviour and error messages, so had to comment > them out. There might be a bug somwhere in my program. > ... What do you mean by "strange behaviour"? Do you mean for example the error message: (12) -> print('Aconnull = Aconnull) There are 3 exposed and 0 unexposed library operations named equation having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op equation to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation. Cannot find a definition or applicable library operation named equation with argument type(s) Variable Aconnull List Vector Expression Integer Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. ------ This error should be expected since you are trying to produce an equation (which like everything in Axiom must have a type) between two things of quite different kind. I cannot think of any equation which has Variable on one side and List on the other. You might try to construct something of type: Equation Polynomial Integer For example (1) -> x=1 (1) x= 1 Type: Equation Polynomial Integer In this equation both sides of this equation can be considered Polynomials. In this case maybe you want to create an equation of type: Equation List Vector Expression Integer Like this: [['Aconnull]] = Aconnull Now the lefthand side can be interpreted as a 'List Vector Expression Integer' so the expression print([['Aconnull]] = Aconnull) is ok. Maybe you should not be trying to create an equation just to print a result? Probably output("Aconnull =", Aconnull) is more like you intended to do. The command )display values is a command. As such it is not intended to be used inside of a function definition such as testkinemat1 == --)read expandsincos.input Acon := matrix([[1 , 0 , Lo1*sin(phi) , -sin(phi)*a , 0 , 0 , 0 , 0 , 0],_ [0 , 1 , -Lo1*cos(phi) , a*cos(phi) , 0 , 0 , 0 , 0 , 0],_ ... as you wrote above. Why are you writing? testkinemat1 == This does not make sense to me in your code. Are you intending to use this name testkinemat1 for some purpose later? This is not the usual way in which one would use a definition like this. Perhaps you can explain what you really want to do with this code. If you forget about trying to define the function testkinemat1, then you can use )display values in the normal way in the rest of you code because this is just a series of expressions and command to be evaluated. This works fine for me. Regards, Bill Page. _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Axiom: Printing multiple variables in axiom.Hi Martin, Thanks for the reply. I tried your suggestion and this works perfectly - the inverted commas are ok. I tried your suggestion from a previous email to get axiom expressions in the form: 2*x1 instead of 2x1. However, I get an error for the example below. C. Frangos. (9) -> y (9) -> (9) cos(x2) + 2x1 Type: Expression Integer (10) -> unparse(y)::OUTFORM There are no exposed library operations named unparse but there is one unexposed operation with that name. Use HyperDoc Browse or issue )display op unparse to learn more about the available operation. Cannot find a definition or applicable library operation named unparse with argument type(s) Expression Integer Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. (10) -> On Friday 09 November 2007 20:41, Martin Rubey wrote: > Constantine Frangos <cfrangos@...> writes: > > In the function below, I tried to use the following commands > > > > )display value Acon > > print(['Acon = Acon]) > > > > to print one or more variable. > > > > However, I get very strange behaviour and error messages, so had to > > comment them out. There might be a bug somwhere in my program. > > > > If an axiom expert could implement a simplified version of the Maxima > > display() function (probably a lisp function) in lisp/axiom, then this > > would be very useful. > > > > In Maxima: > > > > x1:1; > > x2:2; > > x3:3; > > display(x1,x2,x3); -> > > x1 = 1 > > x2 = 2 > > x3 = 3 > > Well, axiom functions always evaluate all it's arguments first. So, for > debugging I usually use > > output ["x1: ", x1, " x2: ", x2] > > If you want cleaner output, you'll have to look into OutputForm. For > example, to print a string without the quotes, you can use message$OUTFORM: > > (1) -> message("1")$OUTFORM > > (1) 1 > Type: > OutputForm > > At least for expressions there is a way to quote and unquote, but I don't > have it present right now. > > Martin -- Constantine Frangos, Pr.Eng. Professor Dept. of Mathematics and Statistics University of Johannesburg Auckland Park Kingsway Campus P O Box 524 Auckland Park Johannesburg 2006 South Africa Tel: +27-11-559-2452 Fax: +27-11-559-2832 e-mail: cfrangos@... , cfrangos@... _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Axiom: Printing multiple variables in axiom.Thanks for the detailed response - much appreciated. The clarifications on compatible axiom types for lhs/rhs of equations etc are most helpful. output("Acon = ", Acon) is more straightforward. I am using an axiom function definition testkinemat1 == in order to add function parameters later. Regards, C. Frangos. On Saturday 10 November 2007 04:54, Bill Page wrote: > On 11/8/07, Constantine Frangos <cfrangos@...> wrote: > > In the function below, I tried to use the following commands > > > > )display value Acon > > print(['Acon = Acon]) > > > > to print one or more variable. > > > > However, I get very strange behaviour and error messages, so had to > > comment them out. There might be a bug somwhere in my program. > > ... > > What do you mean by "strange behaviour"? Do you mean for example the > error message: > > (12) -> print('Aconnull = Aconnull) > There are 3 exposed and 0 unexposed library operations named > equation having 2 argument(s) but none was determined to be > applicable. Use HyperDoc Browse, or issue > )display op equation > to learn more about the available operations. Perhaps > package-calling the operation or using coercions on the arguments > will allow you to apply the operation. > > Cannot find a definition or applicable library operation named > equation with argument type(s) > Variable Aconnull > List Vector Expression Integer > > Perhaps you should use "@" to indicate the required return type, > or "$" to specify which version of the function you need. > > ------ > > This error should be expected since you are trying to produce an > equation (which like everything in Axiom must have a type) between two > things of quite different kind. I cannot think of any equation which > has Variable on one side and List on the other. You might try to > construct something of type: > > Equation Polynomial Integer > > For example > > (1) -> x=1 > > (1) x= 1 > Type: Equation Polynomial Integer > > In this equation both sides of this equation can be considered Polynomials. > > In this case maybe you want to create an equation of type: > > Equation List Vector Expression Integer > > Like this: > > [['Aconnull]] = Aconnull > > Now the lefthand side can be interpreted as a 'List Vector Expression > Integer' so the expression > > print([['Aconnull]] = Aconnull) > > is ok. > > Maybe you should not be trying to create an equation just to print a > result? > > Probably > > output("Aconnull =", Aconnull) > > is more like you intended to do. > > The command > > )display values > > is a command. As such it is not intended to be used inside of a > function definition such as > > testkinemat1 == > --)read expandsincos.input > Acon := matrix([[1 , 0 , Lo1*sin(phi) , -sin(phi)*a , 0 , 0 , 0 , 0 , 0],_ > [0 , 1 , -Lo1*cos(phi) , a*cos(phi) , 0 , 0 , 0 , 0 , 0],_ > ... > > as you wrote above. Why are you writing? > > testkinemat1 == > > This does not make sense to me in your code. Are you intending to use > this name testkinemat1 for some purpose later? This is not the usual > way in which one would use a definition like this. Perhaps you can > explain what you really want to do with this code. > > If you forget about trying to define the function testkinemat1, then you > can use > > )display values > > in the normal way in the rest of you code because this is just a > series of expressions and command to be evaluated. This works fine for > me. > > Regards, > Bill Page. -- Constantine Frangos, Pr.Eng. Professor Dept. of Mathematics and Statistics University of Johannesburg Auckland Park Kingsway Campus P O Box 524 Auckland Park Johannesburg 2006 South Africa Tel: +27-11-559-2452 Fax: +27-11-559-2832 e-mail: cfrangos@... , cfrangos@... _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Axiom: Printing multiple variables in axiom.Constantine Frangos <cfrangos@...> writes:
> Hi Martin, > > Thanks for the reply. I tried your suggestion and this works perfectly - the > inverted commas are ok. > > I tried your suggestion from a previous email to get axiom expressions in the > form: 2*x1 instead of 2x1. why do you want to coerce the result of unparse (which is a string) to OUTFORM? Note that unparse takes something of type InputForm, so you'll have to coerce y to INFORM before passing it to unparse. The error message is telling you exactly this. Martin > (9) -> y > (9) -> > (9) cos(x2) + 2x1 > Type: Expression Integer > (10) -> unparse(y)::OUTFORM > There are no exposed library operations named unparse but there is > one unexposed operation with that name. Use HyperDoc Browse or > issue > )display op unparse > to learn more about the available operation. > > Cannot find a definition or applicable library operation named > unparse with argument type(s) > Expression Integer > > Perhaps you should use "@" to indicate the required return type, > or "$" to specify which version of the function you need. > (10) -> > > > > > On Friday 09 November 2007 20:41, Martin Rubey wrote: > > Constantine Frangos <cfrangos@...> writes: > > > In the function below, I tried to use the following commands > > > > > > )display value Acon > > > print(['Acon = Acon]) > > > > > > to print one or more variable. > > > > > > However, I get very strange behaviour and error messages, so had to > > > comment them out. There might be a bug somwhere in my program. > > > > > > If an axiom expert could implement a simplified version of the Maxima > > > display() function (probably a lisp function) in lisp/axiom, then this > > > would be very useful. > > > > > > In Maxima: > > > > > > x1:1; > > > x2:2; > > > x3:3; > > > display(x1,x2,x3); -> > > > x1 = 1 > > > x2 = 2 > > > x3 = 3 > > > > Well, axiom functions always evaluate all it's arguments first. So, for > > debugging I usually use > > > > output ["x1: ", x1, " x2: ", x2] > > > > If you want cleaner output, you'll have to look into OutputForm. For > > example, to print a string without the quotes, you can use message$OUTFORM: > > > > (1) -> message("1")$OUTFORM > > > > (1) 1 > > Type: > > OutputForm > > > > At least for expressions there is a way to quote and unquote, but I don't > > have it present right now. > > > > Martin > > -- > Constantine Frangos, Pr.Eng. > Professor > Dept. of Mathematics and Statistics > University of Johannesburg > Auckland Park Kingsway Campus > P O Box 524 > Auckland Park > Johannesburg 2006 > South Africa > > Tel: +27-11-559-2452 > Fax: +27-11-559-2832 > e-mail: cfrangos@... , cfrangos@... _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Axiom: Printing multiple variables in axiom.I am getting the result below for y. However, the output I actually want is: "cos(x2) + 2*x1" or even better, cos(x2) + 2*x1 Is this possible ? Regards, C. Frangos. (42) -> y (42) -> (42) cos(x2) + 2x1 Type: Expression Integer (43) -> unparse(y::INFORM) (43) -> (43) "DCOS(x2)+2*x1" Type: String (44) -> unparse(y::INFORM)::OUTFORM (44) -> (44) "DCOS(x2)+2*x1" Type: OutputForm (45) -> On Saturday 10 November 2007 13:11, Martin Rubey wrote: > Constantine Frangos <cfrangos@...> writes: > > Hi Martin, > > > > Thanks for the reply. I tried your suggestion and this works perfectly - > > the inverted commas are ok. > > > > I tried your suggestion from a previous email to get axiom expressions in > > the form: 2*x1 instead of 2x1. > > why do you want to coerce the result of unparse (which is a string) to > OUTFORM? Note that unparse takes something of type InputForm, so you'll > have to coerce y to INFORM before passing it to unparse. The error message > is telling you exactly this. > > Martin > > > (9) -> y > > (9) -> > > (9) cos(x2) + 2x1 > > Type: Expression > > Integer (10) -> unparse(y)::OUTFORM > > There are no exposed library operations named unparse but there is > > one unexposed operation with that name. Use HyperDoc Browse or > > issue > > )display op unparse > > to learn more about the available operation. > > > > Cannot find a definition or applicable library operation named > > unparse with argument type(s) > > Expression Integer > > > > Perhaps you should use "@" to indicate the required return type, > > or "$" to specify which version of the function you need. > > (10) -> > > > > On Friday 09 November 2007 20:41, Martin Rubey wrote: > > > Constantine Frangos <cfrangos@...> writes: > > > > In the function below, I tried to use the following commands > > > > > > > > )display value Acon > > > > print(['Acon = Acon]) > > > > > > > > to print one or more variable. > > > > > > > > However, I get very strange behaviour and error messages, so had to > > > > comment them out. There might be a bug somwhere in my program. > > > > > > > > If an axiom expert could implement a simplified version of the Maxima > > > > display() function (probably a lisp function) in lisp/axiom, then > > > > this would be very useful. > > > > > > > > In Maxima: > > > > > > > > x1:1; > > > > x2:2; > > > > x3:3; > > > > display(x1,x2,x3); -> > > > > x1 = 1 > > > > x2 = 2 > > > > x3 = 3 > > > > > > Well, axiom functions always evaluate all it's arguments first. So, > > > for debugging I usually use > > > > > > output ["x1: ", x1, " x2: ", x2] > > > > > > If you want cleaner output, you'll have to look into OutputForm. For > > > example, to print a string without the quotes, you can use > > > message$OUTFORM: > > > > > > (1) -> message("1")$OUTFORM > > > > > > (1) 1 > > > Type: > > > OutputForm > > > > > > At least for expressions there is a way to quote and unquote, but I > > > don't have it present right now. > > > > > > Martin > > > > -- _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Axiom: Printing multiple variables in axiom.Why do you write 'unparse(y::INFORM)' ? Do you mean you literally want
to output a ' * ' character for multiplication? If so, I think there must be a better way than this ... On 11/11/07, Constantine Frangos <cfrangos@...> wrote: > > I am getting the result below for y. > > However, the output I actually want is: > > "cos(x2) + 2*x1" > > or even better, > > cos(x2) + 2*x1 > > Is this possible ? > > Regards, > > C. Frangos. > > > (42) -> y > (42) -> > (42) cos(x2) + 2x1 > Type: Expression Integer > (43) -> unparse(y::INFORM) > (43) -> > (43) "DCOS(x2)+2*x1" > Type: String > (44) -> unparse(y::INFORM)::OUTFORM > (44) -> > (44) "DCOS(x2)+2*x1" > Type: OutputForm > (45) -> > > > On Saturday 10 November 2007 13:11, Martin Rubey wrote: > > Constantine Frangos <cfrangos@...> writes: > > > Hi Martin, > > > > > > Thanks for the reply. I tried your suggestion and this works perfectly - > > > the inverted commas are ok. > > > > > > I tried your suggestion from a previous email to get axiom expressions in > > > the form: 2*x1 instead of 2x1. > > > > why do you want to coerce the result of unparse (which is a string) to > > OUTFORM? Note that unparse takes something of type InputForm, so you'll > > have to coerce y to INFORM before passing it to unparse. The error message > > is telling you exactly this. > > > > Martin > > > > > (9) -> y > > > (9) -> > > > (9) cos(x2) + 2x1 > > > Type: Expression > > > Integer (10) -> unparse(y)::OUTFORM > > > There are no exposed library operations named unparse but there is > > > one unexposed operation with that name. Use HyperDoc Browse or > > > issue > > > )display op unparse > > > to learn more about the available operation. > > > > > > Cannot find a definition or applicable library operation named > > > unparse with argument type(s) > > > Expression Integer > > > > > > Perhaps you should use "@" to indicate the required return type, > > > or "$" to specify which version of the function you need. > > > (10) -> > > > > > > On Friday 09 November 2007 20:41, Martin Rubey wrote: > > > > Constantine Frangos <cfrangos@...> writes: > > > > > In the function below, I tried to use the following commands > > > > > > > > > > )display value Acon > > > > > print(['Acon = Acon]) > > > > > > > > > > to print one or more variable. > > > > > > > > > > However, I get very strange behaviour and error messages, so had to > > > > > comment them out. There might be a bug somwhere in my program. > > > > > > > > > > If an axiom expert could implement a simplified version of the Maxima > > > > > display() function (probably a lisp function) in lisp/axiom, then > > > > > this would be very useful. > > > > > > > > > > In Maxima: > > > > > > > > > > x1:1; > > > > > x2:2; > > > > > x3:3; > > > > > display(x1,x2,x3); -> > > > > > x1 = 1 > > > > > x2 = 2 > > > > > x3 = 3 > > > > > > > > Well, axiom functions always evaluate all it's arguments first. So, > > > > for debugging I usually use > > > > > > > > output ["x1: ", x1, " x2: ", x2] > > > > > > > > If you want cleaner output, you'll have to look into OutputForm. For > > > > example, to print a string without the quotes, you can use > > > > message$OUTFORM: > > > > > > > > (1) -> message("1")$OUTFORM > > > > > > > > (1) 1 > > > > Type: > > > > OutputForm > > > > > > > > At least for expressions there is a way to quote and unquote, but I > > > > don't have it present right now. > > > > > > > > Martin > > > > > > -- > > > _______________________________________________ > Axiom-math mailing list > Axiom-math@... > http://lists.nongnu.org/mailman/listinfo/axiom-math > _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Axiom: Printing multiple variables in axiom."Bill Page" <bill.page@...> writes:
> Why do you write 'unparse(y::INFORM)' ? Do you mean you literally want > to output a ' * ' character for multiplication? If so, I think there > must be a better way than this ... I guess that Constantine also wants 1-dimensional output. I.e., x^2 instead of 2 x But I'm not sure. Of course, the real solution would be to overwrite the coercion to OutputForm in Expression. But that's probably too much to ask for from Constantine, and I don't have the time to play around with that. Constantine, I believe that mainly the trig functions get "funny" names. You could first get a string with str := unparse(y::INFORM) and then use pos := position("DCOS", str, 1) if pos > 0 then replace(str,pos..pos+3,"cos") to replace the names you dislike. Martin _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Axiom: Printing multiple variables in axiom.On Monday 12 November 2007 08:45, you wrote: > "Bill Page" <bill.page@...> writes: > > Why do you write 'unparse(y::INFORM)' ? Do you mean you literally want > > to output a ' * ' character for multiplication? If so, I think there > > must be a better way than this ... > > I guess that Constantine also wants 1-dimensional output. I.e., x^2 instead > of > > 2 > x > > But I'm not sure. Yes, that's correct. It would be helpful to obtain one-dimensional output (ala Maxima with display2d : false) that can be pasted as is, in other axiom functions, and run correctly. > > Of course, the real solution would be to overwrite the coercion to > OutputForm in Expression. But that's probably too much to ask for from > Constantine, and I don't have the time to play around with that. > > Constantine, I believe that mainly the trig functions get "funny" names. > You could first get a string with > > str := unparse(y::INFORM) > > and then use > > pos := position("DCOS", str, 1) > if pos > 0 then replace(str,pos..pos+3,"cos") > > to replace the names you dislike. I was thinking of defining DCOS(x) == cos(x) DSIN(x) == sin(x) etc. Regards, C. Frangos. _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Axiom: Printing multiple variables in axiom.On 11/12/07, Constantine Frangos wrote:
> > On Monday 12 November 2007 08:45, Martin Rubey wrote: > > Bill Page writes: > > > Why do you write 'unparse(y::INFORM)' ? Do you mean you literally > > > want to output a ' * ' character for multiplication? If so, I think there > > > must be a better way than this ... > > > > I guess that Constantine also wants 1-dimensional output. I.e., x^2 > > instead of > > > > 2 > > x > > > > But I'm not sure. > > > Yes, that's correct. It would be helpful to obtain one-dimensional > output (ala Maxima with display2d : false) that can be pasted as > is, in other axiom functions, and run correctly. > Ok, I understand. > > > > > Of course, the real solution would be to overwrite the coercion > > to OutputForm in Expression. But that's probably too much to > > ask for from Constantine, and I don't have the time to play around > > with that. > > > ... > I was thinking of defining > > DCOS(x) == cos(x) > DSIN(x) == sin(x) > etc. > After looking at the Axiom source code I see that 'unparse' is actually internally calling functions which convert an expression in Axiom form to Fortran form. The necessary code is found here: http://wiki.axiom-developer.org/axiom--test--1/src/algebra/MkfuncSpad http://wiki.axiom-developer.org/axiom--test--1/src/interp/NewfortBoot http://wiki.axiom-developer.org/axiom--test--1/src/interp/FormatBoot But it isn't really necessary for you to understand all that. Here is a distillation of the important parts into a fairly simple function that I think probably does what you want: (1) -> output1d(e)== _ message( _ concat map(string,destruct _ fortranCleanUp( _ exp2Fort1( _ exp2FortOptimize( _ outputTran(e::INFORM)$Lisp _ )$Lisp _ )$Lisp _ )$Lisp _ ) _ )$OutputForm Type: Void (2) -> output1d(cos(x2) + 2*x1) Compiling function output1d with type Expression Integer -> OutputForm `-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead. (2) cos(x2)+2*x1 Type: OutputForm (3) -> If you would like an explanation of how this works, just ask. Regards, Bill Page. _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Axiom: Printing multiple variables in axiom.On 11/12/07, Bill Page wrote:
> > After looking at the Axiom source code I see that 'unparse' is > actually internally calling functions which convert an expression in > Axiom form to Fortran form. The necessary code is found here: > > http://wiki.axiom-developer.org/axiom--test--1/src/algebra/MkfuncSpad > http://wiki.axiom-developer.org/axiom--test--1/src/interp/NewfortBoot > http://wiki.axiom-developer.org/axiom--test--1/src/interp/FormatBoot > > But it isn't really necessary for you to understand all that. Here is > a distillation of the important parts into a fairly simple function > that I think probably does what you want: > > (1) -> output1d(e)== _ > message( _ > concat map(string,destruct _ > fortranCleanUp( _ > exp2Fort1( _ > exp2FortOptimize( _ > outputTran(e::INFORM)$Lisp _ > )$Lisp _ > )$Lisp _ > )$Lisp _ > ) _ > )$OutputForm > Type: Void > (2) -> output1d(cos(x2) + 2*x1) > Compiling function output1d with type Expression Integer -> > OutputForm > `-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead. > > (2) cos(x2)+2*x1 > Type: OutputForm > (3) -> > Oops, the version about fails for expressions like: output1d(x2/x2) because of some additional unnecessary Fortran processing by the routine 'outputTran'. Please use this slightly simpler version: (1) -> output1d(e)== _ message( _ concat map(string,destruct _ fortranCleanUp( _ exp2Fort1( _ exp2FortOptimize( _ e::INFORM _ )$Lisp _ )$Lisp _ )$Lisp _ ) _ )$OutputForm Type: Void (2) -> output1d(cos(x2) + 2*x1) Compiling function output1d with type Expression Integer -> OutputForm `-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead. (2) cos(x2)+2*x1 Type: OutputForm (3) -> output1d(x2/x1) Compiling function output1d with type Fraction Polynomial Integer -> OutputForm `-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead. (3) x2/x1 Type: OutputForm (4) -> output1d(sqrt(x1)) (4) x1**(1/2) Type: OutputForm (5) -> ------------- I have recorded this issue at: http://axiom-wiki.newsynthesis.org/401UnparseGeneratesFortranFunctionNames since I think that really this is due to a bug in 'unparse'. It really should not generate those Fortran-type names if it's purpose is really to unparse Axiom commands in such a manner that they can be re-parsed by the Axiom interpreter. At the above link I also proposed a more general solution that corrects this problem for other parts of Axiom as well. Regards, Bill Page. _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Axiom: Installing AldorFollowing the recent posting re. aldor and axiom etc, I dowloaded the aldor system file aldor-linux-i386-glibc2.3-1.0.3.bin (21051230 bytes). What program in suse linux 10.2, can be used to unpack this file ? (extension .bin is unfamiliar). I guess that there are instructions on how to compile, etc. I know aldor can do numeric computations, but its not clear whether it can also manipulate symbolic expressions, matrices, plot graphs, etc like in axiom ? TIA C. Frangos. _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Axiom: Installing AldorThat is a shell script concatenated with a .tar.gz file.
Simply say sh aldor-linux-i386-glibc2.3-1.0.3.bin Ralf On 11/13/2007 01:35 PM, Constantine Frangos wrote: > Following the recent posting re. aldor and axiom etc, I dowloaded the aldor > system file aldor-linux-i386-glibc2.3-1.0.3.bin (21051230 bytes). > > What program in suse linux 10.2, can be used to unpack this file ? (extension > .bin is unfamiliar). I guess that there are instructions on how to compile, > etc. > > I know aldor can do numeric computations, but its not clear whether it can > also manipulate symbolic expressions, matrices, plot graphs, etc like in > axiom ? > > TIA > > C. Frangos. _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Axiom: Installing AldorOn 11/13/07, Constantine Frangos wrote:
> > Following the recent posting re. aldor and axiom etc, I dowloaded the > aldor system file aldor-linux-i386-glibc2.3-1.0.3.bin (21051230 bytes). > > What program in suse linux 10.2, can be used to unpack this file ? > (extension .bin is unfamiliar). I guess that there are instructions on > how to compile, etc. This is self-extracting script file. All you have to do is run it. Usually I do the following in a linux terminal: $ chmod a+x aldor-linux-i386-glibc2.3-1.0.3.bin $ ./aldor-linux-i386-glibc2.3-1.0.3.bin Be sure to read the installation instructions. The installation is not completely automatic. > > I know aldor can do numeric computations, but its not clear whether > it can also manipulate symbolic expressions, matrices, plot graphs, > etc like in axiom ? > Yes, certainly it can. (In fact that is it's main design goal!) But keep in mind that Aldor (like Spad in Axiom) is a *compiler*, not an interpreter. This means that compiling, testing and running programs in Aldor is a little more complicated than using the Axiom interpreter. Also in some respects the libraries available for Aldor are considerably less extensive than what is available for Axiom. If you like Aldor and you also would like to continue to use Axiom as the user interface you might be interested in: http://axiom-wiki.newsynthesis.org/AldorForAxiom If you search for "Aldor" in the search box in the top right-hand corner of the page, you will also find some other examples of using Aldor in Axiom. Regards, Bill Page. _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Axiom: Installing AldorConstantine Frangos <cfrangos@...> writes:
> I know aldor can do numeric computations, but its not clear whether it can > also manipulate symbolic expressions, matrices, plot graphs, etc like in > axiom ? I think you are on the wrong track here: Aldor can (should) be used, just as SPAD, as extension language for Axiom. It's not a CAS. Martin _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Aldor: Installing AldorI installed aldor under suse 10.2 (32 bit) but am getting the following error with the test program below: aldor -Fx -laldor aldortest.as sh: gcc32: command not found #2 (Fatal Error) C compile failed. Command was: unicl -I/home/apps/aldornew/aldor/linux/1.0.3/include -c aldortest.c "aldortest.as", line 10: nfact :Integer; ^ [L10 C1] #1 (Warning) Suspicious `:'. Do you mean `local' or `default'? #1 (Warning) Removing file `aldortest.c'. #include "aldor" #include "aldorio" import from Integer; --df ==> DoubleFloat; testfact(imax:Integer):Integer == { nfact :Integer; nfact := 1; for i in 1..imax repeat { nfact := nfact*i; --stdout << "The factorial of " << i << " is " << nfact << newline; } return(nfact); } n := 200000; xfact := testfact(n); stdout << n << " factorial is :" << xfact << newline ; C. Frangos. On Tuesday 13 November 2007 15:40, Ralf Hemmecke wrote: > That is a shell script concatenated with a .tar.gz file. > > Simply say > > sh aldor-linux-i386-glibc2.3-1.0.3.bin > > Ralf _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Axiom: Printing multiple variables in axiom.Thanks for the program. I tried this program on a simple matrix (see below). I was expecting to get matrix([[x1,x2],[x3,x4]]) but the result is different. C. Frangos. (67) -> s:=matrix([[x1,x2],[x3,x4]]) (67) -> +x1 x2+ (67) | | +x3 x4+ Type: Matrix Polynomial Integer (68) -> output1d(s) (68) -> (68) matrix(construct(construct(x1,x2),construct(x3,x4))) Type: OutputForm (69) -> On Tuesday 13 November 2007 04:32, Bill Page wrote: > On 11/12/07, Bill Page wrote: > > After looking at the Axiom source code I see that 'unparse' is > > actually internally calling functions which convert an expression in > > Axiom form to Fortran form. The necessary code is found here: > > > > http://wiki.axiom-developer.org/axiom--test--1/src/algebra/MkfuncSpad > > http://wiki.axiom-developer.org/axiom--test--1/src/interp/NewfortBoot > > http://wiki.axiom-developer.org/axiom--test--1/src/interp/FormatBoot > > > > But it isn't really necessary for you to understand all that. Here is > > a distillation of the important parts into a fairly simple function > > that I think probably does what you want: > > > > (1) -> output1d(e)== _ > > message( _ > > concat map(string,destruct _ > > fortranCleanUp( _ > > exp2Fort1( _ > > exp2FortOptimize( _ > > outputTran(e::INFORM)$Lisp _ > > )$Lisp _ > > )$Lisp _ > > )$Lisp _ > > ) _ > > )$OutputForm > > Type: Void > > (2) -> output1d(cos(x2) + 2*x1) > > Compiling function output1d with type Expression Integer -> > > OutputForm > > `-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead. > > > > (2) cos(x2)+2*x1 > > Type: OutputForm > > (3) -> > > Oops, the version about fails for expressions like: > > output1d(x2/x2) > > because of some additional unnecessary Fortran processing by > the routine 'outputTran'. Please use this slightly simpler version: > > (1) -> output1d(e)== _ > message( _ > concat map(string,destruct _ > fortranCleanUp( _ > exp2Fort1( _ > exp2FortOptimize( _ > e::INFORM _ > )$Lisp _ > )$Lisp _ > )$Lisp _ > ) _ > )$OutputForm > Type: Void > (2) -> output1d(cos(x2) + 2*x1) > Compiling function output1d with type Expression Integer -> > OutputForm > `-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead. > > (2) cos(x2)+2*x1 > Type: OutputForm > (3) -> output1d(x2/x1) > Compiling function output1d with type Fraction Polynomial Integer > -> OutputForm > `-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead. > > (3) x2/x1 > Type: OutputForm > (4) -> output1d(sqrt(x1)) > > (4) x1**(1/2) > Type: OutputForm > (5) -> > > ------------- > > I have recorded this issue at: > > http://axiom-wiki.newsynthesis.org/401UnparseGeneratesFortranFunctionNames > > since I think that really this is due to a bug in 'unparse'. It really > should not generate those Fortran-type names if it's purpose is really > to unparse Axiom commands in such a manner that they can be re-parsed > by the Axiom interpreter. > > At the above link I also proposed a more general solution that > corrects this problem for other parts of Axiom as well. > > Regards, > Bill Page. > > --~--~---------~--~----~------------~-------~--~----~ > You received this message because you are subscribed to the Google Groups > "FriCAS - computer algebra system" group. To post to this group, send email > to fricas-devel@... To unsubscribe from this group, send email > to fricas-devel-unsubscribe@... For more options, visit this > group at http://groups.google.com/group/fricas-devel?hl=en > -~----------~----~----~----~------~----~------~--~--- _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Aldor: Installing AldorConstantine,
What do you see when you type ... ~> gcc --version The result should be something like: bpage@candis-admin:~> gcc --version gcc (GCC) 4.1.2 20061115 (prerelease) (SUSE Linux) ... If you do not see this, then maybe you have not installed the Gnu C (gcc) compiler as required by Aldor. Regards, Bill Page. On 11/13/07, Constantine Frangos wrote: > > I installed aldor under suse 10.2 (32 bit) but am getting the following error > with the test program below: > > aldor -Fx -laldor aldortest.as > sh: gcc32: command not found > #2 (Fatal Error) C compile failed. Command was: unicl > ... _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
|
|
Re: Axiom: Printing multiple variables in axiom.On 11/13/07, Constantine Frangos wrote:
> > Thanks for the program. > > I tried this program on a simple matrix (see below). I was expecting to get > matrix([[x1,x2],[x3,x4]]) > > but the result is different. > > C. Frangos. > > > (67) -> s:=matrix([[x1,x2],[x3,x4]]) > (67) -> > +x1 x2+ > (67) | | > +x3 x4+ > Type: Matrix Polynomial Integer > (68) -> output1d(s) > (68) -> > (68) matrix(construct(construct(x1,x2),construct(x3,x4))) > Type: OutputForm > (69) -> > You will admit I think, that this does product the required result: (1) -> matrix(construct(construct(x1,x2),construct(x3,x4))) +x1 x2+ (1) | | +x3 x4+ Type: Matrix Polynomial Integer (2) -> This is what you expected, right? The bracket [ ... ] notation in the Axiom is (usually) just a short-hand syntax sugar for the construct( ... ) operation. If you really think that the [ ... ] notation is preferrable, that could probably be arranged with a little more special coding. Regards, Bill Page. _______________________________________________ Axiom-math mailing list Axiom-math@... http://lists.nongnu.org/mailman/listinfo/axiom-math |
| < Prev | 1 - 2 | Next > |
| Free embeddable forum powered by Nabble | Forum Help |