mehdi jafari

764 Reputation

13 Badges

11 years, 206 days

MaplePrimes Activity


These are replies submitted by mehdi jafari

@sharena2 i think u can do whatever u want with maple ! 

@Markiyan Hirnyk  actually i can edit  ! by i can not delet ! :D lol

there is no deletion option !

@sharena2 good luck

@Carl Love Robert isreal has said:

Note:  This code is experimental, and is not guaranteed to work.  
# In particular, "allsolve" uses "evalr" to do interval arithmetic, and is
# therefore subject to the weaknesses of "evalr".  Among the bugs and
# weaknesses I know about:
# 1) It doesn't work with "GAMMA".
# 2) It doesn't work with the two-variable version of "arctan".

@Carl Love at the end of this help page there is :

See Also
evalr, operators/precedence, ScientificErrorAnalysis, Units

actually the first related argument to the topic is this according to maple help.

according to maple help page :

evalr - evaluate an expression using range arithmetic

and i actually guess evalr can be uesd  do u think it is incorrect ?.

Reboert Isreal has some topic about this at 
http://www.math.ubc.ca/~israel/advisor/advisor4/allsolve.txt

i emailed him to help us here, i do not know whether he has time or not.

@Preben Alsholm 
http://www.mapleprimes.com/questions/201301-Factory-Simulation-Question

@sharena2  none of your uploaded worksheet is downlodable , please uplaod again and make sure that your file is downloadable . tnx

please upload your worksheet here . tnx

@Aroob2012 PDE and BCs is just name i have assing your pde equation and your boundary conditions to them,respectively. u can use pdsolve so solve your pde equation, for more information, u should see ?pdsolve 

pdsolve - find solutions for partial differential equations (PDEs) and systems of PDEs

i upload two pdfs of maple help page here, but please see them yourself on the maple help. good luck!

