mehdi jafari

749 Reputation

13 Badges

11 years, 88 days

MaplePrimes Activity


These are questions asked by mehdi jafari

Hi. Can maple compute right and left eigenvectors of a matrix?

Hi. I want to plot an sphere animating equator on the sphere(earth). please help me. Tnx.

i have two euations including integration which has two unkwnon x1 and x2.
how can i get these equations solved, thanks for the help.

restart:

with(DirectSearch)

[BoundedObjective, CompromiseProgramming, DataFit, ExponentialWeightedSum, GlobalOptima, GlobalSearch, Minimax, ModifiedTchebycheff, Search, SolveEquations, WeightedProduct, WeightedSum]

(1)

with(LinearAlgebra):

with(Student:-Calculus1):

with(Student:-NumericalAnalysis):

A:=convert(taylor(exp(Q),Q,6),polynom);

1+Q+(1/2)*Q^2+(1/6)*Q^3+(1/24)*Q^4+(1/120)*Q^5

(2)

Q:=a[11]*(E[r])^2+a[22]*(E[theta])^2+2*a[12]*E[r]*E[theta];

E[r]^2*a[11]+2*E[r]*E[theta]*a[12]+E[theta]^2*a[22]

(3)

psi:=0.5*c*(exp(Q)-1);

.5*c*(exp(E[r]^2*a[11]+2*E[r]*E[theta]*a[12]+E[theta]^2*a[22])-1)

(4)

F:=Matrix(3,3,[[lambda[r],0,0],[0,lambda[theta],0],[0,0,lambda[z]]]);

