mehdi jafari

769 Reputation

13 Badges

11 years, 237 days

MaplePrimes Activity


These are replies submitted by mehdi jafari

@Carl Love could please introduce the syntax of using this commands?

@Alfred_F thank you, i solved the problem as you commented

@vv what is the relation between left and right eigenvectors? should multiplication of them give the IdentityMatrix? but in maple i cannot achive this? how can i find diagonal form of the matrix using these eigenvectors? thank you for the help.

@mmcdara as u mentioned above, what is the idea for solving my problem? what should i use ?

@mmcdara @Carl Love @acer 

thank you for the responses. there are some points which i explain in the following:
1. @mmcdara when you do not set any method for the optimization, it means that maple itself will search for the proper method according to the help. only when the method is set modifiednewton maple can find an answer and for other methods such as sqp, maple can not find an answer and we got divison by zero error
2. is there any reason that you choosed those ranges for "x"s;(i.e  7..10, 5..10, 1..10). since for other ranges we can not reach an answer except with modifiednewton method.
3. dear @acer , actually we do NOT have any atitude on the integration's value, but on the modified code by @mmcdara the result is 2.204832770*10^6 which is positive. Could you please explain me why those values are wrong and what values for the integration are expected? actually i want to use your inforamtion for deeper understanding of the problem for further problems. 


 

restart:with(LinearAlgebra):

N:=3:

m:=Vector([ 1 , log(x+b3) , b2/(x+b3) ]):

A:=m.m^+:

for i to N do
m||i:=eval(A,[x=x||i]);
od:

M:=add(w||i*m||i,i=1..N-1)+(1-add(w||i,i=1..N-1))*m||N:

MM:=( LinearAlgebra:-Trace(MatrixInverse(M)) ):

IF1 := proc(__w1, __w2, __x1, __x2, __x3)
  local J:
  J := evalf(
         Int(
           eval(MM, [w1=__w1, w2=__w2, x1=__x1, x2=__x2, x3=__x3])
           , [b2=1..2,b3=1..2]
           , method = _d01ajc
           , epsilon=0.001
         )
       ):
   #print([_passed], J);
  return J:
end proc:

# check

IF1(0.6, .1, 8, 7, 5);

2204832.770

(1)

s:= Optimization:-NLPSolve(
  IF1
  , 0..1, 0..1, 1..10, 1..10, 1..10
  , initialpoint=[0.6, .1, 8, 7, 5]
  , maximize=false
  , method=modifiednewton
)

Warning, convergence is not assured; examine Hessian values, or consider raising tolerance

 

[1077.30026359427006, Vector(5, {(1) = .2390983436806223, (2) = .5071151402152273, (3) = 10.0, (4) = 3.400128412709433, (5) = 1.0})]

(2)

 

 

 

 

 


 

LinearLog-A-Bayesian_1_mmcdara_moodified_newton.mw

LinearLog-A-Bayesian_mmcdara3_sqp_method.mw


thank you for your patience and attention.
sincerely yours.

@acer Actually, we are looking for a design for the model which finds minimum for the Information Matrix. The design points are x1,x2 and x3 and the weights are w1,w2 and 1-(w1+w2).
The information matrix is M. 
According to the Beysian approach, ranges of b1 and b2 are considered. 
we are looking for a global optimum; although in convex optimization problems, a locally optimal solution is also globally optimal.
The ranges for "w"s are necessary, but for "x"s we can consider identical ranges for them.
we thought that the integration is complicated so that we used this method, but if another simple way can be adopted, we gratefully will use that. 
Thanks for your attention and help.

@Miguel_Vega as you mentioned, just supress that line using # in front of the command and just restart the code.

@tomleslie actually you are right, but the problem is the same pde with replacing z^2 with z, can be solved with these boundary/initial conditions. thus the analytical solution can be found, but maple can not do it for this problem.
thank you for your answer.

 

restart

pde__1 := diff(z(x, t), `$`(t, 2))-(diff(z(x, t), `$`(x, 2)))+z(x, t)^2 = 6*x*t*(-t^2+x^2)+x^6*t^6

diff(diff(z(x, t), t), t)-(diff(diff(z(x, t), x), x))+z(x, t)^2 = 6*x*t*(-t^2+x^2)+x^6*t^6

(1)

conds__1 := z(x, 0) = 0, z(0, t) = 0, z(1, t) = t^3

pdsolve([pde__1, conds__1])

pde__2 := diff(z(x, t), `$`(t, 2))-(diff(z(x, t), `$`(x, 2)))+z(x, t) = 6*x*t*(-t^2+x^2)+x^6*t^6

diff(diff(z(x, t), t), t)-(diff(diff(z(x, t), x), x))+z(x, t) = 6*x*t*(-t^2+x^2)+x^6*t^6

(2)

conds__2 := z(x, 0) = 0, z(0, t) = 0, z(1, t) = t^3

