tomleslie

13876 Reputation

20 Badges

15 years, 181 days

MaplePrimes Activity


These are replies submitted by tomleslie

which I missed completely, there is still no way to guarantee a correct solution for a general non-convex optimisation problem. You are left with the issue that some optimizers may find no solutions at all, and others may find one or more.

Any found solution will be a "local" optimum - but is not guaranteed to be a "global" optimum. For the two problems you pose, The DirectSeacrh() package which I mentioned in an earlier response finds multiple solutions. According to the help its GlobalSearch() command

attempts to find numerically all local and global minimums (maximums) of a real-valued nonlinear multivariate function

Note the use of the word "attempts" in the above. Note also that it will try to return "all local and global minimums", so multiple answers are not unusual. Applying this package to the two problems you cite, gives *possible* solutions in both cases. See the attached.

NB Unless you have the DirectSearch package installed, you won't be able to run this code!

#
# First problem
#
 restart;
 with(LinearAlgebra):
 A := Matrix( [ [.659548, .554762,  .841844],
                [.294773, .879278,  .130857],
                [.950368, .557858,  .189154],
                [.694286, .752334,  .153640],
                [.206807, .894901, 0.28902e-1]
              ]
            ):
 b := <0.9085e-2, .596452, .609049, .918923, .733574>:
 x := Vector(3, symbol = v):
 Obj := VectorNorm(A.x-b, 1, conjugate = false):
 DirectSearch:-GlobalSearch( Obj, {Transpose(x).x = 1});

Matrix(2, 3, {(1, 1) = .41219175205921144, (1, 2) = [v[1] = .39334227101942115, v[2] = .6441126522965561, v[3] = -.6560497334085549], (1, 3) = 778, (2, 1) = 1.3678979164189506, (2, 2) = [v[1] = 0.5669453732241413e-1, v[2] = .7867742955810422, v[3] = .6146313611735985], (2, 3) = 679})

(1)

#
# Second problem
#
  restart:
  with(LinearAlgebra):
  A := Matrix( [ [.509456,    .138989, .326393],
                 [.620798,    .769507, .137161],
                 [.733567,    .969765, .384754],
                 [.229996,    .386794, .562636],
                 [0.21872e-1, .993428, .633835]
               ]
             ):
  b := <.541606, .314993, .159327, .152616, .136951>:
  x := Vector(3, symbol = v):
  Obj := VectorNorm(A . x-b, 1, conjugate = false):
  DirectSearch:-GlobalSearch( Obj, {Transpose(x).x = 1});

Matrix(5, 3, {(1, 1) = .6054001577862953, (1, 2) = [v[1] = .7182714120967683, v[2] = -.28338352830212304, v[3] = .6354368218920726], (1, 3) = 1036, (2, 1) = .6100130198118552, (2, 2) = [v[1] = .7050537849824825, v[2] = -.290438459433102, v[3] = .6469502713966531], (2, 3) = 463, (3, 1) = .680889631575692, (3, 2) = [v[1] = .9188231934676021, v[2] = -.36053359801611684, v[3] = .16055917890476687], (3, 3) = 357, (4, 1) = 1.2032940841186117, (4, 2) = [v[1] = -.10455303290465115, v[2] = .6307469099476639, v[3] = -.7689128193319191], (4, 3) = 572, (5, 1) = 1.6045549160412211, (5, 2) = [v[1] = -.7303952267055793, v[2] = .6747569396800593, v[3] = .10595128284932961], (5, 3) = 1592})

(2)

 

Download optProb.mw

to my personal address. Any communication abut Maple takes place through this site; any furhter personal emails will go straight to the bit-bucket with no response. You asked why the following didn't work

