sand15

787 Reputation

11 Badges

9 years, 144 days

MaplePrimes Activity


These are replies submitted by sand15

@acer 

Sleep on it.

Thanks for the answer.

@nm

Unfortunately, I'm not ready to provide a simple example at the moment (that would require pruning a fairly large code to extract the significant part).
What I suggest is that you delay ( :-) ) my question by deleting it and coming back to the site later with more solid material.
Do you mind if I delete it?

Use the big green up-arrow in the menu bar to upload your worksheet.

[moderator: You can also upload and attach one or more data files. You can put them in a .zip file if the Mapleprimes file-manager doesn't accept their filename extension.]

@Thomas Dean 

Why do you talk about Maplet and where the message in your initial question comes from?
I don't see any Maplet command  in your code.

There is no Maple restriction.

But having already encountered this problem in my professional activities I can tell you that since Windows10 such a limitation is imposed by the OS (and defined by the value [that you can change] of variable MAX_PATH).
Neither Mac OSX not Linux impose a limitation to the lenth of a path.

First point: replace your last line by this one

obj := add((stress[i]-true_stress[i])^2, i = 1 .. 10)

Next it would be usefull you provode ranges of variation for the seven parameters (G1,G2,G3,tau1,tau2,tau3, strain) for a crude attempt to minimize obj lead to non numeric values.

@Ahmed111 

You will find in the attached file:

  • A correct construction of M (if I'm not mistaken).
     
  • A synthetic representation of its characteristic polynomia (formula (6), valid for any value of N).
     
  • The expression CharacteristicPolynomial provides and a few ways to express this lengthy formula in a more synthetic form (while less tractable than (formula (6))

restart

with(LinearAlgebra):

V := (N, s) -> Vector(N, symbol=s):
J := N -> IdentityMatrix(N):

n := 4:


M := I *~ (
             DiagonalMatrix( < -2*lambda, V(n, a) > )
             +
            (lambda+m__0) *~ IdentityMatrix(n+1)
          ):

M[n+1, 1..n] := -V(n, c)^+:
M[1..n, n+1] :=  V(n, c):

M


A pretty formula for the characteristic polynomial
 

# Step 0: define X this way

X := eta *~ IdentityMatrix(n+1) - eval(M, lambda=theta-m__0)

X := Matrix(5, 5, {(1, 1) = eta-I*(-theta+2*`#msub(mi("m"),mi("0"))`), (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = -c[1], (2, 1) = 0, (2, 2) = eta-I*(a[1]+theta), (2, 3) = 0, (2, 4) = 0, (2, 5) = -c[2], (3, 1) = 0, (3, 2) = 0, (3, 3) = eta-I*(a[2]+theta), (3, 4) = 0, (3, 5) = -c[3], (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = eta-I*(a[3]+theta), (4, 5) = -c[4], (5, 1) = c[1], (5, 2) = c[2], (5, 3) = c[3], (5, 4) = c[4], (5, 5) = eta-I*(a[4]+theta)})

(1)

# Step 1: write each diagonal element this way

for i from 1 to n+1 do
  X[i, i] := eta-u[i]
end do:

X;

Matrix([[eta-u[1], 0, 0, 0, -c[1]], [0, eta-u[2], 0, 0, -c[2]], [0, 0, eta-u[3], 0, -c[3]], [0, 0, 0, eta-u[4], -c[4]], [c[1], c[2], c[3], c[4], eta-u[5]]])

(2)

# Step 2: look to thexhape of the minots of W wrt to its rightmost column

for i from 1 to n+1 do
  Minor(X, i, n+1) * X[i, n+1] * (-1)^(i-1)
end do;

c[1]^2*(eta-u[2])*(eta-u[3])*(eta-u[4])

 

(eta-u[1])*c[2]^2*(eta-u[3])*(eta-u[4])

 

(eta-u[1])*(eta-u[2])*(eta-u[4])*c[3]^2

 

(eta-u[1])*(eta-u[2])*(eta-u[3])*c[4]^2

 

(eta-u[1])*(eta-u[2])*(eta-u[3])*(eta-u[4])*(eta-u[5])

(3)

# Step 3: then the determinant of X writes

det := add(Minor(X, i, n+1) * X[i, n+1] * (-1)^(i-1), i=1..n+1);
 

c[1]^2*(eta-u[2])*(eta-u[3])*(eta-u[4])+(eta-u[1])*c[2]^2*(eta-u[3])*(eta-u[4])+(eta-u[1])*(eta-u[2])*(eta-u[4])*c[3]^2+(eta-u[1])*(eta-u[2])*(eta-u[3])*c[4]^2+(eta-u[1])*(eta-u[2])*(eta-u[3])*(eta-u[4])*(eta-u[5])

(4)

# Step 4: simplify this expression bt setting Z[i] = eta-u[i]

expand( eval(det, [seq(eta-u[i]=Z[i], i=1..n+1)]) / mul(Z[i], i=1..n+1) );

1+c[4]^2/(Z[4]*Z[5])+c[3]^2/(Z[3]*Z[5])+c[2]^2/(Z[2]*Z[5])+c[1]^2/(Z[1]*Z[5])

(5)

# Step 5: Thus this representation of the characteristic polynomial as a rational fraction

det := (-1)^'n' * Product(Z[k], k=1..'n'+1) * (1 + Sum(c[k]^2/Z[k]/Z[k+1], k=1..'n'));

print():
k := 'k':
reminder := Z[k] = eval(eta-u[k], u[k] = 'M[k, k]');

(-1)^n*(Product(Z[k], k = 1 .. n+1))*(1+Sum(c[k]^2/(Z[k]*Z[k+1]), k = 1 .. n))

 

 

Z[k] = eta-M[k, k]

(6)


A direct use of  CharacteristicPolynomial

# With CharacteristicPolynomial:

CP := CharacteristicPolynomial(eval(X, eta=0), eta);

eta^5-(-u[5]-u[4]-u[3]-u[2]-u[1])*eta^4-(-c[1]^2-c[2]^2-c[3]^2-c[4]^2-u[1]*u[2]-u[1]*u[3]-u[1]*u[4]-u[1]*u[5]-u[2]*u[3]-u[2]*u[4]-u[2]*u[5]-u[3]*u[4]-u[3]*u[5]-u[4]*u[5])*eta^3-(-c[1]^2*u[2]-c[1]^2*u[3]-c[1]^2*u[4]-c[2]^2*u[1]-c[2]^2*u[3]-c[2]^2*u[4]-c[3]^2*u[1]-c[3]^2*u[2]-c[3]^2*u[4]-c[4]^2*u[1]-c[4]^2*u[2]-c[4]^2*u[3]-u[1]*u[2]*u[3]-u[1]*u[2]*u[4]-u[1]*u[2]*u[5]-u[1]*u[3]*u[4]-u[1]*u[3]*u[5]-u[1]*u[4]*u[5]-u[2]*u[3]*u[4]-u[2]*u[3]*u[5]-u[2]*u[4]*u[5]-u[3]*u[4]*u[5])*eta^2-(-c[1]^2*u[2]*u[3]-c[1]^2*u[2]*u[4]-c[1]^2*u[3]*u[4]-c[2]^2*u[1]*u[3]-c[2]^2*u[1]*u[4]-c[2]^2*u[3]*u[4]-c[3]^2*u[1]*u[2]-c[3]^2*u[1]*u[4]-c[3]^2*u[2]*u[4]-c[4]^2*u[1]*u[2]-c[4]^2*u[1]*u[3]-c[4]^2*u[2]*u[3]-u[1]*u[2]*u[3]*u[4]-u[1]*u[2]*u[3]*u[5]-u[1]*u[2]*u[4]*u[5]-u[1]*u[3]*u[4]*u[5]-u[2]*u[3]*u[4]*u[5])*eta+c[1]^2*u[2]*u[3]*u[4]+c[2]^2*u[1]*u[3]*u[4]+c[3]^2*u[1]*u[2]*u[4]+c[4]^2*u[1]*u[2]*u[3]+u[1]*u[2]*u[3]*u[4]*u[5]

(7)

# A more synthetic form

with(LargeExpressions):

Synthetic_form := collect(CP, eta, Veil[T]);
 

eta^5+eta^4*T[2]+eta^3*T[3]+eta^2*T[4]+eta*T[5]+T[1]

(8)

# Where the coefficients are:

Coefficients_are := [ seq(T[i] = Unveil[T](T[i]), i=1..LastUsed[T]) ]:
print~(Coefficients_are):

T[1] = c[1]^2*u[2]*u[3]*u[4]+c[2]^2*u[1]*u[3]*u[4]+c[3]^2*u[1]*u[2]*u[4]+c[4]^2*u[1]*u[2]*u[3]+u[1]*u[2]*u[3]*u[4]*u[5]

 

T[2] = u[5]+u[4]+u[3]+u[2]+u[1]

 

T[3] = c[1]^2+c[2]^2+c[3]^2+c[4]^2+u[1]*u[2]+u[1]*u[3]+u[1]*u[4]+u[1]*u[5]+u[2]*u[3]+u[2]*u[4]+u[2]*u[5]+u[3]*u[4]+u[3]*u[5]+u[4]*u[5]

 

T[4] = c[1]^2*u[2]+c[1]^2*u[3]+c[1]^2*u[4]+c[2]^2*u[1]+c[2]^2*u[3]+c[2]^2*u[4]+c[3]^2*u[1]+c[3]^2*u[2]+c[3]^2*u[4]+c[4]^2*u[1]+c[4]^2*u[2]+c[4]^2*u[3]+u[1]*u[2]*u[3]+u[1]*u[2]*u[4]+u[1]*u[2]*u[5]+u[1]*u[3]*u[4]+u[1]*u[3]*u[5]+u[1]*u[4]*u[5]+u[2]*u[3]*u[4]+u[2]*u[3]*u[5]+u[2]*u[4]*u[5]+u[3]*u[4]*u[5]

 

T[5] = c[1]^2*u[2]*u[3]+c[1]^2*u[2]*u[4]+c[1]^2*u[3]*u[4]+c[2]^2*u[1]*u[3]+c[2]^2*u[1]*u[4]+c[2]^2*u[3]*u[4]+c[3]^2*u[1]*u[2]+c[3]^2*u[1]*u[4]+c[3]^2*u[2]*u[4]+c[4]^2*u[1]*u[2]+c[4]^2*u[1]*u[3]+c[4]^2*u[2]*u[3]+u[1]*u[2]*u[3]*u[4]+u[1]*u[2]*u[3]*u[5]+u[1]*u[2]*u[4]*u[5]+u[1]*u[3]*u[4]*u[5]+u[2]*u[3]*u[4]*u[5]

(9)

 

# In these expressions of T[i] we recognize:

T[1] = Determinant(eval(X, eta=0));
T[2] = -Trace(eval(X, eta=0));;
T[3] = - expand( 1/2*(Trace(eval(X, eta=0)^2) - Trace(eval(X, eta=0))^2) )

T[1] = -c[1]^2*u[2]*u[3]*u[4]-c[2]^2*u[1]*u[3]*u[4]-c[3]^2*u[1]*u[2]*u[4]-c[4]^2*u[1]*u[2]*u[3]-u[1]*u[2]*u[3]*u[4]*u[5]

 

T[2] = u[5]+u[4]+u[3]+u[2]+u[1]

 

T[3] = c[1]^2+c[2]^2+c[3]^2+c[4]^2+u[1]*u[2]+u[1]*u[3]+u[1]*u[4]+u[1]*u[5]+u[2]*u[3]+u[2]*u[4]+u[2]*u[5]+u[3]*u[4]+u[3]*u[5]+u[4]*u[5]

(10)

# and so on, those are classical formulas.

Download CP_2.mw

@Ahmed111 

I'm sorry, I didn't see the comma in

diag(-2*lambda, a)

and read

diag(-2*lambda . a)

To get the matrix you want  you have to write (a being a vector of size N) write

M11 := DiagonalMatrix( < -2*lambda, V(n, a) > )


Nevertheless you need to me more precise: what is exactly the shape ofthe matrix M you want to build (write it by hand for N=2 to provide an example)?

A few interpretations are fiven in the attached file (each corresponds to an input text of different color)
Whatever, assuming c has length N+1, here is a correction (inputs in black at the end of the file)
CP.mw

@Hahn Hahn 

Look here to see how you can check your inputs Check_your_inputs.mw
(as I use an "old" version of Maple I had to write g := (x,q) -> ... for it doesn't accept your syntax)

@Thomas Richard, please excuse me for intervening.

@sursumCorda 

With the linalg package the eigenvectors are returned this way

linalg:-eigenvectors(m);
                   [-1, 1, {Vector[row](2, {(1) = -1, (2) = 1})}], [7, 1, {Vector[row](2, {(1) = 1, (2) = 1})}]

But for the LinearAlgebra package you get a vector of eigenvalues and the matrix of eigenvectors.
If you set _EnvLinalg95 to true, use the option output='list' in  LinearAlgebra:-Eigenvectors (which then returns the eigenvectors under the form linalg-eigenvectors does):

_EnvLinalg95 := true:
LinearAlgebra:-Eigenvectors(m, output='list');
[[7, 1, {Vector(2, {(1) = 1, (2) = 1})}], [-1, 1, {Vector(2, {(1) = -1, (2) = 1})}]]

You have 3 indeterminates (x, y, z) and 2 equations (notice there is no f nor g as you say in the text).
Could you be more precise?

@Carl Love 

I tried hard, not enough obviously, to prove the equality by hand.

For the record the left hand side of rel(n) is a consequence of another relation, one can get on several papers, which is said to be "true for all integers larger than 3".
I observed it was also true for n=2, for any negative integer... and for any real number but 1 (so what is it to write the previous sentence?).
This puzzled me and then started simplifying rel(n), rewritting some terms differently and so on, thinking that assume/assuming would be of no help.
Thanks again for this Martin Gardner's Ahah intuition.

@acer @vv

Thanks to both us for your quick reply.

@Carl Love 

Sorry, I missed it.
But its notations remain confusing, not to say meaningless.

@Rouben Rostamian  

ContoursWithLabels is Kitonum's code see_here

2 3 4 5 6 7 8 Last Page 4 of 24