1 years, 22 days

## Matrix Multiplication with Custom Elemen...

Maple

Say I have 2 matrices, in which the elements themselves are vectors.

I'm looking for a way to perform matrix multiplication on these so that rather than having the first element as x11y11+x12y21+x13y31

It would be x11.y11+x12.y21+x13.y31 where . is the dot product on the elements of each matrix.

I know I could write a procedure to do this manually but I was wondering if there's any pre-made operations (or modifiers on the Multiply operation) to do this.

## Evalf on Function Coefficients?...

Maple

I have a function defined which maps x to a polynomial.

The coefficients are highly precise floating point numbers, which is necessary since it needs to be accurate, however when I try to print the function it looks like a massive mess.

I tried to use `print(evalf[4](f));` in an attempt to simplify it however this evaluation seems to have no effect on how it is displayed.

As I said, I can't use evalf when defining the function since it needs high precision.

Is there a way to do this without creating a clone of the function with the coefficients evaluated, just to print it on screen?

## Best Way to Find List Order...

Maple

I'm trying to create a list containg the indices of another list, ordered corresponding to the descending size of the first list.

Say I have the list `L := [8 7 9 12];`

I want to find the list `i = [4 3 1 2]`

I know this could be done one element at the time by doing some iterative loop:
`i := [];`
```for j from 1 to size(L) do     member(max(L),L,'index');     i := [op(i),index];     subsop(index=NULL,L); end do;```

But I was wondering if anyone knew any fancy tricks to do this more concisely(and without destroying the original list)?

## How to Partially Solve a System of Equat...

Maple 2018

I'm attempting to find the eigenvectors of a matrix without using the eigenvector function.

The matrix in question is a covariance matrix:

`XCov:=Matrix([[4048/5, -817/5, -122/5], [-817/5, 921/10, -1999/10], [-122/5, -1999/10, 8341/10]]);`

I've already found the eigenvalues by solving for lambda:

``` det := Determinant(XCov-lambda*IdentityMatrix(3));   lambda := solve(det=0.0, lambda);```

(Yes I'm reusing the eigenvalue variable for the set of eigenvalues once they've been found😏)

Anyway, I've now set up the first eigenvector I want to find as:
`e1 := Vector([e11,e12,e13]);`

Now, the equation to find this first eigenvector is XCov . e1 = lambda[1] . e1
I first tried putting whats on the left in a variable called eigscale(what the vector is translated to by the matrix):

`eigscale := Multiply(XCov,e1);`
Which returns a vector:
eigscale = [(4048/5)*e11-(817/5)*e12-(122/5)*e13,
-(817/5)*e11+(921/10)*e12-(1999/10)*e13,
-(122/5)*e11-(1999/10)*e12+(8341/10)*e13]

Each component of this vector must equate to the corresponding component in the right vector:

lambda[1]*e1 = [7.943520930*e11, 7.943520930*e12, 7.943520930*e13]

At first I tried setting these vectors equal to each other and using a solve but of course it didnt like the equations being in a vector format. So I then seperated out each equation and gave the solve function a system of equations as it expects:

`solve(eigscale[1] = lambda[1]*e1[1], eigscale[2] = lambda[1]*e1[2], eigscale[3] = lambda[1]*e1[3], [e11,e12,e13]);`

But again, solve fails to solve them. The reason this time(I believe) is because it can't find an exact value for e11, e12 & e13.
When solving for an eigenvector we get
`e11 = e11`,
`e12 = Ae11`,
`e13 = Be11 + Ce12`

I was wondering if there was a way to do a partial solve to find the components in terms of each other?

Failing that, I'm aware I can do it manually through row operations but I believe that would require changing the format so that each equation is a component of a single vector:
`eigsolve := Vector([eigscale[1] = lambda[1]*e1[1], eigscale[2] = lambda[1]*e1[2], eigscale[3] = lambda[1]*e1[3]]);`

Since row operations cannot be performed on a equation of vectors (again, I believe).

Help appreciated!

## Maintain Sequence Iterator In Same Line...

Maple 2018

So I was trying to create a shorthand for creating a plot of multiple arrows, with the arrow colour dependent on the magnitude of the vector.
I currently have a set of vectors, v, I want to display, and v[4] is the largest.

I know this could be done by creating an arrow plot for each vector seperately and then by combining them using display:
`arrow1 := arrow( v[1], width=0.15,length=20,color=ColorTools:-Color( (norm(v[1])/norm(v[4]))*[0,0,1] ) );`
```arrow2 := arrow( v[2], width=0.15,length=20,color=ColorTools:-Color( (norm(v[2])/norm(v[4]))*[0,0,1] ) ); ... print(plots:-display([arrow1, arrow2, ...]));```

But I was wondering if it could be done in a fashion similar to this:
```arrows := arrow([seq(v[i], i=1..4)],width=0.15,length=20,color=ColorTools:-Color((norm(v[i])/norm(v[4]))*[0,0,1])); print(arrows);```

(btw: it works fine replacing the last i with 1, which draws all arrows nearly black, or with 4, which as you guessed, draws all arrows blue...)

Help appreciated!
 1 2 Page 2 of 2
﻿