shimaa sadk

45 Reputation

5 Badges

7 years, 266 days

MaplePrimes Activity


These are questions asked by shimaa sadk

here my problem i work on ;

i want maple to end the enternal loop if it can't solve the equation after  some iteration maple couldnt solve the equation and get stuck

 

with(LinearAlgebra); with(VectorCalculus); with(Student[LinearAlgebra]); with(SignalProcessing); with(Statistics); with(stats)

f[1] := n/R+sum(x[i], i = 1 .. n)-(sum((2+a[i])*x[i]*exp(R*x[i])/(exp(R*x[i])-1+Q), i = 1 .. n))

f[2] := m/S+sum(y[j], j = 1 .. m)-(sum((2+b[j])*y[j]*exp(y[j]*S)/(exp(y[j]*S)-1+Q), j = 1 .. m))

f[3] := (n+m+sum(a[i], i = 1 .. n)+sum(b[j], j = 1 .. m))/Q-(sum((2+a[i])/(exp(R*x[i])-1+Q), i = 1 .. n))-(sum((2+b[j])/(exp(y[j]*S)-1+Q), j = 1 .. m))

NULL

E1[1] := 0.5e-1

E2[1] := 0.5e-1

E3[1] := 0.5e-1

n := 45; m := 45

n := 45; m := 45

a := [seq(0, i = 1 .. 21), 2, 2, 1, seq(0, i = 1 .. 21)]; b := [seq(0, i = 1 .. 21), 2, 2, 1, seq(0, i = 1 .. 21)]

lambda1 := .9; lambda2 := .1; `α_α` := 5

K := 1000

so := 1; while so < K+1 do W := GenerateUniform(n, 0, 1); for iii to n do vv[iii] := W[iii]^(1/(iii+sum(a[jjj], jjj = n-iii+1 .. n))) end do; for sss to n do uu[sss] := 1-product(vv[n-jjj+1], jjj = 1 .. sss); x[sss] := fsolve(1-`&alpha;_&alpha;`/(exp(lambda1*t)-1+`&alpha;_&alpha;`) = uu[sss], t = 0 .. infinity) end do; U := GenerateUniform(m, 0, 1); for ii to m do v[ii] := U[ii]^(1/(ii+sum(b[jj], jj = m-ii+1 .. m))) end do; for ss to m do u[ss] := 1-product(v[m-jj+1], jj = 1 .. ss); y[ss] := fsolve(1-`&alpha;_&alpha;`/(exp(lambda2*t)-1+`&alpha;_&alpha;`) = u[ss], t = 0 .. infinity) end do; c := describe[quartile[1]]([seq(x[i], i = 1 .. n)]); cc := describe[quartile[3]]([seq(x[i], i = 1 .. n)]); L := describe[quartile[1]]([seq(y[i], i = 1 .. m)]); LL := describe[quartile[3]]([seq(y[i], i = 1 .. m)]); R[1] := fsolve(9*exp(R*c)-exp(R*cc) = 8, R = 0 .. infinity); S[1] := fsolve(9*exp(S*L)-exp(S*LL) = 8, S = 0 .. infinity); Q[1] := 3*(exp(R[1]*c)-1+(exp(S[1]*L)-1))*(1/2); for h to 40 while `and`(`and`(`and`(`and`(`and`(abs(E1[h]) > 0.5e-3, abs(E2[h]) > 0.5e-3), abs(E3[h]) > 0.5e-3), Q[h] > 2), S[h] > 0), R[h] > 0) do printlevel := 2; Q[h+1] := fsolve(eval(f[3], {R = R[h], S = S[h]}) = 0, Q = 0 .. infinity); S[h+1] := fsolve(eval(f[2], Q = Q[h+1]) = 0, S = 0 .. infinity); R[h+1] := fsolve(eval(f[1], Q = Q[h+1]) = 0, R = 0 .. infinity); if fsolve(eval(f[3], {R = R[h], S = S[h]}) = 0, Q = 0 .. infinity) = NULL then break end if; if fsolve(eval(f[2], Q = Q[h+1]) = 0, S = 0 .. infinity) = NULL then break end if; if fsolve(eval(f[1], Q = Q[h+1]) = 0, R = 0 .. infinity) = NULL then break end if; E1[h+1] := abs(R[h+1]-R[h]); E2[h+1] := abs(S[h+1]-S[h]); E3[h+1] := abs(Q[h+1]-Q[h]); KK := Matrix([[R[h]], [S[h]], [Q[h]]]) end do; A[so] := Determinant(KK[1]); B[so] := Determinant(KK[2]); C[so] := Determinant(KK[3]); so := so+1 end do

