mmcdara

7891 Reputation

22 Badges

9 years, 50 days

MaplePrimes Activity


These are answers submitted by mmcdara

The reason why is explained in the attached file.
(Note that the main problem comes from your defining four constraints whereas there can't be more than two -as  you write-,  see the attached file).

Parameter whose numeric values have to be given are [Pu, U, a, beta, eta, tau0, upsilon, varphi, w].

Once done you will get 3 solutions which depend on {Cm, Cr, lambda, varepsilon}.  
The fact the inside point is a maximum or a minimum depends on lambda  and varepsilon and it is impossible to conclude as long as (1) they are not given numeric values or (2) some assumption on lambda (see relation (16) ).

Q_P1_Optimum_condition(1)_mmcdara.mw

Watchout: the last results (lambda-varepsilon relation  in equation (16) ) and plots:-inequal depend on the seed used and will change if you execute the data := ...; command without restarting the code (for the seed changes).


Indeed, isolate help page says "If the first argument is not an equation, then the equation eqn = 0; is assumed."

Here are very simple examples where isolate does nor return the (likely) expected result

isolate(p+b <= d, p) 
                          p <= -b + d
isolate(a*p+b <= d, p); # the solution depends on the sign of a
                         a p <= -b + d
# if a > 0
assume(a > 0):
isolate(a*p+b <= d, p);

                               -b + d
                          p <= ------
                                 a   
# if a < 0... attempt 1
a := 'a': 
assume(a < 0): 
isolate(a*p+b <= d, p);     
                    p a <= -b + d
# if a < 0... attempt 2
a := 'a': b := 'b': d := 'd':
assume(a < 0, b > 0, d > b):
isolate(a*p+b <= d, p);
                          p a <= d - b
# and even simpler
​​​​​​​isolate(-3*p <= 2, p);
                           -3 p <= 2


So I advice you using solve instead
 

restart

with(Optimization):

NULL

NULL

B := w+Ce:

(B-A*(2*U*upsilon+1)/upsilon)/(2*(U*upsilon+1)) <= (varphi*(-beta*p1+a)-A)/upsilon;

(w+Ce-((1/3)*varphi*(-beta*p1+a)-upsilon*Pu)*(2*U*upsilon+1)/upsilon)/(2*U*upsilon+2) <= ((2/3)*varphi*(-beta*p1+a)+upsilon*Pu)/upsilon

(1)

L := convert(indets((1), name) minus{p1}, list);

[Ce, Pu, U, a, beta, upsilon, varphi, w]

(2)

p1 := unapply(solve((w+Ce-((1/3)*varphi*(-beta*p1+a)-upsilon*Pu)*(2*U*upsilon+1)/upsilon)/(2*U*upsilon+2) <= ((2/3)*varphi*(-beta*p1+a)+upsilon*Pu)/upsilon, p1), L); p1(op(L))

piecewise(And((1/2)*varphi*beta*(6*U*upsilon+5)/(U*upsilon+1) = 0, 0 <= -(1/6)*(-6*U*a*upsilon*varphi+3*Ce*upsilon-3*Pu*upsilon-5*a*varphi+3*upsilon*w)/(upsilon*(U*upsilon+1))), [{p1 = p1}], And(0 < (1/6)*varphi*beta*(6*U*upsilon+5)/(upsilon*(U*upsilon+1)), 0 <= (1/6)*varphi*beta*(6*U*upsilon+5)/(upsilon*(U*upsilon+1))), [{p1 <= -(-6*U*a*upsilon*varphi+3*Ce*upsilon-3*Pu*upsilon-5*a*varphi+3*upsilon*w)/((6*U*upsilon+5)*beta*varphi)}], And(0 < (1/6)*varphi*beta*(6*U*upsilon+5)/(upsilon*(U*upsilon+1)), (1/6)*varphi*beta*(6*U*upsilon+5)/(upsilon*(U*upsilon+1)) < 0), [{p1 <= -(-6*U*a*upsilon*varphi+3*Ce*upsilon-3*Pu*upsilon-5*a*varphi+3*upsilon*w)/((6*U*upsilon+5)*beta*varphi)}, {-(-6*U*a*upsilon*varphi+3*Ce*upsilon-3*Pu*upsilon-5*a*varphi+3*upsilon*w)/((6*U*upsilon+5)*beta*varphi) <= p1}], And((1/6)*varphi*beta*(6*U*upsilon+5)/(upsilon*(U*upsilon+1)) < 0, (1/6)*varphi*beta*(6*U*upsilon+5)/(upsilon*(U*upsilon+1)) <= 0), [{-(-6*U*a*upsilon*varphi+3*Ce*upsilon-3*Pu*upsilon-5*a*varphi+3*upsilon*w)/((6*U*upsilon+5)*beta*varphi) <= p1}], [])

(3)

p1(`$`(1 .. 8))

[{p1 <= 434/565}]

(4)

 


 

Download Q_solve.mw

 

D is a protected name which stands for Derivative, search for D in the help page.

Insert the line  local D; before line # Define coefficients for RSM (adjust as needed)
RSM_model.mw


I am right with @Rouben Rostamian : the area of degenarate ("flat") triangle is 0 and the collinearity condition is not mandatory tp compute the area.

Nevertheless some other constructions based on the triangle (excircle, circumcircle, ...) require that the triangle is not degenerate. I fell like the non collinearity condition is introduced from the start (the triangle command) to avoid asking him each time it becomes mandatory.

The attached file provides a way to assume the non collinearity condition without copying and pasting it manually as you did.
Triangle_given_condition.mw

You wrote "Under what conditions on the parameters does the lower bound condition become violated while the upper bound condition is also violated?"

If you maximize/minimize some function under inequality constraints defining a multidimensional domain D, and if some of them arestrict inequalities, either the extremum lies in the open D, either it belongs to the boundary of D. But the constraints are never violated.

Whatever, does this suit you?
Q_Const_mmcdara.mw

By the way, you use both U and U[0], which is dangerous and may lead to wrong results.
So I changed U[0] into U__0.

The 'optimize' option in CodeGeneration doesn't seem capable to get the representation you desire (with Maple 2015.2)

So I propose you a code (not written as a procedure in order you can see easili how it works without using the debugger) which could suit you.

Basically it "extracts" all the indeterminates of any type from an expression (possibly a matrix of expressions), iteratively build rewritting rules (your t1 = a*b*c or t2 = d+e) and next apply them to the expression (M) to "reduce" it.
There are several possibilities, which depend on the order in which you consider those indeterminates (a point that I did not realy investigate) and on how much rewritting rules you use.
For instance if M is a 2-by-2 matrix whose elements are very lengthy expressions, then a hypothetical CodeGeneration output like this one would give the most compact form of some "optimized M"

t1 = M[1, 1]
t2 = M[1, 2]
t3 = M[2, 1]
t4 = M[2, 2]
M[1, 1] = t1
M[1, 2] = t2
M[2, 1] = t3
M[2, 2] = t4

But this to the detriment of lenghty expressions of t1, ..., t4.

So I defined a complexity measure to rank those possibilities according to the "complexity" of the transformed expression of M.

As you will see adding more rules does not necessarily over simplify theis expression.
For instance, according to the complexity measure I choosed, here is a simpler representation of M:

t1 = d+e
t2 = a*b*c
t3 = t1*t2
M[1] = t3
M[2] = t2-t1

A more complicated example than yours is also presented and a new complexity measure, which accounts both for the rewritting rules and the final representation of M is proposed.
Optimized_code_0.mw

NOTE: this code will likely fail if tested on more complex situations.

that could interest you:

  1. How to define a truncated normal random variable and sample it efficiently?
    (drawing a sample of size 40 with the acceptation/rejection code you write does is rather fast... but what if you want to draw a sample of size 104, or more?
     
  2. Tally: function to get frequencies (a TallyInto also exists)
     
  3. FrequencyTable: a function to get more informations about frequencies (this point is related to section Ajouter les fréquences & fréquences cumulées).
     
  4. Histogram(..., discrete=true) to get a bargraph.
     
  5. ... and maybe a few others
     
  6. About your first "tableau"  (Mettre les données brutes dans un tableau), you could use DocumentTools:-Layout (see the corresponding help page ant the exemples provided) to ebhance ir. For ewample by giving rows names which refer to the distributions those numbers are drawn from.
    More of this you could make nu and varphi appear as greek letters directly.
     

Truncated_Normal_Distribution.mw

You will find in worksheet Generating_random_number_efficiently.mw that the maon cause of the inefficiency of your code is that you generate each random number once at the time.
I show how to generate all of them in a row (even for a truncated law) and thus enhance dramatically the performance of the code.


The first 52 roots with |error| < 1e-7: Find_roots.mw

Apply yourself the same stuff for case 2.

Note: the index in your for loop should not be varepsilon, that is too dangerous: look to this

restart:
f := a*varepsilon^2:

for varepsilon from 1 to 2 do
  f;
end do;

f;  #the value of the index being equal to 3
                               a
                              4 a
                              9 a
#-----------------------------------------------------
restart:
f := a*varepsilon^2:

for val from 1 to 2 do
  eval(f, varepsilon=val)
end do;

f;
                               a
                              4 a
                                     2
                         a varepsilon 

 

See Question_New_mmcdara.mw for case 1... the plot you aske for will not give you any valuable informations given the ranges of variations of Pc, p1 and p2.

More of this analytic solutions are easily got:

  1. Your first maximization problem can be solved formally using lagragian multipliers.
  2. Your second maximization problem is even simpler as it reduces to maximize a function (TP) which is quadratic wrt p1 and p2.
    Taking its first partial derivatives show that diff(TP, p1) = A(varepsilon)*p1+B(varepsilon) ... but diff(TP, p2) = C*p2+D: so the "optimum" p2 does not depend on varepsilon.
    Plotting "optimum" p2 against varepsilon is thus useless.

     

    restart

    NULL

    DATA := [Cm = 14000, U[0] = 100, Cr = 4000, a = 19000, U = 5000, w = 3000, lambda = .9, tau0 = .4, k = 20000, Pu = 650, beta = .8, upsilon = .7, varphi = .8, t = 1000]:

    L_wout := proc (p1, p2) options operator, arrow; (p1-Cm)*(-beta*p1+a)+lambda*(((1/3)*varphi*(-beta*p1+a)-upsilon*(Pu-Pc))*(-varepsilon*p1-Cr+p2-w)+(-beta*p2+a-(1/3)*varphi*(-beta*p1+a)+upsilon*(Pu-Pc))*(p2-Cm)+k*((1/3)*varphi*(-beta*p1+a)-upsilon*(Pu-Pc)-tau0*(-beta*p1+a))) end proc:

    R_wout := proc (Pc) options operator, arrow; lambda*(w*((1/3)*varphi*(-beta*p1+a)-upsilon*(Pu-Pc))+varepsilon*p1*((1/3)*varphi*(-beta*p1+a)-upsilon*(Pu-Pc))-Pc*((1/3)*varphi*(-beta*p1+a)-upsilon*(Pu-Pc))-U*((1/3)*varphi*(-beta*p1+a)-upsilon*(Pu-Pc))+U[0]*((1/3)*varphi*(-beta*p1+a)-upsilon*(Pu-Pc))^2) end proc:

    C1 := {-((1/3)*varphi*(-beta*p1+a)-upsilon*Pu)/upsilon <= Pc}:

    C2 := {Pc <= (2*varphi*(-beta*p1+a)*(1/3)+upsilon*Pu)/upsilon}:

    C_11 := subs(p1 = (-6*beta*k*lambda*tau0*upsilon*U[0]+Cm*beta*lambda*varphi-6*Cm*beta*upsilon*U[0]-3*Cm*lambda*upsilon*varepsilon-Cr*beta*lambda*varphi+3*Cr*lambda*upsilon*varepsilon-3*Pu*lambda*upsilon*varepsilon-3*U*lambda*upsilon*varepsilon+a*lambda*varphi*varepsilon-6*beta*k*lambda*tau0+beta*k*lambda*varphi-beta*lambda*varphi*w-3*k*lambda*upsilon*varepsilon+6*lambda*upsilon*w*varepsilon-6*a*upsilon*U[0]-6*Cm*beta-6*a)/(2*(beta*lambda*varphi*varepsilon-3*lambda*upsilon*varepsilon^2-6*beta*upsilon*U[0]-6*beta)), C1):

    C_21 := subs(p1 = (-6*beta*k*lambda*tau0*upsilon*U[0]+Cm*beta*lambda*varphi-6*Cm*beta*upsilon*U[0]-3*Cm*lambda*upsilon*varepsilon-Cr*beta*lambda*varphi+3*Cr*lambda*upsilon*varepsilon-3*Pu*lambda*upsilon*varepsilon-3*U*lambda*upsilon*varepsilon+a*lambda*varphi*varepsilon-6*beta*k*lambda*tau0+beta*k*lambda*varphi-beta*lambda*varphi*w-3*k*lambda*upsilon*varepsilon+6*lambda*upsilon*w*varepsilon-6*a*upsilon*U[0]-6*Cm*beta-6*a)/(2*(beta*lambda*varphi*varepsilon-3*lambda*upsilon*varepsilon^2-6*beta*upsilon*U[0]-6*beta)), C2):

    C_1 := subs(DATA, C_11):

    C_2 := subs(DATA, C_21):

    NULL

    TRC_1 := proc (Pc) options operator, arrow; subs(p1 = (-6*beta*k*lambda*tau0*upsilon*U[0]+Cm*beta*lambda*varphi-6*Cm*beta*upsilon*U[0]-3*Cm*lambda*upsilon*varepsilon-Cr*beta*lambda*varphi+3*Cr*lambda*upsilon*varepsilon-3*Pu*lambda*upsilon*varepsilon-3*U*lambda*upsilon*varepsilon+a*lambda*varphi*varepsilon-6*beta*k*lambda*tau0+beta*k*lambda*varphi-beta*lambda*varphi*w-3*k*lambda*upsilon*varepsilon+6*lambda*upsilon*w*varepsilon-6*a*upsilon*U[0]-6*Cm*beta-6*a)/(2*beta*lambda*varphi*varepsilon-6*lambda*upsilon*varepsilon^2-12*beta*upsilon*U[0]-12*beta), R_wout(Pc)) end proc:

    TRC := subs(DATA, TRC_1(Pc)):


    ANALYTIC SOLUTION

    obj   := TRC:
    cstr  := [C_1[], C_2[]]:
    H     := lambda__1*(lhs(cstr[1])-Pc), lambda__2*(Pc-rhs(cstr[2])):
    lag   := obj + add(H):
    sols  := [solve([diff(lag, Pc), H], {Pc, lambda__1, lambda__2})]:
    sols  := map(s -> if eval(lambda__1^2+lambda__2^2, s) = 0 then NULL else s end if, sols):
    objs  := map(s -> eval(diff(obj, Pc), s), sols):
    pairs := zip((s, t) -> [eval(Pc, s), t], sols, objs);

    print():print():

    TP_1   := eval(L_wout(p1, p2), sols[1]):
    TP     := collect(subs(DATA, TP_1), [p1, p2]):
    sol    := solve(diff~(TP, [p1, p2]), {p1, p2}):
    triple := eval([p1, p2, TP], sol);

    [[0.7500000000e-7*(0.6353000002e14*varepsilon^2-0.4804876192e14*varepsilon+0.1091355427e16)/(315.*varepsilon^2-96.*varepsilon+56800.), 575659.5001+.63*varepsilon*(-42358.50*varepsilon-15303408.00)/(-3.78*varepsilon^2+1.152*varepsilon-681.60)-26.68799999*(-42358.50*varepsilon-15303408.00)/(-3.78*varepsilon^2+1.152*varepsilon-681.60)+0.6520500000e-5*(0.6353000002e14*varepsilon^2-0.4804876192e14*varepsilon+0.1091355427e16)/(315.*varepsilon^2-96.*varepsilon+56800.)], [-0.9000000000e-6*(0.2305833334e13*varepsilon^2-0.1898031746e13*varepsilon-0.1606019035e14)/(315.*varepsilon^2-96.*varepsilon+56800.), 575659.5001+.63*varepsilon*(-42358.50*varepsilon-15303408.00)/(-3.78*varepsilon^2+1.152*varepsilon-681.60)-26.68799999*(-42358.50*varepsilon-15303408.00)/(-3.78*varepsilon^2+1.152*varepsilon-681.60)-0.7824600000e-4*(0.2305833334e13*varepsilon^2-0.1898031746e13*varepsilon-0.1606019035e14)/(315.*varepsilon^2-96.*varepsilon+56800.)]]

     

     

     

    [0.1562500000e-5*(0.4309200001e14*varepsilon^3-0.1236319200e15*varepsilon^2+0.2902694399e16*varepsilon-0.1748076800e17)/(1890.*varepsilon^3-8451.*varepsilon^2+343200.*varepsilon-1420000.), 18875., 0.2441406250e-11*(-.8+.1920000000*varepsilon)*(0.4309200001e14*varepsilon^3-0.1236319200e15*varepsilon^2+0.2902694399e16*varepsilon-0.1748076800e17)^2/(1890.*varepsilon^3-8451.*varepsilon^2+343200.*varepsilon-1420000.)^2+0.1562500000e-5*(30776.00000-.9*(4611.666667+0.5250000000e-7*(0.6353000002e14*varepsilon^2-0.4804876192e14*varepsilon+0.1091355427e16)/(315.*varepsilon^2-96.*varepsilon+56800.))*varepsilon)*(0.4309200001e14*varepsilon^3-0.1236319200e15*varepsilon^2+0.2902694399e16*varepsilon-0.1748076800e17)/(1890.*varepsilon^3-8451.*varepsilon^2+343200.*varepsilon-1420000.)-273625249.9+0.1275750000e-2*(0.6353000002e14*varepsilon^2-0.4804876192e14*varepsilon+0.1091355427e16)/(315.*varepsilon^2-96.*varepsilon+56800.)]

    (1)

    with(plots):

    display(
      plot([pairs[1][], varepsilon=0..2], color=blue, linestyle=3, labels=[Pc, Max(TR)])
      ,
      seq(
        textplot([eval(pairs[1], varepsilon=val)[], typeset(varepsilon=nprintf("%1.1f", val))], align={right})
        , val=0..2, 0.5
      )
      ,
      seq(
        pointplot([eval(pairs[1], varepsilon=val)], symbol=solidcircle, symbolsize=10, color=blue)
        , val=0..2, 0.5
      )
      , view=[1400..1700, 10^5..1.6*10^5]
      , size=[500, 400]
    );


    display(
      plot([triple[[1, 3]][], varepsilon=0..2], color=blue, linestyle=3, labels=[p1, Max('TP')])
      ,
      seq(
        textplot([eval(triple[[1, 3]], varepsilon=val)[], typeset(varepsilon=nprintf("%1.1f", val))], align={right})
        , val=0..2, 0.5
      )
      ,
      seq(
        pointplot([eval(triple[[1, 3]], varepsilon=val)], symbol=solidcircle, symbolsize=10, color=blue)
        , val=0..2, 0.5
      )
      , size=[500, 400]
    )
     

     

     

    display(
      plot([pairs[1][], varepsilon=0..2], color=blue, linestyle=3, labels=[Pc, Max(TR)])
      ,
      plot([pairs[2][], varepsilon=0..2], color=red, linestyle=3)
      ,
      seq(
        textplot([eval(pairs[1], varepsilon=val)[], nprintf("%1.1f", val)], align={right})
        , val=0..2, 0.5
      )
      ,
      seq(
        pointplot([eval(pairs[1], varepsilon=val)], symbol=solidcircle, symbolsize=10, color=blue)
        , val=0..2, 0.5
      )
      , size=[500, 400]
    );

     

    display(
      plot([pairs[1][1], triple[1], varepsilon=0..2], color=blue, linestyle=3, labels=[Pc, p1])
      ,
      seq(
        textplot([eval([pairs[1][1], triple[1]], varepsilon=val)[], nprintf("%1.1f", val)], align={right})
        , val=0..2, 0.5
      )
      ,
      seq(
        pointplot([eval([pairs[1][1], triple[1]], varepsilon=val)], symbol=solidcircle, symbolsize=10, color=blue)
        , val=0..2, 0.5
      )
      , view=[1400..1700, 19000..25000]
      , size=[500, 400]
    );

     

    dualaxisplot(
      plot(
        pairs[1][1]
        , varepsilon=0..2
        , color=red
        , legend=Pc
        , labels=[typeset(varepsilon), Pc]
      )
      ,
      plot(
        triple[1]
        , varepsilon=0..2
        , color=blue
        , legend=p1
        , labels=[typeset(varepsilon), p1]
      )
      , size=[500, 400]
    );

     

     

     

    Question_New_mmcdara(analytic).mw

I do not pretend the way I take i the attached file is perfect, this is just an idea based on the use of a filter to remove the the discontinuities while damping them.
So the plot is obviously wrong close to the discontinuities, but no longer contains those vertical rays which seem to bother you.
plots-long_term_mmcdara.mw

Note: the last plot is very far from being perfect and a lot of work should be necessary to display what I caled the "discontinuity wall" in a smooth way.

@GFY 

kk(3, m) posseses 4 branches and kk(3, 200)[1] returns a value which is not the one plot(kk(3,m)[1], m=200..600) displays at m=200. Right?
Simply because plot does not select the same branch for some reason I don't know.
So this is a workaround:

 

restart

kernelopts(version)

`Maple 2015.2, APPLE UNIVERSAL OSX, Dec 20 2015, Build ID 1097895`

(1)

with(LinearAlgebra):

couple := [diff(x(t), `$`(t, 2))+2*xi*omega__1*(diff(x(t), t))+omega__1^2*x(t)+m__1*l*(diff(varphi(t), `$`(t, 2)))-m__1*l*(diff(varphi(t), t))^2*varphi(t) = F*cos(Omega*t), diff(varphi(t), `$`(t, 2))+(diff(x(t), `$`(t, 2)))/l+omega__2^2*varphi(t) = 0]:

couple1 := remove(has, (lhs-rhs)(couple[1]), [2*xi*omega__1*(diff(x(t), t)), m__1*l*(diff(varphi(t), t))^2*varphi(t), F*cos(Omega*t)])+varepsilon*select(has, (lhs-rhs)(couple[1]), [2*xi*omega__1*(diff(x(t), t)), m__1*l*(diff(varphi(t), t))^2*varphi(t), F*cos(Omega*t)]):

变换F的值,F=f cos((Omega2+εσ)(T0+εT1))

data1 := F*cos(Omega*t) = f*cos(applyrule(T__0*varepsilon = T__1, expand((sigma*varepsilon+Omega__2)*T__0))):

couple := [subs(data1, couple1), couple2]:

timescales := T__0, T__1:

dt__1 := proc (expr) options operator, arrow; diff(expr, T__0)+varepsilon*(diff(expr, T__1)) end proc:

dt__2 := proc (expr) options operator, arrow; diff(expr, `$`(T__0, 2))+2*varepsilon*(diff(diff(expr, T__1), T__0))+varepsilon^2*(diff(expr, `$`(T__1, 2))) end proc:

expand_1 := subs(diff(x(t), t, t) = dt__2(x(timescales)), diff(x(t), t) = dt__1(x(timescales)), x(t) = x(timescales), diff(varphi(t), t, t) = dt__2(varphi(timescales)), diff(varphi(t), t) = dt__1(varphi(timescales)), varphi(t) = varphi(timescales), couple):

fexpand := seq(convert(series(expand_1[i], varepsilon = 0, 2), polynom), i = 1 .. 2):

solForm := map(proc (term) options operator, arrow; term(timescales) = add(varepsilon^i*term[i](timescales), i = 0 .. 1) end proc, [x, varphi])[]:

fexpand2 := seq(seq(coeff(expand(subs(solForm, fexpand[i])), varepsilon^j), i = 1 .. 2), j = 1 .. 2):

ordery0 := map(proc (expr) options operator, arrow; expr = 0 end proc, [seq(remove(has, expand(subs(solForm, fexpand[i])), varepsilon), i = 1 .. 2)])[]:

ordery1 := seq(select(has, fexpand2[i], [diff(x[1](T__0, T__1), T__0, T__0), diff(x[1](T__0, T__1), T__0, T__0), x[1](T__0, T__1), diff(x[1](T__0, T__1), T__0), diff(varphi[1](T__0, T__1), T__0), varphi[1](T__0, T__1), V[1](T__0, T__1)]) = -remove(has, fexpand2[i], [diff(varphi[1](T__0, T__1), T__0, T__0), diff(x[1](T__0, T__1), T__0, T__0), x[1](T__0, T__1), diff(x[1](T__0, T__1), T__0), diff(varphi[1](T__0, T__1), T__0), varphi[1](T__0, T__1), V[1](T__0, T__1)]), i = 1 .. 2)[]:

针对最初上部方程求解固有频率

couple1 := [remove(has, couple[1], varepsilon), couple[2]]:

data2 := x(t) = x__0*exp(I*omega*t), varphi(t) = varphi__0*exp(I*omega*t):

expand(simplify(expand(subs(data2, couple1)/exp(I*omega*t)))):

``

data4 := xi = 0.25e-1, g = 9.8, M = 300, k = 2000, F = 600:

m__1 := subs(data4, m/(m+M)):

Omega__1 := sort(subs(data4, `~`[evalf]([omega_nature])))[3]:

``

Q__1 := subs(data4, l*m__1*Omega__1^2/(-Omega__1^2+omega__1^2)):

``

``

绘制比例Q2的变化曲线

 

kk := proc (i, ii) local Omega1, Omega2, Q1, Q2; Omega1 := sort(subs(data4, l = i, m = ii, `~`[evalf]([omega_nature])))[3]; Omega2 := sort(subs(data4, l = i, m = ii, `~`[evalf]([omega_nature])))[4]; Q1 := subs(data4, l = i, m = ii, l*m__1*Omega1^2/(-Omega1^2+omega__1^2)); Q2 := subs(data4, l = i, m = ii, l*m__1*Omega2^2/(-Omega2^2+omega__1^2)); return Omega1, Omega2, Q1, Q2 end proc:

kk(3, 300)

1.390272336, 3.356656496, 2.070214276, -2.130214275

(1.1)

# I believe I understood:
# You wonder wy starting_value=1.48 while the real part curve "starts" somewhere in between
# 3.1 and 3.2, an I right?

KK := m -> kk(3, m):

m_range := 200 .. 600;
starting_value := kk(3, op(1, m_range))[1];

plots:-dualaxisplot(
  plot(
    Re(KK(m)[1])
    , m = 200 .. 600
    , color = blue
    , legend =typeset(Re(F))
    , labels=[typeset('m'), typeset(Re(F))]
    , labeldirections=[default, vertical]
    , title=typeset(F = 'kk(3, m)[1]')
  )
  ,
  plot(
    Im(KK(m)[1])
    , m = 200 .. 600
    , color = red
    , legend =typeset(Im(F))
    , labels=[typeset('m'), typeset(Im(F))]
    , labeldirections=[default, vertical]
  )
)

200 .. 600

 

1.482073997

 

 

# So let's do that

Y := [ seq([m, KK(m)[1]], m=m_range, 10) ]:

dualaxisplot(
  plot(
    map(y -> Re~(y), Y)
    , color = blue
    , legend =typeset(Re(F))
    , labels=[typeset('m'), typeset(Re(F))]
    , labeldirections=[default, vertical]
    , title=typeset(F = 'kk(3, m)[1]')
  )
  ,
  plot(
    map(y -> Im~(y), Y)
    , color = red
    , legend =typeset(Im(F))
    , labels=[typeset('m'), typeset(Im(F))]
    , labeldirections=[default, vertical]
  )
)

 

# And more generally for the 4 branches

starting_values := kk(3, op(1, m_range));

colors := blue, cyan, gold, red:

display(
  seq(
    plot(
      [ seq([m, KK(m)[i]], m=m_range, 10) ]
      , color=colors[i]
      , legend=typeset('i'=i)
    )
    , i=1..4
  )
  ,
  # Check that each graph "start" at its corresponding starting value
  seq(
    pointplot(
      [ [op(1, m_range), starting_values[i]] ]
      , color=colors[i]
      , symbol=circle
      , symbolsize=20
    )
    , i=1..4
  )
  , background=gray
)

1.482073997, 3.148740665, 1.461555494, -2.011555498

 

 

 


 

Download gra423_Omega_Maple2015.mw


Simply write Sum instead of sum (Maple 2015)

L := limit((Sum(Sum(j/(j^2+k^2), k = 1 .. n), j = 1 .. n))/n, n = infinity)
                         1         1   
                         - ln(2) + - Pi
                         2         4   

Wait for a detailed explanation by some Maple expert (@vv maybe?)
 

Explanation for the first plot alone (I guess all the other errors are of the same nature)

restart

 

phi1 := 0.3e-1: phi2 := 0.3e-1: phi3 := 0.3e-1: B0 := 0.5e-1: sigma := .3:
ku := 0.2e-1: kl := 0.3e-1:S := 0.2e-1: beta0 := 1.5: beta1 := .8:
beta2 := .5: beta3 := .7: beta4 := .3: beta5 := .2: beta6 := .4:
beta7 := .6: beta8 := .9: beta11 := .1: beta22 := .2: beta33 := .1:
beta44 := 0.5e-1: beta55 := 0.8e-1: beta66 := 0.3e-1: beta77 := 0.7e-1:
beta88 := 0.4e-1:

Nu := B0^2*beta44+S^2*beta88+beta11*phi1^2+beta22*phi2^2+beta33*phi3^2+beta55*sigma^2+beta66*ku^2+beta77*kl^2+B0*beta4+S*beta8+beta1*phi1+beta2*phi2+beta3*phi3+beta5*sigma+beta6*ku+beta7*kl+beta0;

1.686776

(1)

# Observations:
#  (1) Nu is a constant, so contourplot won't teach you anything.
#  (2) contourplot(...) simply returns contourplot(...)
#      Indeed contourplot is a function of package plots, so if you want to get a plot:
#      (a) either you write the command with(plots) in a separate block after the restart command;
#      (b) or you write plots:-contourplots(...) instead.
#  (3) You cannot use a plotting range of the form phi1=0.1e-1..0.5e-1 because you already assign
#      phi1 the value 0.3e-1.
#
# Indeed

contourplot(Nu, phi1 = 0.1e-1 .. 0.5e-1, phi2 = 0.1e-1 .. 0.5e-1);

plots:-contourplot(Nu, phi1 = 0.1e-1 .. 0.5e-1, phi2 = 0.1e-1 .. 0.5e-1);

contourplot(1.686776, 0.3e-1 = 0.1e-1 .. 0.5e-1, 0.3e-1 = 0.1e-1 .. 0.5e-1)

 

Error, (in plot/iplot2d/expression) bad range arguments 0.3e-1 = 0.1e-1 .. 0.5e-1, 0.3e-1 = 0.1e-1 .. 0.5e-1

 

# But this would work (remember Nu is a constant)

plots:-contourplot(Nu, Phi1 = 0.1e-1 .. 0.5e-1, Phi2 = 0.1e-1 .. 0.5e-1);

 

 

 

Download Understand_your_errors.mw

And now two examples of how you could proceed
 

restart

with(plots):

data := {
phi1 = 0.3e-1, phi2 = 0.3e-1, phi3 = 0.3e-1, B0 = 0.5e-1, sigma = .3,
ku = 0.2e-1, kl = 0.3e-1, S = 0.2e-1, beta0 = 1.5, beta1 = .8,
beta2 = .5, beta3 = .7, beta4 = .3, beta5 = .2, beta6 = .4, beta7 = .6,
beta8 = .9, beta11 = .1, beta22 = .2, beta33 = .1, beta44 = 0.5e-1,
beta55 = 0.8e-1, beta66 = 0.3e-1, beta77 = 0.7e-1, beta88 = 0.4e-1
};

{B0 = 0.5e-1, S = 0.2e-1, beta0 = 1.5, beta1 = .8, beta11 = .1, beta2 = .5, beta22 = .2, beta3 = .7, beta33 = .1, beta4 = .3, beta44 = 0.5e-1, beta5 = .2, beta55 = 0.8e-1, beta6 = .4, beta66 = 0.3e-1, beta7 = .6, beta77 = 0.7e-1, beta8 = .9, beta88 = 0.4e-1, kl = 0.3e-1, ku = 0.2e-1, phi1 = 0.3e-1, phi2 = 0.3e-1, phi3 = 0.3e-1, sigma = .3}

(1)

Nu := B0^2*beta44+S^2*beta88+beta11*phi1^2+beta22*phi2^2+beta33*phi3^2+beta55*sigma^2+beta66*ku^2+beta77*kl^2+B0*beta4+S*beta8+beta1*phi1+beta2*phi2+beta3*phi3+beta5*sigma+beta6*ku+beta7*kl+beta0;

B0^2*beta44+S^2*beta88+beta11*phi1^2+beta22*phi2^2+beta33*phi3^2+beta55*sigma^2+beta66*ku^2+beta77*kl^2+B0*beta4+S*beta8+beta1*phi1+beta2*phi2+beta3*phi3+beta5*sigma+beta6*ku+beta7*kl+beta0

(2)

PlotWRT := {phi1, phi2};

Fixed := remove(has, data, PlotWRT);

contourplot(eval(Nu, Fixed), phi1 = 0.1e-1 .. 0.5e-1, phi2 = 0.1e-1 .. 0.5e-1);

{phi1, phi2}

 

{B0 = 0.5e-1, S = 0.2e-1, beta0 = 1.5, beta1 = .8, beta11 = .1, beta2 = .5, beta22 = .2, beta3 = .7, beta33 = .1, beta4 = .3, beta44 = 0.5e-1, beta5 = .2, beta55 = 0.8e-1, beta6 = .4, beta66 = 0.3e-1, beta7 = .6, beta77 = 0.7e-1, beta8 = .9, beta88 = 0.4e-1, kl = 0.3e-1, ku = 0.2e-1, phi3 = 0.3e-1, sigma = .3}

 

 

PlotWRT := {B0, sigma};

Fixed := remove(has, data, PlotWRT);

contourplot(eval(Nu, Fixed), B0 = 0 .. .1, sigma = .1 .. .5)

{B0, sigma}

 

{S = 0.2e-1, beta0 = 1.5, beta1 = .8, beta11 = .1, beta2 = .5, beta22 = .2, beta3 = .7, beta33 = .1, beta4 = .3, beta44 = 0.5e-1, beta5 = .2, beta55 = 0.8e-1, beta6 = .4, beta66 = 0.3e-1, beta7 = .6, beta77 = 0.7e-1, beta8 = .9, beta88 = 0.4e-1, kl = 0.3e-1, ku = 0.2e-1, phi1 = 0.3e-1, phi2 = 0.3e-1, phi3 = 0.3e-1}

 

 
 

 

Download What_you_could_do.mw

Insertion can be made using ImageToolsinsert.mw

@JaneCherrytree 

Do you use the name PDF on purpose?
I mean, does the variable PDF represent the Probability Density Function of some random variable?

If it is so PDF must be nonnegative over (x, y) in (0..1)^2... which is not be the case given the ranges of the five parameters VeX, VeY, VeZ, alphaX, alphaY that you provide (#).

Next, there is absolutely no chance that a formal expression of the (CDF?) does exist, restricting you to numerical constructions alone.

See the attached file IntNum.mw

If this suits you feel free to ask some extra developments

(#) Add something like this at the end of the attached file to see that the proportion of instances which leed to a negative scaling (meaning PDF is not a Probability Density Function) is about 50%

NegativeScalings := 0:
for rep from 1 to 100 do
  data := [seq(rand(-1. .. 1.)(), i=1..3), seq(rand(0. .. 1.)(), i=1..2)]:
  instances := params =~ data;
  scaling := IntNum(instances, 0..1, 0..1);
  if scaling < 0 then NegativeScalings := NegativeScalings + 1 end if:
end do:

NegativeScalings;
                               54

 

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