pdsolve([pde__2, conds__2], z(x, t))

z(x, t) = -(Sum(12*sin(n*Pi*x)*((1/12)*n^4*(Pi^2*n^2+1)*Pi^4*((-12*Pi^2*n^2+72)*(-1)^n*(Pi^2*n^2+1)^(1/2)+_C1[n]*n^3*Pi^3*(Pi^2*n^2+1)^2)*cos((Pi^2*n^2+1)^(1/2)*t)+(-86400+(-120*Pi^6*n^6+3600*Pi^4*n^4-43200*Pi^2*n^2+86400)*(-1)^n)*sin((Pi^2*n^2+1)^(1/2)*t)+(((Pi^6*n^6-30*Pi^4*n^4+360*Pi^2*n^2-720)*(Pi^2*n^2+1)^2*t^5+(-20*Pi^8*n^8+580*Pi^6*n^6-6600*Pi^4*n^4+7200*Pi^2*n^2+14400)*t^3-(7/2)*Pi^6*n^6*(Pi^2*n^2+1)^2*t^2+(120*Pi^6*n^6-3600*Pi^4*n^4+43200*Pi^2*n^2-86400)*t+n^8*Pi^8-5*Pi^6*n^6-6*Pi^4*n^4)*(-1)^n+720*(120+(Pi^2*n^2+1)^2*t^4+(-20*Pi^2*n^2-20)*t^2)*t)*(Pi^2*n^2+1)^(1/2)-(1/12)*_C1[n]*n^7*Pi^7*(Pi^2*n^2+1)^3)/((Pi^2*n^2+1)^(7/2)*n^7*Pi^7), n = 1 .. infinity))+t^3*x

(3)

NULL


 

Download pde_(2).mw

@tomleslie thank you for your explanation. i think i have made a mistake, tnx alot.

@Carl Love thank you for your answer, but therr is a problem. 

The polynomials are correct  but betas are not correct and are different from the betas in equations above. 

Are the betas in this procedure identical with the ones in the equation?

 

@Carl Love is seq[reduce= `+`] equivalent to `+`(seq) ? it seems the latter is more efficient. Am i wrong?
on my question on page https://www.mapleprimes.com/questions/233919-Repated-Summetion, i reffered here. but i couldn't find out how to code nested loops. are nested loops explaind here?

restart:
Iterator:-CartesianProduct([1,1]): #Force compilation

P:= 2..4: #suffixes of m and c variables
N:= [$0..4]: #evaluation values of m variables

B:= subs(
    {_C= [$P], _V= [c||P]},
    proc(M)
    local r:= add(M*~_C), s:= 1+r, t:= s-add(M);
        r!*c0^t*mul(_V^~M)/t!/mul(M!~)/c1^s
    end proc
):
CodeTools:-Usage(
    seq[reduce= `+`](B(v), v= Iterator:-CartesianProduct(N$(rhs(P)-1)))
):

memory used=0.69MiB, alloc change=0 bytes, cpu time=16.00ms, real time=14.00ms, gc time=0ns

 

restart:
Iterator:-CartesianProduct([1,1]): #Force compilation

P:= 2..4: #suffixes of m and c variables
N:= [$0..4]: #evaluation values of m variables

B:= subs(
    {_C= [$P], _V= [c||P]},
    proc(M)
    local r:= add(M*~_C), s:= 1+r, t:= s-add(M);
        r!*c0^t*mul(_V^~M)/t!/mul(M!~)/c1^s
    end proc
):
CodeTools:-Usage(
    `+`(seq(B(v), v= Iterator:-CartesianProduct(N$(rhs(P)-1))))
):

memory used=395.63KiB, alloc change=0 bytes, cpu time=0ns, real time=7.00ms, gc time=0ns

 

 

Download seq.mw

@Carl Love yes as you said,  t[j] and t[i] are symbolic variables independent of t .the definiton of t[j] is as follows:

which if not of importance to use it here. i just want to know whether these summations and product can be coded?
tnx for the help

@mmcdara thank you for you comprehensive explanations. interesting code it was.

@tomleslie tnx for your attention. 

Actually i want equation one in terms of other functions and variables and differential opertors so that equation 1 doesn't contain the function psi(x,t).

Actually if i could write equation 2 in terms differential operators and then factor psi(x,t) (sth like isolating psi(x,t) in terms of other functions), i could replace it in equation 1 so that equation 1 does NOT contain any psi(x,t).

is it clear now?

can it be done by factoring differential operators and NOT directly using dsolve?

@acer Thank you for clarifying explanations, actually we want to compare the results both qualitatively and quantitatively with the results of an article. But when mu=0 or mu=1 , there is an unwanted pick in the plot a shown blow:

For mu=8, qualitative asnwer is correct.

Here is the article:

2_5348170783959026711.pdf

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