Error, cannot determine if this expression is true or false: 0 < K

 

NULL

NULL


 

Download Q3.mw

 

 

 

 

 

 

 

 

 

 

 

 

 

 

how to say im maple 
if you couldn't solve the equation F(X)=0 set X=a ?

how to write in mape 
if x not real set x =b

i have a prablem i work on it consiste of  aloop of 1000 iteration ,  and  apart of it evaluate the following sum  and integration  but maple either take very long time  about (12 hours) in evaluating it  (and it's very long )

 

or it get stuck . Is there any way to make maple evaluate this sum and integration  very quickely and didnt get stuck 


 

NULL

`&lambda;&lambda;`[1] := .1111111; `&lambda;&lambda;`[2] := 2222222; `&alpha;&alpha;` := 1.51222222

P := simplify(sum(sum((t+1)*`&alpha;&alpha;`^2*(1-`&alpha;&alpha;`)^(t+T)/(t+1+`&lambda;&lambda;`[1]*(T+1)/`&lambda;&lambda;`[2]), t = 0 .. infinity), T = 0 .. infinity))

Warning,  computation interrupted

 

r[1] := exp(-C*(int(lambda[1]*alpha^2*exp(lambda[1]*Z)/((exp(lambda[1]*Z)-1+alpha)^2*(exp(lambda[2]*Z)-1+alpha)), Z = 0 .. infinity, numeric)));

exp(-C*(int(lambda[1]*alpha^2*exp(lambda[1]*Z)/((exp(lambda[1]*Z)-1.+alpha)^2*(exp(lambda[2]*Z)-1.+alpha)), Z = 0. .. Float(infinity))))

(1)

``

R[1] := diff(r[1], lambda[1]):

 

lambda[1] := 1.117480:

``

C := -2:

r_r[1] := evalf(r[1]);

6.833764322

 

.5388679374

 

-1.033616758

 

4.934912438

 

-0.3143256678e-1

 

-4.822756149

 

4.934912438

 

-5.541440349

 

.2813149492

 

0.4011667571e-1

 

-0.3143256678e-1

 

.2813149492

 

-0.7207815680e-2

(2)

NULL


 

D

 

  here my loop; after  8 iteration maple couldnt solve the equations and give me this error .
Is there any method to garentee that fsolve could work intire the 1000 iteration 
 

 
 
 

Download exp_new_for_alpha_more_than_22.mw
 

with(LinearAlgebra):

f[1] := VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`*`(n, 1/R), sum(x[i], i = 1 .. n)), VectorCalculus:-`-`(sum(VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`+`(2, a[i]), x[i]), exp(VectorCalculus:-`*`(R, x[i]))), 1/VectorCalculus:-`+`(VectorCalculus:-`+`(exp(VectorCalculus:-`*`(R, x[i])), -1), Q)), i = 1 .. n))):

f[2] := VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`*`(m, 1/S), sum(y[j], j = 1 .. m)), VectorCalculus:-`-`(sum(VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`+`(2, b[j]), y[j]), exp(VectorCalculus:-`*`(y[j], S))), 1/VectorCalculus:-`+`(VectorCalculus:-`+`(exp(VectorCalculus:-`*`(y[j], S)), -1), Q)), j = 1 .. m))):

f[3] := VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`*`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(n, m), sum(a[i], i = 1 .. n)), sum(b[j], j = 1 .. m)), 1/Q), VectorCalculus:-`-`(sum(VectorCalculus:-`*`(VectorCalculus:-`+`(2, a[i]), 1/VectorCalculus:-`+`(VectorCalculus:-`+`(exp(VectorCalculus:-`*`(R, x[i])), -1), Q)), i = 1 .. n))), VectorCalculus:-`-`(sum(VectorCalculus:-`*`(VectorCalculus:-`+`(2, b[j]), 1/VectorCalculus:-`+`(VectorCalculus:-`+`(exp(VectorCalculus:-`*`(y[j], S)), -1), Q)), j = 1 .. m))):

