sand15

1137 Reputation

15 Badges

10 years, 331 days

MaplePrimes Activity


These are replies submitted by sand15

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

@C_R 

Thanks for your return.

Go here help(dsolve[numeric]), search for 'known', try to understand hot to proceed from examples dsol8 and dsol8b.

@Muhammad Usman 

Does this suit you?

plots[display](
  PP
  , size = [500, 400]
  , axis[1]=[tickmarks=[seq(k=k/10., k=0..20, 5)]]
  , axis[2]=[tickmarks=[seq(k=k/10., k=0..20, 5)]]
);

But given L=1 and T=2, it seems to me that this

plots[display](
  PP
  , size = [500, 400]
  , axis[1]=[tickmarks=[seq(k=evalf(k*`&Delta:x`), k=0..20, 5)]]
  , axis[2]=[tickmarks=[seq(k=evalf(k*`&Delta:t`), k=0..20, 5)]]
);

would be more correct.

What is the structure of the data you want to send to Tecplot?
I guess it is a collection of contours, each contour being a collection of segments, that is a collection of 2x2 matrices.
The question is what structure Tecplot can manage? Once defined, the corresponding structure can be build in Maple.
But the "precision" of a contour of a given length is defined by the number of segments which approximate this contour. So the drawing in Tecplot of a contour made of, for instance, 100 segments constructed in Maple, will not have an higher resolution than thesame contour directly drawn in Maple.

As you defined

N := 20: 
Mx := 20: 

and plotted

plots:-contourplot(
        interfunc, 
        0 .. Mx, 0 .. N
        ...
)

why do you say "Here the t-axis is from 0 to 20 but its actual value is from 0 to 2 and the x-axis is from 0 to 20 but its actual value is from 0 to 2"?

If you want them to range from 0 to 2 just write

plots:-contourplot(
        interfunc, 
        0 .. 2, 0 .. 2
        ...
)

instead or set

N := 2: 
Mx := 2: 

It's up to you to lnow what you want to do.

About your claim "How I can, I extract data in the form of a dat file to plot in some professional software? " (which, I'm afraid of, will be likely understood as "Maple is not a professional software") you must be more detailed.
If you have professional in mind, I think that best thing to do is to give him interfunc plus some indications and let him manage to provide a "real professional layout".

First 10 11 12 13 14 15 16 Last Page 12 of 32