restart; with(LinearAlgebra); with(Student[Calculus1]);
M := 5; n1 := 1; n2 := 4;
for n from 0 to M do rho[n, M] := sum((-1)^j*binomial(M-n, j)*binomial(M+n+j+1, M-n)*t^(n+j), j = 0 .. M-n) end do;
plot([seq(rho[i, M], i = 0 .. 4)], t = 0 .. 1);
;
f1 := proc (j) options operator, arrow; c[j-1] end proc;
C := Vector(M+1, f1);
C1 := Transpose(C);
f2 := proc (j) options operator, arrow; rho[j-1, M] end proc;
phi := Vector(M+1, f2);
f := C1 . phi;
NULL;
diff(phi(t), t$2);

Well - the following will work

restart;
with(LinearAlgebra):
M := 5;
n1 := 1;
n2 := 4;
for n from 0 to M do
   rho[n, M] := sum((-1)^j*binomial(M-n, j)*binomial(M+n+j+1, M-n)*t^(n+j), j = 0 .. M-n)
end do;
plot([seq(rho[i, M], i = 0 .. 4)], t = 0 .. 1);
f1 :=j->c[j-1];
C := Vector(M+1, f1);
C1 := Transpose(C);
f2 := j->rho[j-1, M];
phi := Vector(M+1, f2);
f := C1.phi;
diff(phi, t$2);

 

to

M:=5:
f2:=j->C[j-1,M](t);
phi:=Vector(M+1, f2);
n:=3:
diff(phi, t$n);

Just set the value of 'n' in the above to derivative order you want.

