# Evaluate 'symbolic'/expanded in Maple

When I write

'x(t)'=c[1]*exp(0*t)*(cos(omega*t)*<0,1>-sin(omega*t)*<-1,0>)+c[2]*exp(0*t)*(sin(-omega*t)*<0,1>+cos(-omega*t)*<1,0>);


in Maple, it gets evaluated and outputted in a 'concatenated' vector although I rather want it to output it as I wrote

$$x(t) = c_1 e^t \left(\cos(\omega t) \begin{pmatrix}0 \\1\end{pmatrix}-\ldots\right)$$

I'm not sure if it's possible but I image there is a function to 'evaluate as unevaluated' (:-D) instead of outputting

$$x(t) = \begin{pmatrix}c_1 \cdot e^t \cdot \cos(\omega t) \cdot 0 - \ldots \\ \ldots\end{pmatrix}$$

as it does now.

I have already tried expand(%) but it doesn't behave as I've described.

If I enclose the input in ', it almost does as I want; however, it doesn't evaluate $e^0=1$ and it prints everything in a 'single line' instead of in vector format.

One easy and straightforward way is the use . instead of *. This merges well with doing other linear algebra with Matrix and Vectors. I'd usually choose this approach.

(I'm using plaintext output mode, so as to embed results here. But in regular 2D Output it looks even nicer. I'll include the input prompts and the echo'd output, below.)

> restart:

> EQd := 'x(t)' = c[1]*exp(0*t)*(cos(omega*t) . <0,1>-sin(omega*t) . <-1,0>)
+ c[2]*exp(0*t)*(sin(-omega*t) . <0,1>+cos(-omega*t) . <1,0>);

/                 /[0]\                    /[-1]\\
EQd := x(t) = c[1] |(cos(omega t)) . |[ ]| - (sin(omega t)) . |[  ]||
\                 \[1]/                    \[ 0]//

/                 /[ 0]\                    /[1]\\
+ c[2] |(sin(omega t)) . |[  ]| + (cos(omega t)) . |[ ]||
\                 \[-1]/                    \[0]//

> simplify(EQd);

[c[2] cos(omega t) + c[1] sin(omega t) ]
x(t) = [                                      ]
[-c[2] sin(omega t) + c[1] cos(omega t)]


The reason that the instances of . in the example above do not multiply through is that the symbolic coefficient might possibly (in general) turn out to become itself a Vector or Matrix. So it doesn't multiply through (as if it were a scalar) unless you "ask".

Another way to get the effect you want is to utilize an inert operator (which you intend to mean multiplication). That's what Jacque's answer shows, with the &* operator. That answer has the nice aspect that it allows for in-fix notation, similar to what * allows.

But it would be much nicer if the inert operator approach had a few extra bells and whistles. For example, you could write your own print/&* procedure which made the output look like it used the usual multiplication symbol. And you could write another convenient procedure which would (only) turn the inert form into the active form,and evaluate.

And that is what the InertForms package new to Maple 18 tries to provide.

restart:
with(InertForm):

EQa := 'x(t)' = c[1]*exp(0*t)*(%*(cos(omega*t),<0,1>)-%*(sin(omega*t),<-1,0>))
+ c[2]*exp(0*t)*(%*(sin(-omega*t),<0,1>)+%*(cos(-omega*t),<1,0>)):

Display(EQa);

Value(EQa);


I have removed the output from the above, because the result from the Display(EQa) call is a marked out objects that typesets well in the Maple Std GUI. It shows a gray * as the multiplication symbol. And the Value command is the mechanism to get the active evaluated form , which produces the same results as you originally had. I don't know of an easy way to use this approach with a nice infix syntax.

Yet another way to get a similar effect (while in the Maple Std GUI) is to author the equation in 2D Input mode, where the unevaluated input shows the marked up and prettyprinted form. Using the Vector input palette you can get the Vectors in your nice vertically prettyprinted form. And of course the multiplications have not yet been carried through. So 2D Input can make the math formula look nice. And using a full colon at the end of the line prevents the printing of the evaluated result. But there is a difference: in this approach the output has the expanded, evaluated, multiplication results as its actual value.

You can sort-of do it with inert multiplication, as follows:

'x(t)'=c[1]*exp(0*t)*(cos(omega*t)&* <0,1>-sin(omega*t)&* <-1,0>)+c[2]*exp(0*t)*(sin(-omega*t)&* <0,1>+cos(-omega*t)&* <1,0>);


the result is not particularly pretty, but it is certainly much closer to what you want.