Matrix(3, 3, {(1, 1) = lambda[r], (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = lambda[theta], (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = lambda[z]})

(5)

sigma[r]:=-p+diff(psi,E[r])*F[1,1]^2;

-p+.5*c*(2*E[r]*a[11]+2*E[theta]*a[12])*exp(E[r]^2*a[11]+2*E[r]*E[theta]*a[12]+E[theta]^2*a[22])*lambda[r]^2

(6)

sigma[theta]:=-p+diff(psi,E[theta])*F[2,2]^2;

-p+.5*c*(2*E[r]*a[12]+2*E[theta]*a[22])*exp(E[r]^2*a[11]+2*E[r]*E[theta]*a[12]+E[theta]^2*a[22])*lambda[theta]^2

(7)

sigma[z]:=-p+diff(psi,E[z])*F[3,3]^2;

-p

(8)

p1:=diff(psi,E[r])*F[1,1]^2;#Pressure is constituted form 3 parts, one part is p1, other part is p2 and a constant p0

.5*c*(2*E[r]*a[11]+2*E[theta]*a[12])*exp(E[r]^2*a[11]+2*E[r]*E[theta]*a[12]+E[theta]^2*a[22])*lambda[r]^2

(9)

E[r]:=0.5*(lambda[r]^2-1);

.5*lambda[r]^2-.5

(10)

E[theta]:=0.5*(lambda[theta]^2-1);

.5*lambda[theta]^2-.5

(11)

E[z]:=0.5*(lambda[z]^2-1);

.5*lambda[z]^2-.5

(12)

lambda[r]:=x2*sqrt((r^2-x1)/x2)/r;

x2*((r^2-x1)/x2)^(1/2)/r

(13)

lambda[theta]:=r/sqrt((r^2-x1)/x2);

r/((r^2-x1)/x2)^(1/2)

(14)

lambda[z]:=1/x2;

1/x2

(15)

sigma[r];

-p+.5*c*(2*(.5*x2*(r^2-x1)/r^2-.5)*a[11]+2*(.5*r^2*x2/(r^2-x1)-.5)*a[12])*exp((.5*x2*(r^2-x1)/r^2-.5)^2*a[11]+2*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)*a[12]+(.5*r^2*x2/(r^2-x1)-.5)^2*a[22])*x2*(r^2-x1)/r^2

(16)

sigma[theta]:

sigma[z]:

#p2:=int((sigma[r]-sigma[theta])/r,r):%Pressure is constituted form 2 parts, one part is p1, other part is p2 and and a constant p0

Digits:=10:

c:=790000:

a[11]:=0.539:

a[22]:=0.368:

a[12]:=0.653:

p_in:=10000:

p_out:=0:

r_in:=5.4e-3:

r_out:=6.1e-3:

F_a:=0.381846:

p21:=(c/2)*(((r^2-x1)/r^3)-(x2*r/(r^2-x1)))*exp(Q);

395000*((r^2-x1)/r^3-x2*r/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)

(17)

p22:=(c/2)*Int(exp(Q)*(3*x2*r^6-r^6+5*x1*r^4-x1*x2*r^4-7*x1^2*r^2+3*x1^3)/(r^4*(r^2-x1)^2),r=r_in..r_out);#This is the part that should be maintained as an integral until the final solution

395000*(Int(exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*(3*r^6*x2-r^6-r^4*x1*x2+5*r^4*x1-7*r^2*x1^2+3*x1^3)/(r^4*(r^2-x1)^2), r = 0.54e-2 .. 0.61e-2))

(18)

p2:=p21-p22;#p2 is computed using the integration by part method

395000*((r^2-x1)/r^3-x2*r/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)-395000*(Int(exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*(3*r^6*x2-r^6-r^4*x1*x2+5*r^4*x1-7*r^2*x1^2+3*x1^3)/(r^4*(r^2-x1)^2), r = 0.54e-2 .. 0.61e-2))

(19)

 

p0:=(p_out+eval(p2,r=r_out));#p0 is the constant which is defined form the boundary conditions either p_out=subs(r=r_out,sigma[r]) or p_in=subs(r=r_in,sigma[r])

395000*(-4405655.099*x1+163.9344262-0.61e-2*x2/(-x1+0.3721e-4))*exp(.539*(13437.24805*x2*(-x1+0.3721e-4)-.5)^2+1.306*(13437.24805*x2*(-x1+0.3721e-4)-.5)*(0.18605e-4*x2/(-x1+0.3721e-4)-.5)+.368*(0.18605e-4*x2/(-x1+0.3721e-4)-.5)^2)-395000*(Int(exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*(3*r^6*x2-r^6-r^4*x1*x2+5*r^4*x1-7*r^2*x1^2+3*x1^3)/(r^4*(r^2-x1)^2), r = 0.54e-2 .. 0.61e-2))

(20)

 

p:=p1+p2+p0;#p is the total pressure

395000.0*(.5390*x2*(r^2-x1)/r^2-1.1920+.6530*r^2*x2/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*x2*(r^2-x1)/r^2+395000*((r^2-x1)/r^3-x2*r/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)-790000*(Int(exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*(3*r^6*x2-r^6-r^4*x1*x2+5*r^4*x1-7*r^2*x1^2+3*x1^3)/(r^4*(r^2-x1)^2), r = 0.54e-2 .. 0.61e-2))+395000*(-4405655.099*x1+163.9344262-0.61e-2*x2/(-x1+0.3721e-4))*exp(.539*(13437.24805*x2*(-x1+0.3721e-4)-.5)^2+1.306*(13437.24805*x2*(-x1+0.3721e-4)-.5)*(0.18605e-4*x2/(-x1+0.3721e-4)-.5)+.368*(0.18605e-4*x2/(-x1+0.3721e-4)-.5)^2)

(21)

#p:=H+H00;

eq1:=Int((sigma[r]-sigma[theta])/r,r=r_in..r_out);

Int((395000.0*(.5390*x2*(r^2-x1)/r^2-1.1920+.6530*r^2*x2/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*x2*(r^2-x1)/r^2-395000.0*(.6530*x2*(r^2-x1)/r^2-1.0210+.3680*r^2*x2/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*r^2*x2/(r^2-x1))/r, r = 0.54e-2 .. 0.61e-2)

(22)

eq2:=Int(2*Pi*sigma[z]*r,r=r_in..r_out);

Int(2*Pi*(-395000.0*(.5390*x2*(r^2-x1)/r^2-1.1920+.6530*r^2*x2/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*x2*(r^2-x1)/r^2-395000*((r^2-x1)/r^3-x2*r/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)+790000*(Int(exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*(3*r^6*x2-r^6-r^4*x1*x2+5*r^4*x1-7*r^2*x1^2+3*x1^3)/(r^4*(r^2-x1)^2), r = 0.54e-2 .. 0.61e-2))-395000*(-4405655.099*x1+163.9344262-0.61e-2*x2/(-x1+0.3721e-4))*exp(.539*(13437.24805*x2*(-x1+0.3721e-4)-.5)^2+1.306*(13437.24805*x2*(-x1+0.3721e-4)-.5)*(0.18605e-4*x2/(-x1+0.3721e-4)-.5)+.368*(0.18605e-4*x2/(-x1+0.3721e-4)-.5)^2))*r, r = 0.54e-2 .. 0.61e-2)

(23)

#eq1:=Quadrature((sigma[r]-sigma[theta])/r,r=r_in..r_out,method=gaussian[5],output=value):

#eq2:=Quadrature(2*Pi*sigma[z]*r,r=r_in..r_out,method=gaussian[5],output=value):

eq1=evalf(p_out-p_in)

Int((395000.0*(.5390*x2*(r^2-x1)/r^2-1.1920+.6530*r^2*x2/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*x2*(r^2-x1)/r^2-395000.0*(.6530*x2*(r^2-x1)/r^2-1.0210+.3680*r^2*x2/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*r^2*x2/(r^2-x1))/r, r = 0.54e-2 .. 0.61e-2) = -10000.

(24)

eq2=F_a

Int(2*Pi*(-395000.0*(.5390*x2*(r^2-x1)/r^2-1.1920+.6530*r^2*x2/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*x2*(r^2-x1)/r^2-395000*((r^2-x1)/r^3-x2*r/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)+790000*(Int(exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*(3*r^6*x2-r^6-r^4*x1*x2+5*r^4*x1-7*r^2*x1^2+3*x1^3)/(r^4*(r^2-x1)^2), r = 0.54e-2 .. 0.61e-2))-395000*(-4405655.099*x1+163.9344262-0.61e-2*x2/(-x1+0.3721e-4))*exp(.539*(13437.24805*x2*(-x1+0.3721e-4)-.5)^2+1.306*(13437.24805*x2*(-x1+0.3721e-4)-.5)*(0.18605e-4*x2/(-x1+0.3721e-4)-.5)+.368*(0.18605e-4*x2/(-x1+0.3721e-4)-.5)^2))*r, r = 0.54e-2 .. 0.61e-2) = .381846

(25)

fsolve({eq1=evalf(p_out-p_in),eq2=F_a},{x1,x2});

fsolve({Int((395000.0*(.5390*x2*(r^2-x1)/r^2-1.1920+.6530*r^2*x2/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*x2*(r^2-x1)/r^2-395000.0*(.6530*x2*(r^2-x1)/r^2-1.0210+.3680*r^2*x2/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*r^2*x2/(r^2-x1))/r, r = 0.54e-2 .. 0.61e-2) = -10000., Int(2*Pi*(-395000.0*(.5390*x2*(r^2-x1)/r^2-1.1920+.6530*r^2*x2/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*x2*(r^2-x1)/r^2-395000*((r^2-x1)/r^3-x2*r/(r^2-x1))*exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)+790000*(Int(exp(.539*(.5*x2*(r^2-x1)/r^2-.5)^2+1.306*(.5*x2*(r^2-x1)/r^2-.5)*(.5*r^2*x2/(r^2-x1)-.5)+.368*(.5*r^2*x2/(r^2-x1)-.5)^2)*(3*r^6*x2-r^6-r^4*x1*x2+5*r^4*x1-7*r^2*x1^2+3*x1^3)/(r^4*(r^2-x1)^2), r = 0.54e-2 .. 0.61e-2))-395000*(-4405655.099*x1+163.9344262-0.61e-2*x2/(-x1+0.3721e-4))*exp(.539*(13437.24805*x2*(-x1+0.3721e-4)-.5)^2+1.306*(13437.24805*x2*(-x1+0.3721e-4)-.5)*(0.18605e-4*x2/(-x1+0.3721e-4)-.5)+.368*(0.18605e-4*x2/(-x1+0.3721e-4)-.5)^2))*r, r = 0.54e-2 .. 0.61e-2) = .381846}, {x1, x2})

(26)

SolveEquations([eq1=evalf(p_out-p_in),eq2=F_a]);

Warning, objective function returns unfeasible value HFloat(undefined) for initial point [x1 = .9, x2 = .9]; trying to find a feasible initial point

 

Error, (in DirectSearch:-Search) cannot find feasible initial point; specify a new one

 

 

 

 

fsolve_problem.mw

Hi. i want to select terms with sum of powers equal to 1 and other terms with sum of powers more than 1 for the following equation.

restart

eq:=-2.*10^(-12)*p[1](t)*q[1](t) + 7.133360604*10^(-8)*p[1](t)*q[0](t) + 2.839877758*10^(-7)*q[0](t)*p[2](t) + p[0](t)*q[0](t) + p[0](t)^2 + q[0](t)^3 + p[1](t) + 8*q[4](t)

-0.2000000000e-11*p[1](t)*q[1](t)+0.7133360604e-7*p[1](t)*q[0](t)+0.2839877758e-6*q[0](t)*p[2](t)+p[0](t)*q[0](t)+p[0](t)^2+q[0](t)^3+p[1](t)+8*q[4](t)

(1)

 

 

Download problem.mw

 actually i need an algorithm to select linear terms from nonlinear ones(sum of powers equals to more than one) and vice versa.

Hi. i want to create a list of n random 0 and 1 numbers with x numbers equal to 1 and n-x number equal to zero.
for example in the code below, i have produced n=100 numbers of 0 and 1. But i want to create a proc that takes x as an input and generates this list with specified number of x numbers 1 and n-x numbers zero randomly. thanks for the help
 

restart:with(RandomTools):

n:=100

100

(1)

A:=[seq](Generate(choose({0, 1})),i=1..n)

[0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0]

(2)

 

 

 


 

Download problem.mw

1 2 3 4 5 6 7 Last Page 1 of 25