NULL

E1[1] := 0.5e-1:

E2[1] := 0.5e-1:

E3[1] := 0.5e-1:

n := 45:

n := 45:

a := [seq(0, i = 1 .. 21), 2, 2, 1, seq(0, i = 1 .. 21)]:

NULL

K := 1000:

for so from 0 to K do W := GenerateUniform(n, 0, 1); for iii to n do vv[iii] := W[iii]^(1/(iii+sum(a[jjj], jjj = n-iii+1 .. n))) end do; for sss to n do uu[sss] := 1-product(vv[n-jjj+1], jjj = 1 .. sss); x[sss] := fsolve(1-3/(exp(.3*t)-(1-3)) = uu[sss], t = 0 .. infinity) end do; U := GenerateUniform(m, 0, 1); for ii to m do v[ii] := U[ii]^(1/(ii+sum(b[jj], jj = m-ii+1 .. m))) end do; for ss to m do u[ss] := 1-product(v[m-jj+1], jj = 1 .. ss); y[ss] := fsolve(1-3/(exp(.1*t)-(1-3)) = u[ss], t = 0 .. infinity) end do; c := describe[quartile[1]]([seq(x[i], i = 1 .. n)]); cc := describe[quartile[3]]([seq(x[i], i = 1 .. n)]); L := describe[quartile[1]]([seq(y[i], i = 1 .. m)]); LL := describe[quartile[3]]([seq(y[i], i = 1 .. m)]); R[1] := fsolve(9*exp(R*c)-exp(R*cc) = 8, R = 0 .. infinity); S[1] := fsolve(9*exp(S*L)-exp(S*LL) = 8, S = 0 .. infinity); Q[1] := 3*(exp(R[1]*c)-1+(exp(S[1]*L)-1))*(1/2); for h to 40 while `and`(`and`(`and`(`and`(`and`(abs(E1[h]) > 0.5e-3, abs(E2[h]) > 0.5e-3), abs(E3[h]) > 0.5e-3), Q[h] > 2), S[h] > 0), R[h] > 0) do Q[h+1] := fsolve(eval(f[3], {R = R[h], S = S[h]}) = 0, Q = 2 .. infinity); R[h+1] := fsolve(eval(f[1], Q = Q[h+1]) = 0, R = 0 .. infinity); S[h+1] := fsolve(eval(f[2], Q = Q[h+1]) = 0, S = 0 .. infinity); KK := Matrix([[R[h]], [S[h]], [Q[h]]]); E1[h+1] := abs(R[h+1]-R[h]); E2[h+1] := abs(S[h+1]-S[h]); E3[h+1] := abs(Q[h+1]-Q[h]) end do; A[so] := Determinant(KK[1]); B[so] := Determinant(KK[2]); C[so] := Determinant(KK[3]); P[so] := simplify(int(A[so]*C[so]^2*exp(A[so]*x)/((exp(A[so]*x)-1+C[so])^2*(exp(B[so]*x)-1+C[so])), x = 0 .. infinity, numeric)) end do

W := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

U := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

c := 2.251942600

 

cc := 6.413093396

 

L := 8.631577783

 

LL := 25.39584518

 

R[1] := .4287243564

 

S[1] := .1043333848

 

Q[1] := 4.630481096

 

A[0] := .4247642181

 

B[0] := .1149899971

 

C[0] := 6.627593396

 

P[0] := .8815279215

 

W := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

U := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

c := 2.918917328

 

cc := 5.547621812

 

L := 3.857225847

 

LL := 21.10240063

 

R[1] := .8018219086

 

S[1] := 0.5213484487e-1

 

Q[1] := 14.41300577

 

A[1] := .3666457947

 

B[1] := .1191082759

 

C[1] := 3.847329446

 

P[1] := .8226338823

 

W := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

U := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

c := 2.442365249

 

cc := 7.394009487

 

L := 4.713824874

 

LL := 24.79260797

 

R[1] := .3468711931

 

S[1] := 0.4792653690e-1

 

Q[1] := 2.379817029

 

