## 1400 Reputation

18 years, 47 days
University of Twente (retired)
Enschede, Netherlands

My "website" consists of a Maple Manual in Dutch

## Make a list of Matrices...

```with(LinearAlgebra):
Ck := [ seq( RandomMatrix(4,4), i=1..6 ) ];```

makes a list of six 4×4-matrices, Ck[1], ... Ck[6].

If you have a similar list P of matrices, a matrix product is

`Ck[i] . P[j];`

(not Ck[i] * P[j] )

## What is NewLambda supposed tot be?...

Your program is calculating several values for the variable NewLambda, and in each step is is overwritten by the new value.
Perhaps you mean a Matrix?

`NewLambda := Matrix(18,18):for i from 1 to 17 dofor j from 2 to 18 do NewLambda[i,j] := (Lambda[i,i]-Lambda[j,j])/2;end doend do;NewLambda;`

## more aliases...

`alias( f = f(x+y, z+y),    f[xx] = D[1, 1](f)(x+y, z+y),    f[xy] = D[1, 2](f)(x+y, z+y),    f[yy] = D[2,2](f)(x+y, z+y) ,    f[x] = D[1](f)(x+y, z+y),    f[y] = D[2](f)(x+y, z+y) );`

## What is the problem?...

Perhaps your TeX-machine can't find the stylefile maplestd2e.sty?

## Use flag Z for complex numbers...

`format := "%+03.1f %+04.2Zf %+04.2f \n":`

## Typo?...

In the first equation you have the conflicting ICs (D(x))(0) = 0 and (D(x))(0) = v0
The second must be (D(y))(0) = v0, I suppose

## Write the differential equation in the r...

• Write the differential equation in the right way:
`  diff(phi(zeta),zeta) = psi(zeta),   diff(psi(zeta),zeta) = phi(zeta)/alpha + beta*phi(zeta)^3/(3*alpha*c)`
indicating that φ amd ψ are the dependent variables and ζ the independent variable
(Choose Tools → Options → Display → Input Display: Maple Notation to get full control over your input)
• Assign a numerical value to the parameters α β and c
• Give some initial points in the phase plane
• Perhaps ?DEplot is better in this instance

## fprintf...

With no more information on the nature of Record(...) I can only refer to ?fprintf

## As parametric plots...

plot( [[x,2*x^2,x=-1/2..0], [x,1/2-x,x=-1/2..0],
[x,1/2-2*x^2,x=0..1/2], [x,x^2-1,x=0..1/2]] );

## Formatting columns...

Format list for each column of the matrix:

```formats := "%+03.1f %+5.3e %+07.4f \n":
```

(mind the newline character at the end)

```B := convert(A,listlist):
for i to nops(B) do fprintf( terminal, formats, op(B[i]) ) end do:
```

## two ways...

First possibility: you want to plot the derivative of x'(t), that is to say: the derivative of a numeric procedure. I suppose that odeplot is not designed for that. So use the option output=listprocedure:

```sol3 := dsolve({DE1, DE2, ICs}, numeric, output=listprocedure );
v := subs(sol3,diff(x(t),t));
st := time(): plot(D(v),0..3); T := time() - st;
```

Faster is to calculate timeseries for x(t) and v(t) and use a(t) from the differential equation:

```solve( DE1, diff(diff(x(t), t), t) ): subs( {m(t)=m, x(t)=x, diff(x(t),t)=v}, % ):
a := unapply( %, t,m,x,v );     #acceleration as a function of t, m, x and x'
sol2 := dsolve({DE1, DE2, ICs}, numeric, output=Array([seq(i,i=0..3,0.001)]) );
# sol2 has two parts: a list with the names of the variables and a matrix of calculated values
plot( <sol2[2,1][1..-1,1]|a~(seq(sol2[2,1][1..-1,i], i=1..4))> );
```

## typo?...

You have two times " = 0 ", so

`solve([eq1,eq2],[x,y]);`

## Not directly with DEplot or odeplot...

If you want to use the option coords = polar, then you must use the "normal" plot-command, to plot r(theta).

`q1 := dsolve( {sys1, theta(0)=Pi, r(0)=2}, numeric, output=listprocedure);`

This gives you numeric procedures for r(t) and theta(t).

```Theta := subs(q1,theta(t)): R := subs(q1,r(t)):
plot( [R(t),Theta(t),t=0..10], coords=polar, axiscoordinates=polar );

```

## Table or list?...

The second argument of writedata must be of type {set, hfarray, list, matrix, array(1), list(list)}, and L is a table. But the result of evaluating a table is its name, and not its content (to get this, you must do: eval(L);) and that is wthe error message seems to say that L has no value.

I think the type "table" is not what you want, because a table consists of a set of indices and a set of corresponding entries, and that is probably not what you want to store.

To make L a list (for example):

`L := [seq(i^2, i=1..3)];`

If you really want to write the table, that is: both the indices and the corresponding entries, do:

`LL := [seq( [i,L[i]], i in op~( [indices(L)] ) )];`

Mind the tilde in the op-command.

## accuracy...

Use the option gridrefine=6 or so in,implicitplot, and be patient

 First 23 24 25 26 27 Page 25 of 27
﻿