more like that shown in the attached. This suppresses printing the direct output of the NLPSolve() command, and just stores the result in a table (which isn't necessarily the most convenient data structure for subsequent processing!)

  restart;
  with(Optimization):
  G:=a-b*p:
  z:=q-G:
  M:=int((z-u)*f(u), u=-3500..z):
  N:=int((u-z)*f(u), u=z..1500):
  beta:=alpha*K+(1-K)*r/p:
  E__pi:=(p-c)*(G+mu)-(c-v)*M-(p-c+s-beta*(p-r-c-d+s))*N:
  EXE__pi := eval( E__pi,
                   [ c = 35,
                     a = 100000,
                     b = 1500,
                     mu = -1000,
                     v = 10,
                     d = 3,
                     s = 3,
                     f(u)= exp((-1/800)*(u+1000)*(u+1000))/sqrt(2*3.14*800)
                   ]
                 ):
  DEP__pi:=diff(EXE__pi, p):
  DEQ__pi:=diff(EXE__pi, q):
  DER__pi:=diff(EXE__pi, r):
#
# Suppress printing of NLPSolve() output
#
# printf( "%2s %14s %13s %13s %13s\n\n",
#         "k", "maximum", "p", "q", "r"
#       );
#
# Set up output table
#
  myName:=table():
  for k from 0.1 by 0.02 to 0.40 do
      E1__pi:=eval(EXE__pi,[alpha = 0.5, K=k]):
      #printf("%a   ", k);
      try  ans:= NLPSolve
                 ( E1__pi,
                   p = 40 .. 60,
                   q = 15000 .. 26000,
                   r = 0 .. 25,
                   initialpoint = {p = 50, q = 15000, r = 0},
                   maximize
                 ):
        #
        # Suppress printing of NLPSolve output
        #
        # printf( "%4.2f   %8.6e   %8.6e   %8.6e   %8.6e \n",
        #         k, ans[1], rhs~(ans[2])[]
        #      );
        #
        # Use outputs of NLPSolve to compute a
        # few things and store these in the
        # table myName, indexed by the value of
        # the loop variable k
        #
          myName[k] := eval( [ DEP__pi,
                               DEQ__pi,
                               DER__pi,
                               beta
                            ],
                            [ alpha = .5,
                              K = k,
                              ans[2][]
                            ]
                          ):
    catch "Error, (in Optimization:-NLPSolve) no improved point could be found":
        #
        # Print warning message when NLPSolve()
        # command fails
        #
          printf("\n**NLPSolve() failed when k=%4.2f**\n\n", k);
    end try:
    
  od:
#
# Check output table contents for a couple
# of index values
#
  myName[0.1];
  myName[0.28];
#
# Print the complete contents of the output
# table
#
  printf( "\n\n%2s%16s%17s%17s%17s\n\n",
          "k", 'DEP__pi', 'DEQ__pi', 'DER__pi', 'beta'
        );
  seq
  ( printf( "%4.2f%17.6e%17.6e%17.6e%17.6e \n",
            j, myName[j][]
          ),
    j in  sort( [ indices(myName, 'nolist' ) ] )
  );


**NLPSolve() failed when k=0.20**


**NLPSolve() failed when k=0.36**

 

[HFloat(0.008124235024297377), HFloat(1.3244345424823223e-6), HFloat(8.942607191797026e-7), HFloat(0.16310549685859163)]

 

[HFloat(-0.11319869588805886), HFloat(-8.133516579444944e-5), HFloat(5.388903003794201e-5), HFloat(0.18048096803030883)]

 



 k         DEP__pi          DEQ__pi          DER__pi             beta

0.10    8.124235e-003    1.324435e-006    8.942607e-007    1.631055e-001
0.12    7.612606e-003    9.129944e-007   -1.005420e-006    1.650366e-001
0.14    7.942559e-002    4.729956e-005    1.622852e-004    1.669568e-001
0.16    3.069396e-001    1.945506e-004   -3.926488e-004    1.689244e-001
0.18   -4.559813e-002   -3.429199e-005   -2.476548e-005    1.708311e-001
0.22   -1.622543e-002   -1.491153e-005    6.926161e-005    1.746870e-001
0.24    1.663421e-003    5.050235e-008    4.267943e-006    1.766222e-001
0.26   -8.794443e-004   -4.779734e-006   -3.894070e-006    1.785537e-001
0.28   -1.131987e-001   -8.133517e-005    5.388903e-005    1.804810e-001
0.30    7.856244e-003    1.410988e-006   -6.168876e-005    1.824194e-001
0.32    6.452105e-001    4.175094e-004    1.243250e-004    1.843385e-001
0.34   -8.884629e-003   -6.830507e-006    1.669743e-005    1.862763e-001
0.38    2.951367e-002    1.540137e-005    1.012055e-005    1.901387e-001
0.40    5.357337e-003   -1.042016e-006   -1.274846e-001    2.000000e-001

 

 

Download optProb2.mw

and code revisions I have added in the attached two files

a_0_fix.mw

R_0_fix.mw

On the first iteration of your for-loop the quantities H(0), X(0), G(0), Y(0) and Z(0) are required. Since these have been explicitly defined, everything calculates correctly

On the second iteration of your for-loop the quantities H(1), X(1), G(1), Y(1) and Z(1) are required. These have not been defined, so all expressions containing them return "unevaluated". You either need explicit values for these quantiites, or function definitions of the form H()->expr, which will allow them to be calculated for any argument

@666 basha 

" i need eta range =-2..2 "

You have presented a boundary-value problem with the boundaries on eta, being 0..N, where N=5. You cannot "solve" a boundary-value problem over a specified range of the independent variable and use this solution over a different range of the independent variable.

In principle(?), it ought to be possible to convert your BVP to an initial-value problem using "shooting" methods. I am reluctant to attempt this because of the existing confusion over the initial/boundary conditions which you have. Why are you using BC's of 0 and 5, when you want -2 and 2?!

I still don't really understand the function you want to plot.

Solving the BVP (or the yet-to-be-attempted) equivalent IVP, will allow the quanties f(eta),, diff(f(eta), eta), diff(f(eta), eta$2), diff(f(eta),eta$3), T(eta), diff(T(eta), eta) and diff(T(eta), eta$2) to be calculated (and hence plotted). Pretty much any combination of these variables can be plotted against pretty much any other combination. It is up to you to work out exactly what you want. I suggest reading the DETools:-DEplot() help page to see (some!) of what is available

 

@Gabriel samaila 

As far as I can tell,

  1. when D(theta)(0)=0 then theta(eta)=0 for all eta
  2. change any other parameter then (1) above applies
  3. which of the above two statements is difficult to understand?

when DirectSearch:-SolveEquations() doesn't seem to have much trouble?! See the attached

 restart;
 sys:=[x^2+y^2+z^2=4, x^2+y^2-z^2=4, x+y+z=0]:
 solve(sys, explicit);

{x = -2^(1/2), y = 2^(1/2), z = 0}, {x = 2^(1/2), y = -2^(1/2), z = 0}

(1)

DirectSearch:-SolveEquations(sys, AllSolutions);

Matrix(2, 4, {(1, 1) = 0.1068831130e-19, (1, 2) = Vector(3, {(1) = -0.2978373104e-10, (2) = -0.9898437625e-10, (3) = -0.1825903191e-11}), (1, 3) = [x = 1.4142165034567789, y = -1.4142106212605317, z = -0.588219807310096e-5], (1, 4) = 824, (2, 1) = 0.1569181278e-19, (2, 2) = Vector(3, {(1) = 0.8394351880e-10, (2) = -0.9297673742e-10, (3) = -0.7903967330e-12}), (2, 3) = [x = -1.4142182650260668, y = 1.4142088597028886, z = 0.9405322387883068e-5], (2, 4) = 649})

(2)

 

Download DS_fsol.mw

@Gabriel samaila 

I have modified the worksheet final_axiz.mw to add one entry to the list 'L' which ensures that the condition D(theta)(0)=0 occurs. With this initial value for D(theta)(0) it seems as if theta(eta)=0 for all eta.

Is this behaviour "unexpected" for some reason?

See the attached

restart

with*plots; ode1 := diff(f(eta), eta, eta, eta)+(1/2)*f(eta)*(diff(f(eta), eta, eta)) = 0

diff(diff(diff(f(eta), eta), eta), eta)+(1/2)*f(eta)*(diff(diff(f(eta), eta), eta)) = 0

(1)

ode2 := diff(theta(eta), eta, eta)+(1/2)*pr*f(eta)*(diff(theta(eta), eta)) = 0

diff(diff(theta(eta), eta), eta)+(1/2)*pr*f(eta)*(diff(theta(eta), eta)) = 0

(2)

bcs1 := f(0) = 0, (D(f))(0) = 0, (D(f))(10) = 1

f(0) = 0, (D(f))(0) = 0, (D(f))(10) = 1

(3)

fixedparameter := [pr = .72]

[pr = .72]

(4)

ode3 := eval(ode2, fixedparameter)

diff(diff(theta(eta), eta), eta)+.3600000000*f(eta)*(diff(theta(eta), eta)) = 0

(5)

bcs2 := theta(10) = 0, (D(theta))(0) = -a*(1-theta(0))

theta(10) = 0, (D(theta))(0) = -a*(1-theta(0))

(6)

L := [0., 0.5e-1, .1, .2, .4, .6, .8, 1, 5, 10, 20]

[0., 0.5e-1, .1, .2, .4, .6, .8, 1, 5, 10, 20]

(7)

for k to numelems(L) do sol_All := dsolve(eval({bcs1, bcs2, ode1, ode3}, a = L[k]), [f(eta), theta(eta)], numeric, output = listprocedure); Y_sol || k := rhs(sol_All[5]); YP_sol || k := -rhs(sol_All[6]) end do

for k to numelems(L) do L[k], [(Y_sol || k)(0), (YP_sol || k)(0)] end do

0., [HFloat(0.0), HFloat(-0.0)]

 

0.5e-1, [HFloat(0.14466114806153926), HFloat(0.04276694259692305)]

 

.1, [HFloat(0.25275802924878826), HFloat(0.07472419707512112)]

 

.2, [HFloat(0.403522505042256), HFloat(0.11929549899154872)]

 

.4, [HFloat(0.5750139429999558), HFloat(0.16999442280001797)]

 

.6, [HFloat(0.6699155293446565), HFloat(0.19805068239320597)]

 

.8, [HFloat(0.7301699714128576), HFloat(0.21586402286971415)]

 

1, [HFloat(0.7718221287933378), HFloat(0.22817787120666155)]

 

5, [HFloat(0.9441737791382593), HFloat(0.2791311043087031)]

 

10, [HFloat(0.971285375069508), HFloat(0.2871462493049136)]

 

20, [HFloat(0.9854335524956402), HFloat(0.2913289500871902)]

(8)

plot([seq((Y_sol || k)(eta), k = 1 .. numelems(L))], eta=0..6, axes=none);;

 

 


 

Download final_mod.mw

@vv 

Is the order of the returned vectors guaranteed???

@ogunsmichael 

  1. Create worksheet
  2. Save worksheet
  3. Use the big green up-arrow in the Mapleprimes toolbar to select/upload worksheet

small typo with Digits settings  in the previous response (which doesn't affect the basic argument), but the attachment here is *more* correct

  restart;
#
# Increase the calculation precision to
# see if that helps - it doesn't, really
#
  Digits:=20:
  with(LinearAlgebra):
  a:= Vector([1,  2,     3]):
  b:= Vector([1, -2,     3]):
  c:= Vector([3,  2,     1]):
  d:= Vector([5,  1,    -3]):
  e:= Vector([0,  1.01, -3]):
  GramSchmidt([a, b, c, d, e]);
  GramSchmidt([b, c, d, e, a]);
#
# Set the calculation precison back to
# the default, and then use "exact
# rationals" rather than floats
#
  Digits:=10:
  f:= x-> convert~(x, rational):
  GramSchmidt(f~([a, b, c, d, e]));
  GramSchmidt(f~([b, c, d, e, a]));

[Vector(3, {(1) = 1, (2) = 2, (3) = 3}), Vector(3, {(1) = 4/7, (2) = -20/7, (3) = 12/7}), Vector(3, {(1) = 12/5, (2) = 0, (3) = -4/5})]

 

[Vector(3, {(1) = 1, (2) = -2, (3) = 3}), Vector(3, {(1) = 20/7, (2) = 16/7, (3) = 4/7}), Vector(3, {(1) = 7/3, (2) = -7/3, (3) = -7/3}), Vector(3, {(1) = 0.2000000000e-19, (2) = 0., (3) = 0.}), Vector(3, {(1) = -1.0000000000000000000, (2) = 0., (3) = 0.})]

 

[Vector(3, {(1) = 1, (2) = 2, (3) = 3}), Vector(3, {(1) = 4/7, (2) = -20/7, (3) = 12/7}), Vector(3, {(1) = 12/5, (2) = 0, (3) = -4/5})]

 

[Vector[column](%id = 18446744074333011590), Vector[column](%id = 18446744074333012086), Vector[column](%id = 18446744074333012566)]

(1)

 

Download GSprob2.mw

@Carl Love 

cos Matlab:-fromFile() will not translate anything from a Matlab toolbox. The syms declaration is required by the (MuPad-based) Matlab symbolic toolbox. The syntax for (MuPad-based) symbolic integration is somewhat different from that in Maple, so would have to hacked-by-hand. Still not too difficult. If you do this, then (like me) the next error you will get is

Error, (in sprintf) too many levels of recursion

Since there is no 'sprintf()' command anywhere in the mpl file, this one is "buried" somewhere, and I didn't feel like digging!

If you want to examine the Matlab commands which didn't translate properly in the mpl file, then just search for the string "m_" in the latter. You will find

m_diff (used as a variable name, ie lhs of assignment) as well as a function call, which is slightly worrying!?
m_close - not a problem only affects the Matlab interface
m_fprintf() - this one surprised me because printf(), fprintf() stuff is pretty similar across many languages. In this case it looks as if it should be printf() rather than fprintf()
m_plot() - not too big a surprise: translating Matlab graphics to Maple graphics is a bit of a nightmare, caused mainly by different options syntax

Frankly if the original objective+algorithm were provided then (maybe with the Matlab code as a guide?), it would probably be faster to write Maple code from scratch!

@Alessia Verme 

I have just re-run the original worksheet I posted in Maple 18 (English version). Worksheet executes with no errors, but now the the Student[Calculus1]:-LimitTutor() fails to produce an answer for any of the four required limit() calculations, although it work really hard!!!

See attached, executed in Maple 18

  restart;
  interface(version);
  Expr1:=(2*abs(x-2)+abs(x+1)-3)/(abs(x^2-4)+x-2);
#
# No problems with basic 'limit()' commands
#
  limit( Expr1, x=2, right);
  limit( Expr1, x=2, left);

`Standard Worksheet Interface, Maple 18.02, Windows 7, October 20 2014 Build ID 991181`

 

(2*abs(x-2)+abs(x+1)-3)/(abs(x^2-4)+x-2)

 

3/5

 

1/3

(1)

#
# On the other hand the limitTutor  only
# finds one of these :-(
#
  Student[Calculus1]:-LimitTutor( Expr1, 2, 'right');
  Student[Calculus1]:-LimitTutor( Expr1, 2, 'left');

"[[(lim)(2 |x-2|+|x+1|-3)/(|x^2-4|+x-2)],[ ,"=",(lim)((2 x abs(1,x^2-4)+1) (2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2 (2 abs(1,x-2)+abs(1,x+1))), [lhopital,1/(|x^2-4|+x-2)]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) ((lim)(2 x abs(1,x^2-4)+1)))/((lim)(2 abs(1,x-2)+abs(1,x+1))), [quotient]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) (((lim)2 x abs(1,x^2-4))+((lim)1)))/((lim)(2 abs(1,x-2)+abs(1,x+1))), [sum]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) (((lim)2 x abs(1,x^2-4))+1))/((lim)(2 abs(1,x-2)+abs(1,x+1))), [constant]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) (2 ((lim)x abs(1,x^2-4))+1))/((lim)(2 abs(1,x-2)+abs(1,x+1))), [constantmultiple]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) (2 ((lim)x) ((lim)abs(1,x^2-4))+1))/((lim)(2 abs(1,x-2)+abs(1,x+1))), [product]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) (4 ((lim)abs(1,x^2-4))+1))/((lim)(2 abs(1,x-2)+abs(1,x+1))), [identity]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) (4 ((lim)abs(1,x^2-4))+1))/(((lim)2 abs(1,x-2))+((lim)abs(1,x+1))), [sum]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) (4 ((lim)abs(1,x^2-4))+1))/(2 ((lim)abs(1,x-2))+((lim)abs(1,x+1))), [constantmultiple]],[ ,"=",(((lim)((2 x abs(1,x^2-4)+1) (2 |x-2|+|x+1|-3)^3)/((|x^2-4|+x-2)^3 (2 abs(1,x-2)+abs(1,x+1)))) (4 ((lim)abs(1,x^2-4))+1))/(2 ((lim)abs(1,x-2))+((lim)abs(1,x+1))), [lhopital,1/((|x^2-4|+x-2)^2)]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^3)/((|x^2-4|+x-2)^3)) ((lim)(2 x abs(1,x^2-4)+1)) (4 ((lim)abs(1,x^2-4))+1))/(((lim)(2 abs(1,x-2)+abs(1,x+1))) (2 ((lim)abs(1,x-2))+((lim)abs(1,x+1)))), [quotient]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^3)/((|x^2-4|+x-2)^3)) (((lim)2 x abs(1,x^2-4))+((lim)1)) (4 ((lim)abs(1,x^2-4))+1))/(((lim)(2 abs(1,x-2)+abs(1,x+1))) (2 ((lim)abs(1,x-2))+((lim)abs(1,x+1)))), [sum]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^3)/((|x^2-4|+x-2)^3)) (((lim)2 x abs(1,x^2-4))+1) (4 ((lim)abs(1,x^2-4))+1))/(((lim)(2 abs(1,x-2)+abs(1,x+1))) (2 ((lim)abs(1,x-2))+((lim)abs(1,x+1)))), [constant]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^3)/((|x^2-4|+x-2)^3)) (2 ((lim)x abs(1,x^2-4))+1) (4 ((lim)abs(1,x^2-4))+1))/(((lim)(2 abs(1,x-2)+abs(1,x+1))) (2 ((lim)abs(1,x-2))+((lim)abs(1,x+1)))), [constantmultiple]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^3)/((|x^2-4|+x-2)^3)) (2 ((lim)x) ((lim)abs(1,x^2-4))+1) (4 ((lim)abs(1,x^2-4))+1))/(((lim)(2 abs(1,x-2)+abs(1,x+1))) (2 ((lim)abs(1,x-2))+((lim)abs(1,x+1)))), [product]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^3)/((|x^2-4|+x-2)^3)) (4 ((lim)abs(1,x^2-4))+1)^2)/(((lim)(2 abs(1,x-2)+abs(1,x+1))) (2 ((lim)abs(1,x-2))+((lim)abs(1,x+1)))), [identity]]]"

 

Limit((2*abs(x-2)+abs(x+1)-3)/(abs(x^2-4)+x-2), x = 2, right) = (Limit((2*abs(x-2)+abs(x+1)-3)^3/(abs(x^2-4)+x-2)^3, x = 2, right))*(4*(Limit(abs(1, x^2-4), x = 2, right))+1)^2/((Limit(2*abs(1, x-2)+abs(1, x+1), x = 2, right))*(2*(Limit(abs(1, x-2), x = 2, right))+Limit(abs(1, x+1), x = 2, right)))

 

"[[(lim)(2 |x-2|+|x+1|-3)/(|x^2-4|+x-2)],[ ,"=",(lim)((2 x abs(1,x^2-4)+1) (2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2 (2 abs(1,x-2)+abs(1,x+1))), [lhopital,1/(|x^2-4|+x-2)]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) ((lim)(2 x abs(1,x^2-4)+1)))/((lim)(2 abs(1,x-2)+abs(1,x+1))), [quotient]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) (((lim)2 x abs(1,x^2-4))+((lim)1)))/((lim)(2 abs(1,x-2)+abs(1,x+1))), [sum]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) (((lim)2 x abs(1,x^2-4))+1))/((lim)(2 abs(1,x-2)+abs(1,x+1))), [constant]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) (2 ((lim)x abs(1,x^2-4))+1))/((lim)(2 abs(1,x-2)+abs(1,x+1))), [constantmultiple]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) (2 ((lim)x) ((lim)abs(1,x^2-4))+1))/((lim)(2 abs(1,x-2)+abs(1,x+1))), [product]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) (4 ((lim)abs(1,x^2-4))+1))/((lim)(2 abs(1,x-2)+abs(1,x+1))), [identity]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) (4 ((lim)abs(1,x^2-4))+1))/(((lim)2 abs(1,x-2))+((lim)abs(1,x+1))), [sum]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^2)/((|x^2-4|+x-2)^2)) (4 ((lim)abs(1,x^2-4))+1))/(2 ((lim)abs(1,x-2))+((lim)abs(1,x+1))), [constantmultiple]],[ ,"=",(((lim)((2 x abs(1,x^2-4)+1) (2 |x-2|+|x+1|-3)^3)/((|x^2-4|+x-2)^3 (2 abs(1,x-2)+abs(1,x+1)))) (4 ((lim)abs(1,x^2-4))+1))/(2 ((lim)abs(1,x-2))+((lim)abs(1,x+1))), [lhopital,1/((|x^2-4|+x-2)^2)]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^3)/((|x^2-4|+x-2)^3)) ((lim)(2 x abs(1,x^2-4)+1)) (4 ((lim)abs(1,x^2-4))+1))/(((lim)(2 abs(1,x-2)+abs(1,x+1))) (2 ((lim)abs(1,x-2))+((lim)abs(1,x+1)))), [quotient]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^3)/((|x^2-4|+x-2)^3)) (((lim)2 x abs(1,x^2-4))+((lim)1)) (4 ((lim)abs(1,x^2-4))+1))/(((lim)(2 abs(1,x-2)+abs(1,x+1))) (2 ((lim)abs(1,x-2))+((lim)abs(1,x+1)))), [sum]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^3)/((|x^2-4|+x-2)^3)) (((lim)2 x abs(1,x^2-4))+1) (4 ((lim)abs(1,x^2-4))+1))/(((lim)(2 abs(1,x-2)+abs(1,x+1))) (2 ((lim)abs(1,x-2))+((lim)abs(1,x+1)))), [constant]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^3)/((|x^2-4|+x-2)^3)) (2 ((lim)x abs(1,x^2-4))+1) (4 ((lim)abs(1,x^2-4))+1))/(((lim)(2 abs(1,x-2)+abs(1,x+1))) (2 ((lim)abs(1,x-2))+((lim)abs(1,x+1)))), [constantmultiple]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^3)/((|x^2-4|+x-2)^3)) (2 ((lim)x) ((lim)abs(1,x^2-4))+1) (4 ((lim)abs(1,x^2-4))+1))/(((lim)(2 abs(1,x-2)+abs(1,x+1))) (2 ((lim)abs(1,x-2))+((lim)abs(1,x+1)))), [product]],[ ,"=",(((lim)((2 |x-2|+|x+1|-3)^3)/((|x^2-4|+x-2)^3)) (4 ((lim)abs(1,x^2-4))+1)^2)/(((lim)(2 abs(1,x-2)+abs(1,x+1))) (2 ((lim)abs(1,x-2))+((lim)abs(1,x+1)))), [identity]]]"

 

Limit((2*abs(x-2)+abs(x+1)-3)/(abs(x^2-4)+x-2), x = 2, left) = (Limit((2*abs(x-2)+abs(x+1)-3)^3/(abs(x^2-4)+x-2)^3, x = 2, left))*(4*(Limit(abs(1, x^2-4), x = 2, left))+1)^2/((Limit(2*abs(1, x-2)+abs(1, x+1), x = 2, left))*(2*(Limit(abs(1, x-2), x = 2, left))+Limit(abs(1, x+1), x = 2, left)))

(2)

#
# Easier to apprecitate these limits by
# converting the original expression to
# 'piecewise'
#
  Expr2:=convert(Expr1, piecewise);
  plot(Expr2, x=-10..10, discont=true);
#
# Again no problems with basic 'limit()' commands
#
  limit( Expr2, x=2, right);
  limit( Expr2, x=2, left);

Expr2 := piecewise(x <= -2, -3*x/(x^2+x-6), x < -1, -3*x/(-x^2+x+2), x < 2, (-x+2)/(-x^2+x+2), 2 <= x, (-6+3*x)/(x^2+x-6))

 

 

3/5

 

1/3

(3)

#
# On the other hand the limitTutor() now fails on
# both limits
#
  Student[Calculus1]:-LimitTutor( Expr2, 2, 'right');

Limit(piecewise(x <= -2, -3*x/(x^2+x-6), x < -1, -3*x/(-x^2+x+2), x < 2, (-x+2)/(-x^2+x+2), 2 <= x, (-6+3*x)/(x^2+x-6)), x = 2, right)

 

Limit(piecewise(x <= -2, -3*x/(x^2+x-6), x < -1, -3*x/(-x^2+x+2), x < 2, (-x+2)/(-x^2+x+2), 2 <= x, (-6+3*x)/(x^2+x-6)), x = 2, right)

(4)

  Student[Calculus1]:-LimitTutor( Expr2, 2, 'left');

Limit(piecewise(x <= -2, -3*x/(x^2+x-6), x < -1, -3*x/(-x^2+x+2), x < 2, (-x+2)/(-x^2+x+2), 2 <= x, (-6+3*x)/(x^2+x-6)), x = 2, left)

 

Limit(piecewise(x <= -2, -3*x/(x^2+x-6), x < -1, -3*x/(-x^2+x+2), x < 2, (-x+2)/(-x^2+x+2), 2 <= x, (-6+3*x)/(x^2+x-6)), x = 2, left)

(5)

 

 


 

Download limit.mw

First 83 84 85 86 87 88 89 Last Page 85 of 207