A[2] := .2337020019

 

B[2] := 0.7824619488e-1

 

C[2] := 2.252708122

 

P[2] := .7880876611

 

W := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

U := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

c := 1.950620121

 

cc := 7.490968154

 

L := 7.989340649

 

LL := 22.40840798

 

R[1] := .2570696142

 

S[1] := .1248268277

 

Q[1] := 3.543022180

 

A[3] := .3254617069

 

B[3] := .1177911768

 

C[3] := 4.708933240

 

P[3] := .8124474245

 

W := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

U := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

c := 1.973241013

 

cc := 7.005418646

 

L := 6.495611086

 

LL := 22.94839275

 

R[1] := .3034319432

 

S[1] := 0.9318350072e-1

 

Q[1] := 2.477406387

 

A[4] := .3446953632

 

B[4] := .1065224704

 

C[4] := 4.241185270

 

P[4] := .8370643415

 

W := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

U := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

c := 1.839457984

 

cc := 7.186959772

 

L := 6.911480924

 

LL := 24.15316459

 

R[1] := .2619901249

 

S[1] := 0.8971740871e-1

 

Q[1] := 2.217385534

 

A[5] := .2889717346

 

B[5] := 0.8838227764e-1

 

C[5] := 2.965514897

 

P[5] := .8196572233

 

W := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

U := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

c := 2.075842156

 

cc := 6.451509594

 

L := 7.355551514

 

LL := 22.57154486

 

R[1] := .3857437868

 

S[1] := .1118795995

 

Q[1] := 3.756557664

 

A[6] := .3672067772

 

B[6] := .1169243938

 

C[6] := 4.269406267

 

P[6] := .8320277948

 

W := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

U := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

c := 2.052084434

 

cc := 5.954773664

 

L := 7.287571569

 

LL := 19.13650694

 

R[1] := .4519986760

 

S[1] := .1574582015

 

Q[1] := 5.517824640

 

A[7] := .3834726657

 

B[7] := .1300598692

 

C[7] := 4.443377611

 

P[7] := .8222904412

 

W := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

U := Vector(4, {(1) = ` 1 .. 45 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*C_order})

 

1.288903514

 

6.337860209

 

6.623173031

 

20.57453160

 

.2114575385

 

.1210220497

 

2.313450170

 

Error, (in fsolve) Q is in the equation, and is not solved for

 

a := [seq(A[i], i = 1 .. 1000)]:

for i to 1000 do aa_[i] := `if`(0 < P[i] and P[i] < 1, a[i], 0); bb_[i] := `if`(0 < P[i] and P[i] < 1, b[i], 0); cc_[i] := `if`(0 < P[i] and P[i] < 1, c[i], 0); gg_[i] := `if`(0 < P[i] and P[i] < 1, p[i], 0) end do:

NULL

Tau := [seq(aa_[i], i = 1 .. 1000)]:

rr := [seq(`if`(Tau[i] = 0, NULL, i), i = 1 .. 1000)]:

r := Tau[rr]:

1000

 

1000

 

1000

 

1000

(1)

lambda[1] := Mean([seq(r[i], i = 1 .. nops(r))]); lambda[2] := Mean([seq(s[i], i = 1 .. nops(s))]); alpha := Mean([seq(q[i], i = 1 .. nops(q))]); Pro := Mean([seq(w[i], i = 1 .. nops(w))]); Bi_ := .647737-Pro; ME_ := Bi_^2

Error, (in Statistics:-Mean) unable to evaluate `if`(0 < P[8] and P[8] < 1, a[i], 0) to floating-point

 

Error, (in Statistics:-Mean) unable to evaluate `if`(0 < P[8] and P[8] < 1, b[i], 0) to floating-point

 

Error, (in Statistics:-Mean) unable to evaluate `if`(0 < P[8] and P[8] < 1, c[i], 0) to floating-point

 

Error, (in Statistics:-Mean) unable to evaluate `if`(0 < P[8] and P[8] < 1, p[i], 0) to floating-point

 

.647737-Pro

 

(.647737-Pro)^2

(2)

NULL


 

Download exp_new_for_alpha_more_than_22.mw

 

3 4 5 6 7 8 Page 5 of 8