I keep getting this error although the code is running fine in maple 14 , Help is greatly appreciated Thanks alot
> restart; with(LinearAlgebra);
> A[0] := Vector(3, {(1) = 0, (2) = 0, (3) = -g});
> type(a[0], Vector);
false
> omega[0] := Vector(3, {(1) = 0, (2) = 0, (3) = 0});
> type(omega[0], Vector);
true
> alpha[0] := Vector(3, {(1) = 0, (2) = 0, (3) = 0});
> type(alpha[0], Vector);
true
> v[1] := Vector(3, {(1) = 0, (2) = 0, (3) = 0});
> type(v[1], Vector);
true
> R[0] := Matrix(3, 3, {(1, 1) = cos(theta[1](t)), (1, 2) = 0, (1, 3) = -sin(theta[1](t)), (2, 1) = sin(theta[1](t)), (2, 2) = 0, (2, 3) = cos(theta[1](t)), (3, 1) = 0, (3, 2) = -1, (3, 3) = 0});
> type(R[0], Matrix);
true
> R[1] := Matrix(3, 3, {(1, 1) = cos(theta[1](t))*cos(theta[2](t)), (1, 2) = cos(theta[1](t))*sin(theta[2](t)), (1, 3) = sin(theta[1](t)), (2, 1) = sin(theta[1](t))*cos(theta[2](t)), (2, 2) = sin(theta[1](t))*sin(theta[2](t)), (2, 3) = -cos(theta[1](t)), (3, 1) = -sin(theta[2](t)), (3, 2) = cos(theta[2](t)), (3, 3) = 0});
> type(R[1], Matrix);
true
> R[2] := Matrix(3, 3, {(1, 1) = cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)), (1, 2) = -sin(theta[1](t)), (1, 3) = -cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)), (2, 1) = sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)), (2, 2) = cos(theta[1](t)), (2, 3) = -sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)), (3, 1) = -sin(theta[2](t))*cos(theta[3](t))+cos(theta[2](t))*sin(theta[3](t)), (3, 2) = 0, (3, 3) = sin(theta[2](t))*sin(theta[3](t))+cos(theta[2](t))*cos(theta[3](t))});
> type(R[2], Matrix);
true
> R[3] := Matrix(3, 3, {(1, 1) = (cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*cos(theta[4](t))-sin(theta[1](t))*sin(theta[4](t)), (1, 2) = -(cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*sin(theta[4](t))-sin(theta[1](t))*cos(theta[4](t)), (1, 3) = -cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)), (2, 1) = (sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*cos(theta[4](t))+cos(theta[1](t))*sin(theta[4](t)), (2, 2) = -(sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*sin(theta[4](t))+cos(theta[1](t))*cos(theta[4](t)), (2, 3) = -sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)), (3, 1) = (-sin(theta[2](t))*cos(theta[3](t))+cos(theta[2](t))*sin(theta[3](t)))*cos(theta[4](t)), (3, 2) = -(-sin(theta[2](t))*cos(theta[3](t))+cos(theta[2](t))*sin(theta[3](t)))*sin(theta[4](t)), (3, 3) = sin(theta[2](t))*sin(theta[3](t))+cos(theta[2](t))*cos(theta[3](t))});
> type(R[3], Matrix);
true
> P[0] := Matrix(3, 1, {(1, 1) = 0, (2, 1) = 0, (3, 1) = d[1]+rho*sin((1/2)*theta[1](t))});
> type(P[0], Vector);
false
> P[0] := Vector(3, {(1) = 0, (2) = 0, (3) = d[1]+rho*sin((1/2)*theta[1](t))});
> type(P[0], Vector);
true
>
>
> P[1] := Vector(3, {(1) = cos(theta[1](t))*a[2]*cos(theta[2](t))-sin(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t))), (2) = sin(theta[1](t))*a[2]*cos(theta[2](t))+cos(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t))), (3) = -a[2]*sin(theta[2](t))+d[1]+rho*sin((1/2)*theta[1](t))});
> P[2] := Vector(3, {(1) = sin(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))+cos(theta[1](t))*a[2]*cos(theta[2](t))-sin(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t))), (2) = -cos(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))+sin(theta[1](t))*a[2]*cos(theta[2](t))+cos(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t))), (3) = -a[2]*sin(theta[2](t))+d[1]+rho*sin((1/2)*theta[1](t))});
> PB[3] := Matrix(3, 1, {(1, 1) = (-cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))+sin(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))+cos(theta[1](t))*a[2]*cos(theta[2](t))-sin(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t))), (2, 1) = (-sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))-cos(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))+sin(theta[1](t))*a[2]*cos(theta[2](t))+cos(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t))), (3, 1) = (sin(theta[2](t))*sin(theta[3](t))+cos(theta[2](t))*cos(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))-a[2]*sin(theta[2](t))+d[1]+rho*sin((1/2)*theta[1](t))});
> type(PB[3], Vector);
false
> PB[3][1, 1];
> PB[3][2];
> PB[3][3];
> P[3] := Vector(3, {(1) = (-cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))+sin(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))+cos(theta[1](t))*a[2]*cos(theta[2](t))-sin(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t))), (2) = (-sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))-cos(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))+sin(theta[1](t))*a[2]*cos(theta[2](t))+cos(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t))), (3) = (sin(theta[2](t))*sin(theta[3](t))+cos(theta[2](t))*cos(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))-a[2]*sin(theta[2](t))+d[1]+rho*sin((1/2)*theta[1](t))});
> da[0] := rho.sin((1/2)*theta[1](t));
print(`output redirected...`); # input placeholder
/ /1 \\
rho . |sin|- theta[1](t)||
\ \2 //
> ner[0] := Matrix(3, 3, {(1, 1) = e[l1xx], (1, 2) = -e[l1xy], (1, 3) = -e[l1xz], (2, 1) = e[l1xy], (2, 2) = e[l1yy], (2, 3) = -e[l1yz], (3, 1) = e[l1xz], (3, 2) = e[l1yz], (3, 3) = e[l1zz]});
> ner[1] := Matrix(3, 3, {(1, 1) = e[l2xx], (1, 2) = -e[l2xy], (1, 3) = -e[l2xz], (2, 1) = e[l2xy], (2, 2) = e[l2yy], (2, 3) = -e[l2yz], (3, 1) = e[l2xz], (3, 2) = e[l2yz], (3, 3) = e[l2zz]});
> ner[2] := Matrix(3, 3, {(1, 1) = e[l3xx], (1, 2) = -e[l3xy], (1, 3) = -e[l3xz], (2, 1) = e[l3xy], (2, 2) = e[l3yy], (2, 3) = -e[l3yz], (3, 1) = e[l3xz], (3, 2) = e[l3yz], (3, 3) = e[l3zz]});
> ner[3] := Matrix(3, 3, {(1, 1) = e[l4xx], (1, 2) = -e[l4xy], (1, 3) = -e[l4xz], (2, 1) = e[l4xy], (2, 2) = e[l4yy], (2, 3) = -e[l4yz], (3, 1) = e[l4xz], (3, 2) = e[l4yz], (3, 3) = e[l4zz]});
> d[0] := diff(da[1], t);
print(`output redirected...`); # input placeholder
0
> dl[0] := diff(d[0], t);
print(`output redirected...`); # input placeholder
0
> da[1] := rho.sin((1/2)*theta[2](t));
print(`output redirected...`); # input placeholder
/ /1 \\
rho . |sin|- theta[2](t)||
\ \2 //
> d[1] := diff(da[1], t);
print(`output redirected...`); # input placeholder
1 / /1 \ / d \\
- rho . |cos|- theta[2](t)| |--- theta[2](t)||
2 \ \2 / \ dt //
> dl[1] := diff(d[1], t);
print(`output redirected...`); # input placeholder
/ 2
1 | 1 /1 \ / d \
- rho . |- - sin|- theta[2](t)| |--- theta[2](t)|
2 \ 2 \2 / \ dt /
\
/1 \ / d / d \\|
+ cos|- theta[2](t)| |--- |--- theta[2](t)|||
\2 / \ dt \ dt ///
> da[2] := rho.sin((1/2)*theta[3](t));
print(`output redirected...`); # input placeholder
/ /1 \\
rho . |sin|- theta[3](t)||
\ \2 //
> d[2] := diff(da[2], t);
print(`output redirected...`); # input placeholder
1 / /1 \ / d \\
- rho . |cos|- theta[3](t)| |--- theta[3](t)||
2 \ \2 / \ dt //
> dl[2] := diff(d[2], t);
print(`output redirected...`); # input placeholder
/ 2
1 | 1 /1 \ / d \
- rho . |- - sin|- theta[3](t)| |--- theta[3](t)|
2 \ 2 \2 / \ dt /
\
/1 \ / d / d \\|
+ cos|- theta[3](t)| |--- |--- theta[3](t)|||
\2 / \ dt \ dt ///
> da[3] := rho.sin((1/2)*theta[4](t));
print(`output redirected...`); # input placeholder
/ /1 \\
rho . |sin|- theta[4](t)||
\ \2 //
> d[3] := diff(da[3], t);
print(`output redirected...`); # input placeholder
1 / /1 \ / d \\
- rho . |cos|- theta[4](t)| |--- theta[4](t)||
2 \ \2 / \ dt //
> dl[3] := diff(d[3], t);
print(`output redirected...`); # input placeholder
/ 2
1 | 1 /1 \ / d \
- rho . |- - sin|- theta[4](t)| |--- theta[4](t)|
2 \ 2 \2 / \ dt /
\
/1 \ / d / d \\|
+ cos|- theta[4](t)| |--- |--- theta[4](t)|||
\2 / \ dt \ dt ///
> P[4] := Vector(3, {(1) = (-cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))+sin(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))+cos(theta[1](t))*a[2]*cos(theta[2](t))-sin(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t))), (2) = (-sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))-cos(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))+sin(theta[1](t))*a[2]*cos(theta[2](t))+cos(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t))), (3) = (sin(theta[2](t))*sin(theta[3](t))+cos(theta[2](t))*cos(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))-a[2]*sin(theta[2](t))+d[1]+rho*sin((1/2)*theta[1](t))});
print(`output redirected...`); # input placeholder
> type(P[4], Vector);
print(`output redirected...`); # input placeholder
true
> type(P[1], Vector);
print(`output redirected...`); # input placeholder
true
> type(P[2], Vector);
print(`output redirected...`); # input placeholder
true
> type(P[3], Vector);
print(`output redirected...`); # input placeholder
true
> Z := Vector(3, {(1) = 0, (2) = 0, (3) = 1});
print(`output redirected...`); # input placeholder
> type(Z, Vector);
print(`output redirected...`); # input placeholder
true
> type(P[cg1], Vector);
print(`output redirected...`); # input placeholder
false
> PCG[0] := Vector(3, {(1) = cos(theta[1](t))*`Δx`[1]-sin(theta[1](t))*`Δz`[1], (2) = sin(theta[1](t))*`Δx`[1]+cos(theta[1](t))*`Δz`[1], (3) = -`Δy`[1]+d[1]+rho*sin((1/2)*theta[1](t))});
> PCG[1] := Vector(3, {(1) = cos(theta[1](t))*a[2]*cos(theta[2](t))-sin(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t)))+cos(theta[1](t))*cos(theta[2](t))*`Δx`[2]+cos(theta[1](t))*sin(theta[2](t))*`Δy`[2]+sin(theta[1](t))*`Δz`[2], (2) = sin(theta[1](t))*a[2]*cos(theta[2](t))+cos(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t)))+sin(theta[1](t))*cos(theta[2](t))*`Δx`[2]+sin(theta[1](t))*sin(theta[2](t))*`Δy`[2]-cos(theta[1](t))*`Δz`[2], (3) = -a[2]*sin(theta[2](t))+d[1]+rho*sin((1/2)*theta[1](t))-sin(theta[2](t))*`Δx`[2]+cos(theta[2](t))*`Δy`[2]});
> PCG[2] := Vector(3, {(1) = sin(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))+cos(theta[1](t))*a[2]*cos(theta[2](t))-sin(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t)))+(cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*`Δx`[3]-sin(theta[1](t))*`Δy`[3]+(-cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*`Δz`[3], (2) = -cos(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))+sin(theta[1](t))*a[2]*cos(theta[2](t))+cos(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t)))+(sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*`Δx`[3]+cos(theta[1](t))*`Δy`[3]+(-sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*`Δz`[3], (3) = -a[2]*sin(theta[2](t))+d[1]+rho*sin((1/2)*theta[1](t))+(-sin(theta[2](t))*cos(theta[3](t))+cos(theta[2](t))*sin(theta[3](t)))*`Δx`[3]+(sin(theta[2](t))*sin(theta[3](t))+cos(theta[2](t))*cos(theta[3](t)))*`Δz`[3]});
print(`output redirected...`); # input placeholder
>
> NULL;
> PCG[3] := Vector(3, {(1) = (-cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))+sin(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))+cos(theta[1](t))*a[2]*cos(theta[2](t))-sin(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t)))+((cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*cos(theta[4](t))-sin(theta[1](t))*sin(theta[4](t)))*`Δx`[4]+(-(cos(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*sin(theta[4](t))-sin(theta[1](t))*cos(theta[4](t)))*`Δy`[4]+(-cos(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+cos(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*`Δz`[4], (2) = (-sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))-cos(theta[1](t))*(d[3]+rho*sin((1/2)*theta[3](t)))+sin(theta[1](t))*a[2]*cos(theta[2](t))+cos(theta[1](t))*(d[2]+rho*sin((1/2)*theta[2](t)))+((sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*cos(theta[4](t))+cos(theta[1](t))*sin(theta[4](t)))*`Δx`[4]+(-(sin(theta[1](t))*cos(theta[2](t))*cos(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*sin(theta[3](t)))*sin(theta[4](t))+cos(theta[1](t))*cos(theta[4](t)))*`Δy`[4]+(-sin(theta[1](t))*cos(theta[2](t))*sin(theta[3](t))+sin(theta[1](t))*sin(theta[2](t))*cos(theta[3](t)))*`Δz`[4], (3) = (sin(theta[2](t))*sin(theta[3](t))+cos(theta[2](t))*cos(theta[3](t)))*(d[4]+rho*sin((1/2)*theta[4](t)))-a[2]*sin(theta[2](t))+d[1]+rho*sin((1/2)*theta[1](t))+(-sin(theta[2](t))*cos(theta[3](t))+cos(theta[2](t))*sin(theta[3](t)))*cos(theta[4](t))*`Δx`[4]-(-sin(theta[2](t))*cos(theta[3](t))+cos(theta[2](t))*sin(theta[3](t)))*sin(theta[4](t))*`Δy`[4]+(sin(theta[2](t))*sin(theta[3](t))+cos(theta[2](t))*cos(theta[3](t)))*`Δz`[4]});
Outward iterations Newton euler:
> for i from 0 to 3 do omega[i+1] := R[i].omega[i]+(diff(theta[i+1](t), t))*Z end do;
print(`output redirected...`); # input placeholder
> for o from 0 to 3 do alpha[o+1] := R[o].alpha[o]+(diff(theta[o+1](t), t, t))*Z+CrossProduct(R[o].omega[o], (diff(theta[o+1](t), t))*Z) end do;
print(`output redirected...`); # input placeholder
> f[0] := Vector(3, {(1) = 0, (2) = 0, (3) = 0});
print(`output redirected...`); # input placeholder
> n[0] := Vector(3, {(1) = 0, (2) = 0, (3) = 0});
print(`output redirected...`); # input placeholder
> for q from 0 to 3 do A[q+1] := R[q].(A[q]+`&x`(alpha[q+1], P[q])+`&x`(omega[q+1], `&x`(omega[q+1], P[q])))+2*CrossProduct(R[q].omega[q+1], d[q]*Z)+dl[q]*Z end do;
print(`output redirected...`); # input placeholder
> for j from 0 to 3 do ACG[j+1] := `&x`(alpha[j+1], PCG[j])+`&x`(omega[j+1], `&x`(omega[j+1], PCG[j]))+A[j] end do;
print(`output redirected...`); # input placeholder
> for k from 0 to 4 do F[k+1] := m[k]*ACG[k+1] end do;
%;
> for r from 0 to 3 do N[r+1] := ner[r].alpha[r+1]+`&x`(omega[r+1], ner[r].omega[r+1]) end do;
print(`output redirected...`); # input placeholder
>
Inward iterations Newton euler
>
> for q from 0 to 3 do f[q+1] := R[q].f[q]+F[q+1] end do;
%;
>
> for q from 0 to 3 do n[q+1] := N[q+1]+R[q].n[q]+`&x`(PCG[q], F[q+1])+`&x`(P[q], R[q].f[q+1]) end do;
> for q from 0 to 3 do T[q+1] := Transpose(n[q+1]).P[q] end do;
print(`output redirected...`); # input placeholder
>
> with(CodeGeneration);
%;
>
> Matlab;
print(`output redirected...`); # input placeholder
CodeGeneration:-Matlab
> Matlab(T[2], optimize);
%;
Error, (in ResolveTypes) cannot resolve types in {numeric, anything}