pdsolve,numeric_(pds.pdf

pdsolve.pdf

@Carl Love yes Sir,you are right, i thought iindex notation is better, and as you said,i shoud say about that. thank u for your remark.

the file is not uploading correctly, u can do like this ( at the end of your code ) :

x(t):=add(a[i]*f[i](t),i=1..numelems(C));u(t):=add(b[i]*f[i](t),i=1..numelems(C));

eval(x(t),op(2,MM));eval(u(t),op(2,MM));


restart:
with(Optimization):
with(LinearAlgebra):
L:=1:  r:=2:  tau:= 1:
interface(rtablesize= 2*r+1):

Z:= Matrix(
     2*r+1, 2*r+1,
     [tau,
      seq(evalf((L/(2*(iz-1)*Pi))*sin(2*(iz-1)*Pi*tau/L)), iz= 2..r+1),
      seq(evalf((L/(2*(iz-1-r)*Pi))*(1-cos(2*(iz-1-r)*Pi*tau/L))), iz= r+2..2*r+1)
      ],
     scan= columns,
     datatype= float[8]
);
                        
Dtau00:= < 1 >:
Dtau01:= Vector[row](r):
Dtau02:= Vector[row](r):
Dtau10:= Vector(r):
Dtau20:= Vector(r):

Dtau1:= DiagonalMatrix([seq(evalf(cos(2*i*Pi*tau/L)), i= 1..r)]):
Dtau2:= DiagonalMatrix([seq(evalf(sin(2*i*Pi*tau/L)), i= 1..r)]):
Dtau3:= -Dtau2:
Dtau4:= copy(Dtau1):

Dtau:= < < Dtau00 | Dtau01 | Dtau02 >,
         < Dtau10 | Dtau1  | Dtau2  >,
         < Dtau20 | Dtau3  | Dtau4  > >;
 
P00:= < L/2 >:
P01:= Vector[row](r):
P02:= Vector[row](r, j-> evalf(-L/j/Pi), datatype= float[8]):
P10:= Vector(r):
P20:= Vector(r, i-> evalf(L/2/i/Pi)):
P1:= Matrix(r,r):
P2:= DiagonalMatrix(P20):
P3:= DiagonalMatrix(-P20):
P4:= Matrix(r,r):

P:= < < P00 | P01 | P02 >,
      < P10 | P1  | P2  >,
      < P20 | P3  | P4  > >;

interface(rtablesize=2*r+1):    # optionally
J:=Vector([L, L/2 $ 2*r]):      # Matrix([[...]]) would also work here

E:=DiagonalMatrix(J);

X:=  Vector[row](2*r+1,symbol=a);
U:=Vector[row](2*r+1,symbol=b);

X0:= Vector[row](2*r+1,[1]);
G:=Vector[row](2*r+1,[1]);
C:=simplify(X-X0-G.Z-X.Dtau.P+X.Dtau.Z-U.P);

Matrix(%id = 18446744073930868126)

Matrix(%id = 18446744073930869806)

Matrix(%id = 18446744073934930878)

Matrix(%id = 18446744073934931118)

Vector[row](%id = 18446744073934931478)

Vector[row](%id = 18446744073934931598)

Vector[row](%id = 18446744073934931718)

Vector[row](%id = 18446744073934931838)

Vector[row](%id = 18446744073934934014)

(1)

J:=X.E.Transpose(X)+U.E.Transpose(U);

a[1]^2+(1/2)*a[2]^2+(1/2)*a[3]^2+(1/2)*a[4]^2+(1/2)*a[5]^2+b[1]^2+(1/2)*b[2]^2+(1/2)*b[3]^2+(1/2)*b[4]^2+(1/2)*b[5]^2

(2)

indets(J); indets(C)

{a[1], a[2], a[3], a[4], a[5], b[1], b[2], b[3], b[4], b[5]}

{a[1], a[2], a[3], a[4], a[5], b[1], b[2], b[3], b[4], b[5]}

(3)

MM:=Minimize(J,{seq(C[i]=0,i=1..numelems(C))});

[1.52587355672056, [a[1] = HFloat(1.1444051675322553), a[2] = HFloat(0.07357433785547854), a[3] = HFloat(0.01908371625198537), a[4] = HFloat(-0.23114059946679755), a[5] = HFloat(-0.11990652558360362), b[1] = HFloat(-0.3814683891883076), b[2] = HFloat(1.0769416608491511e-11), b[3] = HFloat(-2.602282105079734e-12), b[4] = HFloat(-0.23114059939913112), b[5] = HFloat(-0.11990652561630648)]]

(4)

#XP:=-.015+X[1]+add(X[l+1]*f1(l)+X[r+l+1]*f2(l), l= 1..r):
#plot([XP,T1], t= 0..1);#,legend= "Solution Of x(t) with r=50"):

 

op(2,MM);

[a[1] = HFloat(1.1444051675322553), a[2] = HFloat(0.07357433785547854), a[3] = HFloat(0.01908371625198537), a[4] = HFloat(-0.23114059946679755), a[5] = HFloat(-0.11990652558360362), b[1] = HFloat(-0.3814683891883076), b[2] = HFloat(1.0769416608491511e-11), b[3] = HFloat(-2.602282105079734e-12), b[4] = HFloat(-0.23114059939913112), b[5] = HFloat(-0.11990652561630648)]

(5)

x(t):=add(a[i]*f[i](t),i=1..numelems(C));u(t):=add(b[i]*f[i](t),i=1..numelems(C));

a[1]*f[1](t)+a[2]*f[2](t)+a[3]*f[3](t)+a[4]*f[4](t)+a[5]*f[5](t)

b[1]*f[1](t)+b[2]*f[2](t)+b[3]*f[3](t)+b[4]*f[4](t)+b[5]*f[5](t)

(6)

eval(x(t),op(2,MM));eval(u(t),op(2,MM));

HFloat(1.1444051675322553)*f[1](t)+HFloat(0.07357433785547854)*f[2](t)+HFloat(0.01908371625198537)*f[3](t)-HFloat(0.23114059946679755)*f[4](t)-HFloat(0.11990652558360362)*f[5](t)

-HFloat(0.3814683891883076)*f[1](t)+HFloat(1.0769416608491511e-11)*f[2](t)-HFloat(2.602282105079734e-12)*f[3](t)-HFloat(0.23114059939913112)*f[4](t)-HFloat(0.11990652561630648)*f[5](t)

(7)

 

good luck!

Download solved.mws



@mahmood180 

@Carl Love i thought nops(c) has returned 5 not 3 . tnx for your remark.
Mr. Dadkhah you are very welcome. as my friend Carl love says your corrected form of answer is :

restart:
with(Optimization):
with(LinearAlgebra):
L:=1:  r:=2:  tau:= 1:
interface(rtablesize= 2*r+1):

Z:= Matrix(
     2*r+1, 2*r+1,
     [tau,
      seq(evalf((L/(2*(iz-1)*Pi))*sin(2*(iz-1)*Pi*tau/L)), iz= 2..r+1),
      seq(evalf((L/(2*(iz-1-r)*Pi))*(1-cos(2*(iz-1-r)*Pi*tau/L))), iz= r+2..2*r+1)
      ],
     scan= columns,
     datatype= float[8]
);
                        
Dtau00:= < 1 >:
Dtau01:= Vector[row](r):
Dtau02:= Vector[row](r):
Dtau10:= Vector(r):
Dtau20:= Vector(r):

Dtau1:= DiagonalMatrix([seq(evalf(cos(2*i*Pi*tau/L)), i= 1..r)]):
Dtau2:= DiagonalMatrix([seq(evalf(sin(2*i*Pi*tau/L)), i= 1..r)]):
Dtau3:= -Dtau2:
Dtau4:= copy(Dtau1):

Dtau:= < < Dtau00 | Dtau01 | Dtau02 >,
         < Dtau10 | Dtau1  | Dtau2  >,
         < Dtau20 | Dtau3  | Dtau4  > >;
 
P00:= < L/2 >:
P01:= Vector[row](r):
P02:= Vector[row](r, j-> evalf(-L/j/Pi), datatype= float[8]):
P10:= Vector(r):
P20:= Vector(r, i-> evalf(L/2/i/Pi)):
P1:= Matrix(r,r):
P2:= DiagonalMatrix(P20):
P3:= DiagonalMatrix(-P20):
P4:= Matrix(r,r):

P:= < < P00 | P01 | P02 >,
      < P10 | P1  | P2  >,
      < P20 | P3  | P4  > >;

interface(rtablesize=2*r+1):    # optionally
J:=Vector([L, L/2 $ 2*r]):      # Matrix([[...]]) would also work here

E:=DiagonalMatrix(J);

X:=  Vector[row](2*r+1,symbol=a);
U:=Vector[row](2*r+1,symbol=b);

X0:= Vector[row](2*r+1,[1]);
G:=Vector[row](2*r+1,[1]);
C:=simplify(X-X0-G.Z-X.Dtau.P+X.Dtau.Z-U.P);

Matrix(%id = 18446744073931261342)

Matrix(%id = 18446744073931263022)

Matrix(%id = 18446744073935324094)

Matrix(%id = 18446744073935324334)

Vector[row](%id = 18446744073935324694)

Vector[row](%id = 18446744073935324814)

Vector[row](%id = 18446744073935324934)

Vector[row](%id = 18446744073935325054)

Vector[row](%id = 18446744073935327230)

(1)

J:=X.E.Transpose(X)+U.E.Transpose(U);

a[1]^2+(1/2)*a[2]^2+(1/2)*a[3]^2+(1/2)*a[4]^2+(1/2)*a[5]^2+b[1]^2+(1/2)*b[2]^2+(1/2)*b[3]^2+(1/2)*b[4]^2+(1/2)*b[5]^2

(2)

indets(J); indets(C)

{a[1], a[2], a[3], a[4], a[5], b[1], b[2], b[3], b[4], b[5]}

{a[1], a[2], a[3], a[4], a[5], b[1], b[2], b[3], b[4], b[5]}

(3)

Minimize(J,{seq(C[i]=0,i=1..numelems(C))});

[1.52587355672056, [a[1] = HFloat(1.1444051675322553), a[2] = HFloat(0.07357433785547854), a[3] = HFloat(0.01908371625198537), a[4] = HFloat(-0.23114059946679755), a[5] = HFloat(-0.11990652558360362), b[1] = HFloat(-0.3814683891883076), b[2] = HFloat(1.0769416608491511e-11), b[3] = HFloat(-2.602282105079734e-12), b[4] = HFloat(-0.23114059939913112), b[5] = HFloat(-0.11990652561630648)]]

(4)

#XP:=-.015+X[1]+add(X[l+1]*f1(l)+X[r+l+1]*f2(l), l= 1..r):
#plot([XP,T1], t= 0..1);#,legend= "Solution Of x(t) with r=50"):

 

 

 

 

 



Download solved.mws




@upaska could please write down the matrix instead of image ? maybe you need to see ?Eigenvalue. i guess your problem is with datatype = float option.

as maple help page :

The Eigenvalues(A) command solves the simple eigenvalue problem by returning the eigenvalues of Matrix A in a column Vector.
In the simple floating-point eigenvalue problem, if A has either the symmetric or the hermitian indexing function then the returned object has float[8] or sfloat datatype. Otherwise the returned object has complex[8] or  complex(sfloat) datatype.

 

If the implicit option (imp) is included in the calling sequence as just the symbol implicit or in the form implicit=true, then the eigenvalues are expressed by using Maple's RootOf notation for algebraic extensions or by expressing the eigenvalues in terms of exact radicals (if possible).

if you write down your matrix here, we can try possible options which can solve your problem.


i guess set the option implicit=true will solve the problem,but not sure of,good luck.

@mehdi jafari your problem is that you can not do this part (X.Dtau.P)  in this line of your code :


interface(rtablesize = 2*r+1); J := Vector([L, `$`((1/2)*L, 2*r)]); E := DiagonalMatrix(J); X := Vector[row](2*r+1, symbol = a); U := Vector[row](2*r+1, symbol = b); X0 := Vector[row](2*r+1, [1]); G := Vector[row](2*r+1, [1]); C := simplify(X-X0-G.Z-X.Dtau.P+X.Dtau.Z-U.P);

thus please change your matrix bounds so that this multiplication can be done . 

First 11 12 13 14 15 16 17 Last Page 13 of 23