tomleslie

13876 Reputation

20 Badges

15 years, 163 days

MaplePrimes Activity


These are answers submitted by tomleslie

on how hard you want to work!

Would the following be acceptable?

  restart;
  with(PDEtools):
#
# The ODE
#
  ode:= diff(w(z), z$2)+f(z)*diff(w(z), z)+g(z)*w(z)=0;
#
# The transformation
#
  tr0:= w(z)=W(z)*exp( -1/2*int(f(z),z)):
#
# The folloqing uses a transformation
#
# w(z)==W(z)*exp( -1/2*int(f(z),z))
# f(z)=F(z),
# g(z)=G(z)
#
# then reverses the latter two
#
  subs
  ( [ F(z)=f(z),
      G(z)=g(z)
    ],
    dchange
    ( [ subs( f(z)=F(z), tr0),
        f(z)=F(z),
        g(z)=G(z)
      ],
      ode,
      [W(z), F(z), G(z)]
    )
  ):
  simplify(%);
  isolate(%, W(z));
  collect(%,W(z));

diff(diff(w(z), z), z)+f(z)*(diff(w(z), z))+g(z)*w(z) = 0

 

-(1/4)*exp(-(1/2)*(int(f(z), z)))*(-4*(diff(diff(W(z), z), z))+2*W(z)*(diff(f(z), z))+(f(z)^2-4*g(z))*W(z)) = 0

 

W(z)*f(z)^2-4*g(z)*W(z)+2*W(z)*(diff(f(z), z))-4*(diff(diff(W(z), z), z)) = 0

 

(f(z)^2-4*g(z)+2*(diff(f(z), z)))*W(z)-4*(diff(diff(W(z), z), z)) = 0

(1)

 

Download transf.mw

using the animate() command - just because I think alternatives are good.

 restart;
 with(plots):
 frames:= 50:
 Xdata:= [ seq( 2*Pi*(k-1)/(frames-1),
                k=1..frames
              )
         ]:
 Ydata:= [ seq( sin( 2*Pi*(k-1)/(frames-1)),
                k=1..frames
              )
         ]:
 animate( plot,
          [ [ [ Xdata[i-1], Ydata[i-1] ],
              [ Xdata[i],   Ydata[i] ]
            ],
            style=pointline,
            symbol=solidcircle,
            symbolsize=16,
            color=red
          ],
          i=[$2..frames],
          trace=frames
        );

 

 

Download anim.mw

you were after something a bit more like the attached

  restart;
  myTaylor:=(f, a, n)-> Sum( (D@@k)(f)(a)*(x-a)^k/k!,k=0..n);

proc (f, a, n) options operator, arrow; Sum(((D@@k)(f))(a)*(x-a)^k/factorial(k), k = 0 .. n) end proc

(1)

#
# Maple's inbuilt command
#
  taylor(sqrt(x),x=2 ,8);
#
# Or using the above definition and obtaining an inert Sum
#
  myTaylor(x->sqrt(x),2 ,8);
#
# whose value is given by the following - and what a surprise!
# it agrees with the in-built command
#
  value(%);

series(2^(1/2)+((1/4)*2^(1/2))*(x-2)-((1/32)*2^(1/2))*(x-2)^2+((1/128)*2^(1/2))*(x-2)^3-((5/2048)*2^(1/2))*(x-2)^4+((7/8192)*2^(1/2))*(x-2)^5-((21/65536)*2^(1/2))*(x-2)^6+((33/262144)*2^(1/2))*(x-2)^7+O((x-2)^8),x = 2,8)

 

Sum(((D@@k)(proc (x) options operator, arrow; sqrt(x) end proc))(2)*(x-2)^k/factorial(k), k = 0 .. 8)

 

2^(1/2)+(1/4)*2^(1/2)*(x-2)-(1/32)*2^(1/2)*(x-2)^2+(1/128)*2^(1/2)*(x-2)^3-(5/2048)*2^(1/2)*(x-2)^4+(7/8192)*2^(1/2)*(x-2)^5-(21/65536)*2^(1/2)*(x-2)^6+(33/262144)*2^(1/2)*(x-2)^7-(429/8388608)*2^(1/2)*(x-2)^8

(2)

 

Download myTaylor.mw

is shown in the attached

https://en.wikipedia.org/wiki/Hawking_radiation

  restart:
  with(ScientificConstants):

  T:= hbar*c^3/8/Pi/G/K__B/M;
  t__ev:=5120*Pi*G^2*M^3/hbar/c^4;

(1/8)*hbar*c^3/(Pi*G*K__B*M)

 

5120*Pi*G^2*M^3/(hbar*c^4)

(1)

#
# Necessary scientific constants
#
  G:=    evalf(Constant(Newtonian_constant_of_gravitation, units));
  hbar:= evalf(Constant(Planck_constant_over_2pi,          units));
  K__B:= evalf(Constant(Boltzmann_constant,                units));
  c:=    evalf(Constant(speed_of_light_in_vacuum,          units));

0.667408e-10*Units:-Unit(m^3/(kg*s^2))

 

0.1054571800e-33*Units:-Unit(m^2*kg/s)

 

0.1380648510e-22*Units:-Unit(m^2*kg/(s^2*K))

 

299792458.*Units:-Unit(m/s)

(2)

a) The temperature  and dissipation time of Sagittarius A*

  simplify(eval([T,t__ev], M=8.57E36*Unit(kg)));

[0.1431670395e-13*Units:-Unit(K), 0.5294026980e95*Units:-Unit(s)]

(3)

 

Download BHT.mw

You can define a "subprocedure" within the main procedure - just treat it as a local. This compartmntalization is probably better programming practice, because the main procedure no longer depends on "external" information.

In your specifc example the "sub-procedure" maxmin() isn't really necessary since its function can be rplaced by the simple MAple commands max() and min().

A quick tidy-up of your example produces the attached

  restart;

  optimize:= proc( f, a, b, N)
                   local X:= Array(0..N, i-> evalf(a+i*(b-a)/N)),
                         Y:= Array(0..N, i-> f(X[i])),
                         L:= Array(0..N, i-> plot([ [X[i],0], [X[i],Y[i]]], color=black)),
                         i, xmax:={}, xmin:={}, maxv, minv:
                   maxv:= max(Y);
                   minv:= min(Y);
                   for i from 0 to N do
                       if   Y[i]=maxv
                       then xmax:= xmax union {X[i]}
                       fi;
                       if Y[i]=minv
                       then xmin:= xmin union {X[i]}
                       fi;
                   od;
                   print(`maximum y value is`,maxv,`and occurs at these x values`,xmax);
                   print(`minimum y value is`,minv,`and occurs at these x values`,xmin);
                   return plots:-display({seq(L[i],i=1..N)}):
             end proc:

  f:=x->3+10*(-x^2+x^4)*exp(-x^2);
  optimize(f,-1,4,150);

proc (x) options operator, arrow; 3+10*(-x^2+x^4)*exp(-x^2) end proc

 

`maximum y value is`, 6.088066652, `and occurs at these x values`, {1.633333333}

 

`minimum y value is`, 1.391538737, `and occurs at these x values`, {-.6333333333, .6333333333}

 

 

 

Download minmax.mw

After fixing some errors which have been reported by others, and performing a general "tidy-up" the attached provides a solution.

A warning: Whilst "tidying-up" the original I may have inadvertently changed something important, so I suggest you check the attached very carefully

  restart;

  local gamma:
  local GAMMA:

  odeSystem:= [ (1 + GAMMA)*diff(f(eta), eta$4) - S*(eta*diff(f(eta), eta$3) + 3*diff(f(eta), eta$2)
                +
                diff(f(eta), eta)*diff(f(eta), eta$2) - f(eta)*diff(f(eta), eta$3))
                -
                GAMMA*delta(2*diff(f(eta), eta$2)*diff(f(eta), eta$3)^2 + diff(f(eta), eta$2)^2*diff(f(eta), eta$4))
                -
                M^2*diff(f(eta), eta$2) = 0,

                (1 + (4*R)/3)*diff(theta(eta), eta$2) + Pr*S*(f(eta)*diff(theta(eta), eta)
                -
                eta*diff(theta(eta), eta) + Q*theta(eta)) = 0,

                diff(phi(eta), eta$2) + Sc*S*(f(eta)*diff(phi(eta), eta)
                -
                eta*diff(phi(eta), eta)) - Sc*gamma*phi(eta) = 0
              ];

  params:= [ S = 0.5, GAMMA = 0.1, delta = 0.1, gamma = 0.1, M = 1,
             Pr = 1, Ec = 0.2, Sc = 0.6, R = 1, Q = 1
           ];
  bcs :=[ f(0) = 0, (D@@2)(f)(0) = 0, f(1) = 1, D(f)(1) = 0, D(theta)(0) = 0,
          theta(1) = 1, phi(1) = 1, D(phi)(0) = 0
        ];

[(1+GAMMA)*(diff(diff(diff(diff(f(eta), eta), eta), eta), eta))-S*(eta*(diff(diff(diff(f(eta), eta), eta), eta))+3*(diff(diff(f(eta), eta), eta))+(diff(f(eta), eta))*(diff(diff(f(eta), eta), eta))-f(eta)*(diff(diff(diff(f(eta), eta), eta), eta)))-GAMMA*delta(2*(diff(diff(f(eta), eta), eta))*(diff(diff(diff(f(eta), eta), eta), eta))^2+(diff(diff(f(eta), eta), eta))^2*(diff(diff(diff(diff(f(eta), eta), eta), eta), eta)))-M^2*(diff(diff(f(eta), eta), eta)) = 0, (1+(4/3)*R)*(diff(diff(theta(eta), eta), eta))+Pr*S*(f(eta)*(diff(theta(eta), eta))-eta*(diff(theta(eta), eta))+Q*theta(eta)) = 0, diff(diff(phi(eta), eta), eta)+Sc*S*(f(eta)*(diff(phi(eta), eta))-eta*(diff(phi(eta), eta)))-Sc*gamma*phi(eta) = 0]

 

[S = .5, GAMMA = .1, delta = .1, gamma = .1, M = 1, Pr = 1, Ec = .2, Sc = .6, R = 1, Q = 1]

 

[f(0) = 0, ((D@@2)(f))(0) = 0, f(1) = 1, (D(f))(1) = 0, (D(theta))(0) = 0, theta(1) = 1, phi(1) = 1, (D(phi))(0) = 0]

(1)

  SOL :=dsolve([eval(odeSystem, params)[], bcs[]], numeric);

proc (x_bvp) local res, data, solnproc, _ndsol, outpoint, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then outpoint := evalf[_EnvDSNumericSaveDigits](x_bvp) else outpoint := evalf(x_bvp) end if; data := Array(1..4, {(1) = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; X := Vector(8, {(1) = .0, (2) = .13761679545133373, (3) = .34498164173439616, (4) = .5186818700028772, (5) = .6631755824919455, (6) = .7865103203155236, (7) = .8962952680189267, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 8, {(1, 1) = .0, (1, 2) = 1.4433937317396737, (1, 3) = .0, (1, 4) = -2.333121764948255, (1, 5) = .9711210336114556, (1, 6) = .0, (1, 7) = 1.1163392618484445, (1, 8) = .0, (2, 1) = .19761929156705052, (2, 2) = 1.421209729987723, (2, 3) = -.32375830204564643, (2, 4) = -2.392260734568203, (2, 5) = .9716725996393883, (2, 6) = 0.801340863076986e-2, (2, 7) = 1.1140755243321754, (2, 8) = -0.3287828715461909e-1, (3, 1) = .4817243251385398, (3, 2) = 1.3008434883136388, (3, 3) = -.8482708398270041, (3, 4) = -2.714257299186619, (3, 5) = .9745816070440784, (3, 6) = 0.2002590221467707e-1, (3, 7) = 1.1021602830549697, (3, 8) = -0.8188503410269617e-1, (4, 1) = .6924187029933173, (4, 2) = 1.1103171239033962, (4, 3) = -1.3599018273312409, (4, 4) = -3.2132349822084665, (4, 5) = .9789272904347387, (4, 6) = 0.29996555764223734e-1, (4, 7) = 1.0844381842992008, (4, 8) = -.12199622650773645, (5, 1) = .8369727164823445, (5, 2) = .8783677802907506, (5, 3) = -1.8648151994971516, (5, 4) = -3.8033927793066664, (5, 5) = .9838576171457577, (5, 6) = 0.3824284453448716e-1, (5, 7) = 1.0644511561493029, (5, 8) = -.15452011154869225, (6, 1) = .9298863513249988, (6, 2) = .6178998393102831, (6, 3) = -2.372140723196441, (6, 4) = -4.445722882837911, (6, 5) = .9890086375535491, (6, 6) = 0.4529345604521887e-1, (6, 7) = 1.0437137097072917, (6, 8) = -.1816709009089781, (7, 1) = .9824105305991222, (7, 2) = .3293564404735158, (7, 3) = -2.8969848977175445, (7, 4) = -5.134784677019601, (7, 5) = .9943285639648187, (7, 6) = 0.5163894363658305e-1, (7, 7) = 1.0224610163782957, (7, 8) = -.20544783400660863, (8, 1) = 1.0, (8, 2) = .0, (8, 3) = -3.467970343378204, (8, 4) = -5.895376469857138, (8, 5) = 1.0, (8, 6) = 0.5776651945857268e-1, (8, 7) = 1.0, (8, 8) = -.22770673143200507}, datatype = float[8], order = C_order); YP := Matrix(8, 8, {(1, 1) = 1.4433937317396737, (1, 2) = .0, (1, 3) = -2.333121764948255, (1, 4) = 0.909090909090909e-2, (1, 5) = .0, (1, 6) = 0.5826726201668733e-1, (1, 7) = .0, (1, 8) = -.23921555611038064, (2, 1) = 1.421209729987723, (2, 2) = -.32375830204564643, (2, 3) = -2.392260734568203, (2, 4) = -.8706265199209529, (2, 5) = 0.801340863076986e-2, (2, 6) = 0.5815610862229087e-1, (2, 7) = -0.3287828715461909e-1, (2, 8) = -.23830773107890446, (3, 1) = 1.3008434883136388, (3, 2) = -.8482708398270041, (3, 3) = -2.714257299186619, (3, 4) = -2.2516668049592052, (3, 5) = 0.2002590221467707e-1, (3, 6) = 0.5765337774071753e-1, (3, 7) = -0.8188503410269617e-1, (3, 8) = -.23377780794881264, (4, 1) = 1.1103171239033962, (4, 2) = -1.3599018273312409, (4, 3) = -3.2132349822084665, (4, 4) = -3.514170069502999, (4, 5) = 0.29996555764223734e-1, (4, 6) = 0.5717218544635511e-1, (4, 7) = -.12199622650773645, (4, 8) = -.22783777420049162, (5, 1) = .8783677802907506, (5, 2) = -1.8648151994971516, (5, 3) = -3.8033927793066664, (5, 4) = -4.67320491838056, (5, 5) = 0.3824284453448716e-1, (5, 6) = 0.5703750799602518e-1, (5, 7) = -.15452011154869225, (5, 8) = -.22234200077534186, (6, 1) = .6178998393102831, (6, 2) = -2.372140723196441, (6, 3) = -4.445722882837911, (6, 4) = -5.7586540389806125, (6, 5) = 0.4529345604521887e-1, (6, 6) = 0.5739231946567326e-1, (6, 7) = -.1816709009089781, (6, 8) = -.2180713836396526, (7, 1) = .3293564404735158, (7, 2) = -2.8969848977175445, (7, 3) = -5.134784677019601, (7, 4) = -6.807673541750535, (7, 5) = 0.5163894363658305e-1, (7, 6) = 0.5832564348070064e-1, (7, 7) = -.20544783400660863, (7, 8) = -.21530760475848917, (8, 1) = .0, (8, 2) = -3.467970343378204, (8, 3) = -5.895376469857138, (8, 4) = -7.872659871314089, (8, 5) = 0.5776651945857268e-1, (8, 6) = 0.6e-1, (8, 7) = -.22770673143200507, (8, 8) = -.214285714285714}, datatype = float[8], order = C_order); errproc := proc (x_bvp) local outpoint, X, Y, yout, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; Digits := 15; outpoint := evalf(x_bvp); X := Vector(8, {(1) = .0, (2) = .13761679545133373, (3) = .34498164173439616, (4) = .5186818700028772, (5) = .6631755824919455, (6) = .7865103203155236, (7) = .8962952680189267, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 8, {(1, 1) = .0, (1, 2) = -0.25304799779016353e-7, (1, 3) = .0, (1, 4) = -0.4146201060728139e-7, (1, 5) = 0.6642099178776253e-10, (1, 6) = .0, (1, 7) = -0.1579491158740188e-9, (1, 8) = .0, (2, 1) = -0.3794935280955525e-8, (2, 2) = -0.25773773835013586e-7, (2, 3) = -0.6457770455915928e-8, (2, 4) = -0.42741332787261556e-7, (2, 5) = 0.6812660169151781e-10, (2, 6) = 0.1786453605430017e-10, (2, 7) = -0.16219194559467549e-9, (2, 8) = -0.43841559921129475e-10, (3, 1) = 0.11737819871794217e-8, (3, 2) = -0.19548408336688137e-7, (3, 3) = 0.13063141620755076e-7, (3, 4) = -0.29637882669106708e-7, (3, 5) = 0.319027499302564e-10, (3, 6) = 0.27100840068170564e-10, (3, 7) = -0.6764942302099327e-10, (3, 8) = -0.8861830614941501e-10, (4, 1) = 0.10333855462730343e-8, (4, 2) = -0.12598333706491768e-7, (4, 3) = 0.15625192446912097e-7, (4, 4) = -0.1143706411410182e-7, (4, 5) = 0.12948853793328739e-10, (4, 6) = 0.23700176593180382e-10, (4, 7) = -0.20398135871970748e-10, (4, 8) = -0.8565904428857674e-10, (5, 1) = 0.3746705824991127e-9, (5, 2) = -0.8117998927462989e-8, (5, 3) = 0.15954474921128882e-7, (5, 4) = 0.6271929994514497e-9, (5, 5) = 0.6634117733896975e-11, (5, 6) = 0.18224563700374814e-10, (5, 7) = -0.6969588139634506e-11, (5, 8) = -0.7325781989983735e-10, (6, 1) = -0.2586420516396408e-10, (6, 2) = -0.4985304741757289e-8, (6, 3) = 0.16666511083414864e-7, (6, 4) = 0.8635115054594654e-8, (6, 5) = 0.4299750819126624e-11, (6, 6) = 0.1341878516027326e-10, (6, 7) = -0.4134559084822396e-11, (6, 8) = -0.6142811269372842e-10, (7, 1) = -0.14354514375013203e-9, (7, 2) = -0.24203028138466706e-8, (7, 3) = 0.1787205688898178e-7, (7, 4) = 0.14480649784508743e-7, (7, 5) = 0.2630248422989425e-11, (7, 6) = 0.8855383001023343e-11, (7, 7) = -0.31053237369603176e-11, (7, 8) = -0.49986065431972777e-10, (8, 1) = .0, (8, 2) = .0, (8, 3) = 0.1946243199488989e-7, (8, 4) = 0.19107020336419163e-7, (8, 5) = .0, (8, 6) = 0.30639368059718205e-11, (8, 7) = .0, (8, 8) = -0.3584956405964587e-10}, datatype = float[8], order = C_order); if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "right" then return X[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(4.2741332787261556e-8) elif outpoint = "errorproc" then error "this is already the error procedure" elif outpoint = "rawdata" then return [8, 8, [f(eta), diff(f(eta), eta), diff(diff(f(eta), eta), eta), diff(diff(diff(f(eta), eta), eta), eta), phi(eta), diff(phi(eta), eta), theta(eta), diff(theta(eta), eta)], X, Y] else return ('procname')(x_bvp) end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] end if; V := array([1 = 4, 2 = 0]); if Digits <= trunc(evalhf(Digits)) then L := Vector(4, 'datatype' = 'float'[8]); yout := Vector(8, 'datatype' = 'float'[8]); evalhf(`dsolve/numeric/lagrange`(8, 8, X, Y, outpoint, var(yout), var(L), var(V))) else L := Vector(4, 'datatype' = 'sfloat'); yout := Vector(8, 'datatype' = 'sfloat'); `dsolve/numeric/lagrange`(8, 8, X, Y, outpoint, yout, L, V) end if; [eta = outpoint, seq('[f(eta), diff(f(eta), eta), diff(diff(f(eta), eta), eta), diff(diff(diff(f(eta), eta), eta), eta), phi(eta), diff(phi(eta), eta), theta(eta), diff(theta(eta), eta)]'[i] = yout[i], i = 1 .. 8)] end proc; if not type(outpoint, 'numeric') then if outpoint = "start" or outpoint = "left" then return X[1] elif outpoint = "method" then return "bvp" elif outpoint = "right" then return X[8] elif outpoint = "order" then return 6 elif outpoint = "error" then return HFloat(4.2741332787261556e-8) elif outpoint = "errorproc" then return eval(errproc) elif outpoint = "rawdata" then return [8, 8, "depnames", X, Y, YP] else error "non-numeric value" end if end if; if outpoint < X[1] or X[8] < outpoint then error "solution is only defined in the range %1..%2", X[1], X[8] end if; if Digits <= trunc(evalhf(Digits)) and (_EnvInFsolve <> true or _EnvDSNumericSaveDigits <= trunc(evalhf(Digits))) then V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = .0, (1, 2) = .0, (2, 1) = .0, (2, 2) = .0, (3, 1) = .0, (3, 2) = .0, (4, 1) = .0, (4, 2) = .0, (5, 1) = .0, (5, 2) = .0, (6, 1) = .0, (6, 2) = .0, (7, 1) = .0, (7, 2) = .0}, datatype = float[8], order = C_order); yout := Vector(8, {(1) = .0, (2) = .0, (3) = .0, (4) = .0, (5) = .0, (6) = .0, (7) = .0, (8) = .0}, datatype = float[8]); evalhf(`dsolve/numeric/hermite`(8, 8, X, Y, YP, outpoint, var(yout), var(L), var(V))) else if _EnvInFsolve = true then Digits := _EnvDSNumericSaveDigits end if; V := array( 1 .. 6, [( 1 ) = (7), ( 2 ) = (0), ( 3 ) = (false), ( 4 ) = (false), ( 5 ) = (false), ( 6 ) = (false)  ] ); L := Matrix(7, 2, {(1, 1) = 0., (1, 2) = 0., (2, 1) = 0., (2, 2) = 0., (3, 1) = 0., (3, 2) = 0., (4, 1) = 0., (4, 2) = 0., (5, 1) = 0., (5, 2) = 0., (6, 1) = 0., (6, 2) = 0., (7, 1) = 0., (7, 2) = 0.}, order = C_order); yout := Vector(8, {(1) = 0., (2) = 0., (3) = 0., (4) = 0., (5) = 0., (6) = 0., (7) = 0., (8) = 0.}); `dsolve/numeric/hermite`(8, 8, X, Y, YP, outpoint, yout, L, V) end if; [outpoint, seq(yout[i], i = 1 .. 8)] end proc, (2) = Array(0..0, {}), (3) = [eta, f(eta), diff(f(eta), eta), diff(diff(f(eta), eta), eta), diff(diff(diff(f(eta), eta), eta), eta), phi(eta), diff(phi(eta), eta), theta(eta), diff(theta(eta), eta)], (4) = 0}); solnproc := data[1]; if not type(outpoint, 'numeric') then if outpoint = "solnprocedure" then return eval(solnproc) elif member(outpoint, ["start", "left", "right", "errorproc", "rawdata", "order", "error"]) then return solnproc(x_bvp) elif outpoint = "sysvars" then return data[3] elif procname <> unknown then return ('procname')(x_bvp) else _ndsol := pointto(data[2][0]); return ('_ndsol')(x_bvp) end if end if; try res := solnproc(outpoint); [eta = res[1], seq('[f(eta), diff(f(eta), eta), diff(diff(f(eta), eta), eta), diff(diff(diff(f(eta), eta), eta), eta), phi(eta), diff(phi(eta), eta), theta(eta), diff(theta(eta), eta)]'[i] = res[i+1], i = 1 .. 8)] catch: error  end try end proc

(2)

  plots:-odeplot( SOL,
                  [ [eta, f(eta)],
                    [eta, theta(eta)],
                    [eta, phi(eta)]
                  ],
                  eta = 0 .. 1,
                  color = [red, green, blue]
                );

 

 

 

Download bvp2.mw

The ?Try help page also states that (my emphasis)

The finalStatSeq is also not executed if one of the following untrappable exceptions occurs:

  • Computation timed out (this can only be caught by timelimit, which raises a "time expired" exception, which can be caught).
  • Computation interrupted (user pressed Ctrl+C, Break, or equivalent).
  • Internal system error (which indicates a bug in Maple itself).
  • ASSERT or return type or local variable type assertion failure (assertion failures are not trappable because they indicate a coding error, not an algorithmic failure).
  • Stack overflow (when that happens, generally stack space is insufficient for doing anything like running cleanup code).

Via a "toy" example, it is relativel trivial to show the exception

Error,...... too many levels of recursion

is never caught. See the attached.

  restart;
  f:= proc(n);
           1/n;
           thisproc(n-1);
      end proc:

  f(4); # produces divide by zero error
  f(4.5); # produces recursion error

Error, (in f) numeric exception: division by zero

 

Error, (in f) too many levels of recursion

 

#
# Catches the divide-by-zero error, but NOT
# the recursion error
#
  for k in [4, 4.5] do
      try f(k)
      catch "numeric exception: division by zero":
            printf("divide-by-zero error fo k=%a\n", k);
      catch "too many levels of recursion":
            printf("recursion error for k=%a\n", k);
      end try;
  end do;

divide-by-zero error fo k=4

 

Error, (in f) too many levels of recursion

 

 

Download noCatch.mw

cheat!

The Maple help at

?Applications,DCMotor

produces a worksheet, the final section of which is LQR Control Design. This contains a couple of procedures which returns the LQR state feedback gains given state (A) and input (B) matrices of the system. I have shamelessly stolen these procedures for use in the attached worksheet which addresses your specific problem.

I would also draw your attention to thee command LinearAlgebra:-CARE(), which (according to the help page), "solves the continuous algebraic Riccati equation" - this is a lot shorter and returns the same result if the correct output option is selected. See the attached

  restart;
#
# LQR procedure
#
# This procedure returns the LQR state feedback
# controller gains given state (A) and input (B)
# matrices of the system.
#

  LQR:= proc( A, B, Q, R )
              uses LinearAlgebra;
              local n, invR, H, v, e, i, M1, M2, P, K, m;

              n:= RowDimension( A );

              if   type( R, 'Matrix' )
              then invR:= MatrixInverse( R );
              elif type( R, 'numeric' )
              then invR:= Matrix( [ [ 1/R ] ] );
              else error "%-1 parameter must be of type numeric", 4;
              end if;

            # Hamiltonian Matrix
              H:= Matrix( [ [evalf(A), evalf(-B.invR.Transpose(B))],
                            [evalf(-Q),evalf(-Transpose(A))]
                          ]
                        );
             (v, e):= Eigenvectors( H );

            # Forming the submatrices
              M1:= SubMatrix( e, [1..n],[1..2*n] );
              M2:= SubMatrix( e, [n+1..2*n],[1..2*n] );

            # Remove the columns from the M1 and M2 matrices corresponding to the
            # unstable eigenvalues.
              m:= 1;
              for i from 1 to 2*n do
                  if   Re( v[ i ] ) >= 0
                  then # Remove the corresponding column from M1 and M2
                       M1:= RemoveAColumn( M1, m );
                       M2:= RemoveAColumn( M2, m );
                  else m:= m+1;
                  end if;
              end do;

            # The solution to the Riccati equation is given by:
            # P:= Re{ M2.M1^-1 }
              P:= map( Re, M2.MatrixInverse( M1 ) );

            # The LQR gain is then given by:
            # K:= R^-1 . B^T . P;
              K:= invR.Transpose(B).P;

              return K;
        end proc:

# Procedure "RemoveAColumn".

  RemoveAColumn:= proc( A, i )
                        uses LinearAlgebra;
                        local n, M;
                        n:= ColumnDimension( A );
                        if   i = 1
                        then M:= SubMatrix( A, [1..-1],[2..n] );
                        elif i = n
                        then M:= SubMatrix( A, [1..-1],[1..n-1] );
                        else M:= < SubMatrix( A, [1..-1],[1..i-1] ) |
                                   SubMatrix( A, [1..-1],[i+1..-1] )
                                 >;
                        end if;
                        return M;
                  end proc:

  A:= Matrix(2, 2, [[2, 1], [1, -1]]);
  B:= Matrix(2, 1, [3, 1]);
  Q:= Matrix(2, 2, [[3, 0], [0, 2]]);
  R:= 3.0;
  Kss:= LQR(A, B, Q, R)

Matrix(2, 2, {(1, 1) = 2, (1, 2) = 1, (2, 1) = 1, (2, 2) = -1})

 

Vector(2, {(1) = 3, (2) = 1})

 

Matrix(2, 2, {(1, 1) = 3, (1, 2) = 0, (2, 1) = 0, (2, 2) = 2})

 

R := 3.0

 

Matrix(%id = 36893488148078811364)

(1)

#
# Short version of the above
#
  LinearAlgebra:-CARE( A, B, Q, Matrix(1,1,[R]), output=G);

Vector[row](2, {(1) = 1.8894411356366065, (2) = .5084635086437952})

(2)

 

Download LQR.mw

 

My original answer to this just "disappeared" - I have no idea why, and it annoys me to have to type this again!

Your worksheet has multiple problems: from memory these are

  1. An inability on your part to distinguish between "executable" and "non-executable" math input. This results in what seem to be "random" error message cropping upoo att various points in yur worksheet. As far as I can tell, none of these are significant, but in my view, no serious Maple worksheet should ever produce "Error" messages- whatever the reason - so in the attached I have  fixed these wherever they occur
  2. There is an execution group which uses the command/procedure Picture(). AFAIK there is no Maple command Picture() and the worksheet contains no procedure definition for Picture(). So WTF is this command supposed to do? Luckily the output of this execution group is not used subsequently, so I have merely highlighted ithe offending execution group in the attached and commented it out
  3. There is another execution group where a simple plot() command receives a range variable where one end of the range is a real constant and the othere end is a complex constant. I have no idea what you expect this to produce. Think of a "toy" example: if I gave the command plot(x, x=0..1+I) what the hell would you exoect it to produce? Agian I have just highlighted/commentedOut the offending command in the attached

If I "inline" the attached worksheet , it works, but then I cannot "submit" it because this site is broken (AGAIN), hence you will have to download the attached to see what I am talking about

PCTiling.mw

The attached shows that the failure occurs on the second iteration of the outer loop. Why? - well, after the firrst iteration of the outer loop, each of Y[0], Y[1], Y[2], Y[3], Y[4], Y[5] is known. So the second time the inner loop executes Y[k+1] is known and it makes no sense to "solve" for it

restart

NULL

F[0] := .2; X[0] := 0; Y[0] := .1130

for g from 0 while g < 100 do for k from 0 to 4 do printf("g=%d  k=%d\n", g, k); F[k+1] := X[k]/(k+1); X[k+1] := Y[k]/(k+1); Y[k+1] := solve((k+1)*Y[k+1]-add(X[l]*X[k-l], l = 0 .. k)+add(F[l]*Y[k-l], l = 0 .. k), Y[k+1]) end do; m := .2; y := g*m; AA[g] := add(X[i]*(eta-y)^i, i = 0 .. k); BB[g] := add(Y[i]*(eta-y)^i, i = 0 .. k); CC[g] := add(F[i]*(eta-y)^i, i = 0 .. k); A := add(X[i]*m^i, i = 0 .. k); B := add(Y[i]*m^i, i = 0 .. k); C := add(F[i]*m^i, i = 0 .. k); F[0] := C; X[0] := A; Y[0] := B end do

g=0  k=0
g=0  k=1
g=0  k=2
g=0  k=3
g=0  k=4
g=1  k=0

 

Warning, solving for expressions other than names or functions is not recommended.

 

Error, (in solve) a constant is invalid as a variable, -0.2260000000e-1

 

op(Y)

table( [( 0 ) = .1085857294, ( 1 ) = -0.2260000000e-1, ( 2 ) = 0.2260000000e-2, ( 3 ) = 0.1977500000e-2, ( 4 ) = -0.3116916668e-3, ( 5 ) = 0.2523666668e-4 ] )

(1)

 


 

Download indexProblem.mw

I checked the first 10 (out of 14554) graphs and agree with vv - it takes about 0.5sec/graph

I don't have mathemtica (so I may be completely wrong herre) - but doesn't the output from your Mathermatica commands imply that there are no graphs whose VertexConnectivity is 6??

According to the attached, each of the first 10 has a VertexConnectivity of 6 -(and in fact if I try a few groups of adjacent list elements, then it seems to be true that the VertexConnectivity is always(??!) 6

  restart:
  with(GraphTheory):
  L:= ImportGraph("C:/Users/TomLeslie/Desktop/op21new.g6", graph6, output=list):
  whattype(L);
  numelems(L);
  CodeTools:-Usage(select(g->VertexConnectivity(g)=6,L[1..10])); #works, but slow?
  CodeTools:-Usage(select(g->VertexConnectivity(g)=6,L[1001..1010])); #works, but slow?
  IsIsomorphic(L[1], L[2]);

list

 

14554

 

memory used=0.50GiB, alloc change=15.00MiB, cpu time=5.57s, real time=5.14s, gc time=811.21ms

 

[GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 7}, (2) = {1, 3, 4, 5, 6, 13}, (3) = {1, 2, 4, 6, 7, 18}, (4) = {1, 2, 3, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19}, (5) = {1, 2, 4, 6, 12, 13}, (6) = {1, 2, 3, 5, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 20, 21}, (7) = {1, 3, 4, 6, 8, 18}, (8) = {4, 6, 7, 9, 17, 18}, (9) = {4, 6, 8, 10, 16, 17}, (10) = {4, 6, 9, 11, 15, 16}, (11) = {4, 10, 12, 15, 19, 21}, (12) = {4, 5, 11, 13, 19, 20}, (13) = {2, 4, 5, 6, 12, 14, 19, 20}, (14) = {6, 13, 15, 19, 20, 21}, (15) = {4, 6, 10, 11, 14, 16, 19, 21}, (16) = {4, 6, 9, 10, 15, 17}, (17) = {4, 6, 8, 9, 16, 18}, (18) = {3, 4, 6, 7, 8, 17}, (19) = {4, 11, 12, 13, 14, 15, 20, 21}, (20) = {6, 12, 13, 14, 19, 21}, (21) = {6, 11, 14, 15, 19, 20}}), `GRAPHLN/table/1`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 7}, (2) = {1, 3, 4, 5, 6, 14}, (3) = {1, 2, 4, 6, 7, 19}, (4) = {1, 2, 3, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}, (5) = {1, 2, 4, 6, 13, 14}, (6) = {1, 2, 3, 5, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19, 21}, (7) = {1, 3, 4, 6, 8, 19}, (8) = {4, 6, 7, 9, 18, 19}, (9) = {4, 6, 8, 10, 17, 18}, (10) = {4, 6, 9, 11, 16, 17}, (11) = {4, 10, 12, 16, 20, 21}, (12) = {4, 11, 13, 15, 20, 21}, (13) = {4, 5, 6, 12, 14, 15}, (14) = {2, 4, 5, 6, 13, 15}, (15) = {4, 6, 12, 13, 14, 16, 20, 21}, (16) = {4, 6, 10, 11, 15, 17, 20, 21}, (17) = {4, 6, 9, 10, 16, 18}, (18) = {4, 6, 8, 9, 17, 19}, (19) = {3, 4, 6, 7, 8, 18}, (20) = {4, 11, 12, 15, 16, 21}, (21) = {6, 11, 12, 15, 16, 20}}), `GRAPHLN/table/2`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 11}, (2) = {1, 3, 4, 5, 6, 17}, (3) = {1, 2, 4, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19}, (4) = {1, 2, 3, 5, 11, 12}, (5) = {1, 2, 4, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21}, (6) = {1, 2, 3, 5, 7, 17}, (7) = {3, 5, 6, 8, 16, 17}, (8) = {3, 5, 7, 9, 15, 16, 18, 21}, (9) = {3, 8, 10, 18, 19, 21}, (10) = {3, 5, 9, 11, 12, 13, 19, 20}, (11) = {1, 3, 4, 5, 10, 12}, (12) = {3, 4, 5, 10, 11, 13}, (13) = {5, 10, 12, 14, 19, 20}, (14) = {5, 13, 15, 19, 20, 21}, (15) = {5, 8, 14, 16, 18, 21}, (16) = {3, 5, 7, 8, 15, 17}, (17) = {2, 3, 5, 6, 7, 16}, (18) = {3, 8, 9, 15, 19, 21}, (19) = {3, 9, 10, 13, 14, 18, 20, 21}, (20) = {5, 10, 13, 14, 19, 21}, (21) = {5, 8, 9, 14, 15, 18, 19, 20}}), `GRAPHLN/table/3`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 11}, (2) = {1, 3, 4, 5, 6, 18}, (3) = {1, 2, 4, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19}, (4) = {1, 2, 3, 5, 11, 12}, (5) = {1, 2, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21}, (6) = {1, 2, 3, 5, 7, 18}, (7) = {3, 5, 6, 8, 17, 18}, (8) = {3, 5, 7, 9, 16, 17}, (9) = {3, 5, 8, 10, 15, 16, 19, 21}, (10) = {3, 5, 9, 11, 12, 13, 19, 20}, (11) = {1, 3, 4, 5, 10, 12}, (12) = {3, 4, 5, 10, 11, 13}, (13) = {5, 10, 12, 14, 19, 20}, (14) = {5, 13, 15, 19, 20, 21}, (15) = {5, 9, 14, 16, 19, 21}, (16) = {3, 5, 8, 9, 15, 17}, (17) = {3, 5, 7, 8, 16, 18}, (18) = {2, 3, 5, 6, 7, 17}, (19) = {3, 9, 10, 13, 14, 15, 20, 21}, (20) = {5, 10, 13, 14, 19, 21}, (21) = {5, 9, 14, 15, 19, 20}}), `GRAPHLN/table/4`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 11}, (2) = {1, 3, 4, 5, 6, 17}, (3) = {1, 2, 4, 6, 7, 8, 9, 10, 11, 12, 15, 16, 17, 18}, (4) = {1, 2, 3, 5, 11, 12}, (5) = {1, 2, 4, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 19, 20, 21}, (6) = {1, 2, 3, 5, 7, 17}, (7) = {3, 5, 6, 8, 16, 17}, (8) = {3, 5, 7, 9, 15, 16}, (9) = {3, 8, 10, 15, 18, 21}, (10) = {3, 9, 11, 12, 18, 19}, (11) = {1, 3, 4, 5, 10, 12}, (12) = {3, 4, 5, 10, 11, 13, 18, 19}, (13) = {5, 12, 14, 18, 19, 20}, (14) = {5, 13, 15, 18, 20, 21}, (15) = {3, 5, 8, 9, 14, 16, 18, 21}, (16) = {3, 5, 7, 8, 15, 17}, (17) = {2, 3, 5, 6, 7, 16}, (18) = {3, 9, 10, 12, 13, 14, 15, 19, 20, 21}, (19) = {5, 10, 12, 13, 18, 20}, (20) = {5, 13, 14, 18, 19, 21}, (21) = {5, 9, 14, 15, 18, 20}}), `GRAPHLN/table/5`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 12}, (2) = {1, 3, 4, 5, 6, 16}, (3) = {1, 2, 4, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19}, (4) = {1, 2, 3, 5, 12, 13}, (5) = {1, 2, 4, 6, 7, 12, 13, 14, 15, 16, 20, 21}, (6) = {1, 2, 3, 5, 7, 16}, (7) = {3, 5, 6, 8, 15, 16}, (8) = {3, 7, 9, 15, 17, 21}, (9) = {3, 8, 10, 17, 18, 20}, (10) = {3, 9, 11, 18, 19, 20}, (11) = {3, 10, 12, 13, 19, 20}, (12) = {1, 3, 4, 5, 11, 13}, (13) = {3, 4, 5, 11, 12, 14, 19, 20}, (14) = {5, 13, 15, 17, 20, 21}, (15) = {3, 5, 7, 8, 14, 16, 17, 21}, (16) = {2, 3, 5, 6, 7, 15}, (17) = {3, 8, 9, 14, 15, 18, 20, 21}, (18) = {3, 9, 10, 17, 19, 20}, (19) = {3, 10, 11, 13, 18, 20}, (20) = {5, 9, 10, 11, 13, 14, 17, 18, 19, 21}, (21) = {5, 8, 14, 15, 17, 20}}), `GRAPHLN/table/6`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 13}, (2) = {1, 3, 4, 5, 6, 17}, (3) = {1, 2, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}, (4) = {1, 2, 3, 5, 13, 14}, (5) = {1, 2, 4, 6, 7, 8, 13, 14, 15, 16, 17, 21}, (6) = {1, 2, 3, 5, 7, 17}, (7) = {3, 5, 6, 8, 16, 17}, (8) = {3, 5, 7, 9, 15, 16}, (9) = {3, 8, 10, 15, 18, 21}, (10) = {3, 9, 11, 18, 19, 21}, (11) = {3, 10, 12, 19, 20, 21}, (12) = {3, 11, 13, 14, 20, 21}, (13) = {1, 3, 4, 5, 12, 14}, (14) = {3, 4, 5, 12, 13, 15, 20, 21}, (15) = {3, 5, 8, 9, 14, 16, 18, 21}, (16) = {3, 5, 7, 8, 15, 17}, (17) = {2, 3, 5, 6, 7, 16}, (18) = {3, 9, 10, 15, 19, 21}, (19) = {3, 10, 11, 18, 20, 21}, (20) = {3, 11, 12, 14, 19, 21}, (21) = {5, 9, 10, 11, 12, 14, 15, 18, 19, 20}}), `GRAPHLN/table/7`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 12}, (2) = {1, 3, 4, 5, 6, 16}, (3) = {1, 2, 4, 6, 7, 8, 9, 10, 11, 12, 15, 16, 17, 18, 19, 20}, (4) = {1, 2, 3, 5, 12, 13}, (5) = {1, 2, 4, 6, 7, 8, 12, 13, 14, 15, 16, 21}, (6) = {1, 2, 3, 5, 7, 16}, (7) = {3, 5, 6, 8, 15, 16}, (8) = {3, 5, 7, 9, 14, 15, 17, 21}, (9) = {3, 8, 10, 17, 18, 21}, (10) = {3, 9, 11, 18, 19, 21}, (11) = {3, 10, 12, 19, 20, 21}, (12) = {1, 3, 4, 5, 11, 13, 20, 21}, (13) = {4, 5, 12, 14, 20, 21}, (14) = {5, 8, 13, 15, 17, 21}, (15) = {3, 5, 7, 8, 14, 16}, (16) = {2, 3, 5, 6, 7, 15}, (17) = {3, 8, 9, 14, 18, 21}, (18) = {3, 9, 10, 17, 19, 21}, (19) = {3, 10, 11, 18, 20, 21}, (20) = {3, 11, 12, 13, 19, 21}, (21) = {5, 8, 9, 10, 11, 12, 13, 14, 17, 18, 19, 20}}), `GRAPHLN/table/8`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 11}, (2) = {1, 3, 4, 5, 6, 16}, (3) = {1, 2, 4, 6, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19}, (4) = {1, 2, 3, 5, 11, 12, 13, 19}, (5) = {1, 2, 4, 6, 7, 12, 13, 14, 15, 16, 20, 21}, (6) = {1, 2, 3, 5, 7, 16}, (7) = {3, 5, 6, 8, 15, 16}, (8) = {3, 7, 9, 15, 17, 21}, (9) = {3, 8, 10, 17, 18, 20}, (10) = {3, 9, 11, 18, 19, 20}, (11) = {1, 3, 4, 10, 12, 19}, (12) = {4, 5, 11, 13, 19, 20}, (13) = {4, 5, 12, 14, 19, 20}, (14) = {5, 13, 15, 17, 20, 21}, (15) = {3, 5, 7, 8, 14, 16, 17, 21}, (16) = {2, 3, 5, 6, 7, 15}, (17) = {3, 8, 9, 14, 15, 18, 20, 21}, (18) = {3, 9, 10, 17, 19, 20}, (19) = {3, 4, 10, 11, 12, 13, 18, 20}, (20) = {5, 9, 10, 12, 13, 14, 17, 18, 19, 21}, (21) = {5, 8, 14, 15, 17, 20}}), `GRAPHLN/table/9`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 9}, (2) = {1, 3, 4, 5, 6, 13}, (3) = {1, 2, 4, 6, 7, 8, 9, 12, 13, 16}, (4) = {1, 2, 3, 5, 9, 10}, (5) = {1, 2, 4, 6, 7, 8, 9, 10, 11, 12, 13, 18}, (6) = {1, 2, 3, 5, 7, 13}, (7) = {3, 5, 6, 8, 12, 13}, (8) = {3, 5, 7, 9, 11, 12, 14, 15, 16, 19, 20, 21}, (9) = {1, 3, 4, 5, 8, 10, 16, 17, 18, 21}, (10) = {4, 5, 9, 11, 17, 18}, (11) = {5, 8, 10, 12, 14, 17, 18, 19}, (12) = {3, 5, 7, 8, 11, 13}, (13) = {2, 3, 5, 6, 7, 12}, (14) = {8, 11, 15, 17, 19, 20}, (15) = {8, 14, 16, 17, 20, 21}, (16) = {3, 8, 9, 15, 17, 21}, (17) = {9, 10, 11, 14, 15, 16, 18, 19, 20, 21}, (18) = {5, 9, 10, 11, 17, 19}, (19) = {8, 11, 14, 17, 18, 20}, (20) = {8, 14, 15, 17, 19, 21}, (21) = {8, 9, 15, 16, 17, 20}}), `GRAPHLN/table/10`, 0)]

 

memory used=0.54GiB, alloc change=24.00MiB, cpu time=6.12s, real time=5.75s, gc time=811.21ms

 

[GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 8, 9}, (2) = {1, 3, 4, 5, 6, 7, 8, 11, 12, 13}, (3) = {1, 2, 4, 8, 9, 17}, (4) = {1, 2, 3, 5, 9, 10, 11, 12}, (5) = {1, 2, 4, 6, 10, 11}, (6) = {2, 5, 7, 10, 11, 12}, (7) = {2, 6, 8, 12, 13, 21}, (8) = {1, 2, 3, 7, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21}, (9) = {1, 3, 4, 8, 10, 12, 17, 18}, (10) = {4, 5, 6, 9, 11, 12}, (11) = {2, 4, 5, 6, 10, 12}, (12) = {2, 4, 6, 7, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21}, (13) = {2, 7, 8, 12, 14, 21}, (14) = {8, 12, 13, 15, 20, 21}, (15) = {8, 12, 14, 16, 19, 20}, (16) = {8, 12, 15, 17, 18, 19}, (17) = {3, 8, 9, 12, 16, 18}, (18) = {8, 9, 12, 16, 17, 19}, (19) = {8, 12, 15, 16, 18, 20}, (20) = {8, 12, 14, 15, 19, 21}, (21) = {7, 8, 12, 13, 14, 20}}), `GRAPHLN/table/1001`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 7, 8}, (2) = {1, 3, 4, 5, 6, 7, 10, 11}, (3) = {1, 2, 4, 7, 8, 15}, (4) = {1, 2, 3, 5, 8, 9, 10, 16}, (5) = {1, 2, 4, 6, 9, 10}, (6) = {2, 5, 7, 10, 11, 17}, (7) = {1, 2, 3, 6, 8, 11, 12, 13, 14, 15, 18, 19, 20, 21}, (8) = {1, 3, 4, 7, 9, 15, 16, 21}, (9) = {4, 5, 8, 10, 16, 17}, (10) = {2, 4, 5, 6, 9, 11, 16, 17}, (11) = {2, 6, 7, 10, 12, 16, 17, 18}, (12) = {7, 11, 13, 16, 18, 19}, (13) = {7, 12, 14, 16, 19, 20}, (14) = {7, 13, 15, 16, 20, 21}, (15) = {3, 7, 8, 14, 16, 21}, (16) = {4, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21}, (17) = {6, 9, 10, 11, 16, 18}, (18) = {7, 11, 12, 16, 17, 19}, (19) = {7, 12, 13, 16, 18, 20}, (20) = {7, 13, 14, 16, 19, 21}, (21) = {7, 8, 14, 15, 16, 20}}), `GRAPHLN/table/1002`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 7, 8, 10}, (2) = {1, 3, 5, 6, 7, 11}, (3) = {1, 2, 4, 7, 8, 13}, (4) = {1, 3, 5, 8, 9, 10, 12, 17}, (5) = {1, 2, 4, 6, 10, 11}, (6) = {1, 2, 5, 7, 10, 11}, (7) = {1, 2, 3, 6, 8, 10, 11, 12, 13, 21}, (8) = {1, 3, 4, 7, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21}, (9) = {4, 8, 10, 12, 17, 18}, (10) = {1, 4, 5, 6, 7, 9, 11, 12}, (11) = {2, 5, 6, 7, 10, 12}, (12) = {4, 7, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21}, (13) = {3, 7, 8, 12, 14, 21}, (14) = {8, 12, 13, 15, 20, 21}, (15) = {8, 12, 14, 16, 19, 20}, (16) = {8, 12, 15, 17, 18, 19}, (17) = {4, 8, 9, 12, 16, 18}, (18) = {8, 9, 12, 16, 17, 19}, (19) = {8, 12, 15, 16, 18, 20}, (20) = {8, 12, 14, 15, 19, 21}, (21) = {7, 8, 12, 13, 14, 20}}), `GRAPHLN/table/1003`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 9}, (2) = {1, 3, 4, 5, 6, 12}, (3) = {1, 2, 4, 6, 7, 8, 9, 11, 12, 13}, (4) = {1, 2, 3, 5, 9, 10, 11, 17}, (5) = {1, 2, 4, 6, 7, 10, 11, 12}, (6) = {1, 2, 3, 5, 7, 12}, (7) = {3, 5, 6, 8, 11, 12}, (8) = {3, 7, 9, 11, 13, 21}, (9) = {1, 3, 4, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21}, (10) = {4, 5, 9, 11, 17, 18}, (11) = {3, 4, 5, 7, 8, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21}, (12) = {2, 3, 5, 6, 7, 11}, (13) = {3, 8, 9, 11, 14, 21}, (14) = {9, 11, 13, 15, 20, 21}, (15) = {9, 11, 14, 16, 19, 20}, (16) = {9, 11, 15, 17, 18, 19}, (17) = {4, 9, 10, 11, 16, 18}, (18) = {9, 10, 11, 16, 17, 19}, (19) = {9, 11, 15, 16, 18, 20}, (20) = {9, 11, 14, 15, 19, 21}, (21) = {8, 9, 11, 13, 14, 20}}), `GRAPHLN/table/1004`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 8}, (2) = {1, 3, 4, 5, 6, 11}, (3) = {1, 2, 4, 6, 7, 8, 11, 12}, (4) = {1, 2, 3, 5, 8, 9, 10, 16}, (5) = {1, 2, 4, 6, 9, 10, 11, 21}, (6) = {1, 2, 3, 5, 7, 11}, (7) = {3, 6, 8, 11, 12, 21}, (8) = {1, 3, 4, 7, 9, 12, 13, 14, 15, 16, 17, 18, 19, 20}, (9) = {4, 5, 8, 10, 16, 17}, (10) = {4, 5, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21}, (11) = {2, 3, 5, 6, 7, 10, 12, 21}, (12) = {3, 7, 8, 10, 11, 13, 20, 21}, (13) = {8, 10, 12, 14, 19, 20}, (14) = {8, 10, 13, 15, 18, 19}, (15) = {8, 10, 14, 16, 17, 18}, (16) = {4, 8, 9, 10, 15, 17}, (17) = {8, 9, 10, 15, 16, 18}, (18) = {8, 10, 14, 15, 17, 19}, (19) = {8, 10, 13, 14, 18, 20}, (20) = {8, 10, 12, 13, 19, 21}, (21) = {5, 7, 10, 11, 12, 20}}), `GRAPHLN/table/1005`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 7}, (2) = {1, 3, 4, 5, 6, 13}, (3) = {1, 2, 4, 6, 7, 15}, (4) = {1, 2, 3, 5, 7, 8, 9, 16}, (5) = {1, 2, 4, 6, 8, 9, 10, 11, 12, 13, 18, 19, 20, 21}, (6) = {1, 2, 3, 5, 7, 13, 14, 15, 17, 21}, (7) = {1, 3, 4, 6, 8, 15, 16, 17}, (8) = {4, 5, 7, 9, 16, 17}, (9) = {4, 5, 8, 10, 14, 16, 17, 18}, (10) = {5, 9, 11, 14, 18, 19}, (11) = {5, 10, 12, 14, 19, 20}, (12) = {5, 11, 13, 14, 20, 21}, (13) = {2, 5, 6, 12, 14, 21}, (14) = {6, 9, 10, 11, 12, 13, 15, 17, 18, 19, 20, 21}, (15) = {3, 6, 7, 14, 16, 17}, (16) = {4, 7, 8, 9, 15, 17}, (17) = {6, 7, 8, 9, 14, 15, 16, 18}, (18) = {5, 9, 10, 14, 17, 19}, (19) = {5, 10, 11, 14, 18, 20}, (20) = {5, 11, 12, 14, 19, 21}, (21) = {5, 6, 12, 13, 14, 20}}), `GRAPHLN/table/1006`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 7}, (2) = {1, 3, 4, 5, 6, 13}, (3) = {1, 2, 4, 6, 7, 14}, (4) = {1, 2, 3, 5, 7, 8, 9, 14}, (5) = {1, 2, 4, 6, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19}, (6) = {1, 2, 3, 5, 7, 13, 14, 20}, (7) = {1, 3, 4, 6, 8, 14}, (8) = {4, 5, 7, 9, 14, 15}, (9) = {4, 5, 8, 10, 14, 15, 16, 21}, (10) = {5, 9, 11, 16, 17, 21}, (11) = {5, 10, 12, 17, 18, 21}, (12) = {5, 11, 13, 18, 19, 21}, (13) = {2, 5, 6, 12, 14, 19, 20, 21}, (14) = {3, 4, 6, 7, 8, 9, 13, 15, 20, 21}, (15) = {8, 9, 14, 16, 20, 21}, (16) = {5, 9, 10, 15, 17, 21}, (17) = {5, 10, 11, 16, 18, 21}, (18) = {5, 11, 12, 17, 19, 21}, (19) = {5, 12, 13, 18, 20, 21}, (20) = {6, 13, 14, 15, 19, 21}, (21) = {9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}}), `GRAPHLN/table/1007`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 7}, (2) = {1, 3, 4, 5, 6, 13}, (3) = {1, 2, 4, 6, 7, 15}, (4) = {1, 2, 3, 5, 7, 8, 9, 15}, (5) = {1, 2, 4, 6, 8, 9, 10, 11, 12, 13, 17, 18, 19, 20}, (6) = {1, 2, 3, 5, 7, 13, 14, 15, 20, 21}, (7) = {1, 3, 4, 6, 8, 15}, (8) = {4, 5, 7, 9, 15, 16, 17, 21}, (9) = {4, 5, 8, 10, 16, 17}, (10) = {5, 9, 11, 14, 17, 18}, (11) = {5, 10, 12, 14, 18, 19}, (12) = {5, 11, 13, 14, 19, 20}, (13) = {2, 5, 6, 12, 14, 20}, (14) = {6, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21}, (15) = {3, 4, 6, 7, 8, 14, 16, 21}, (16) = {8, 9, 14, 15, 17, 21}, (17) = {5, 8, 9, 10, 14, 16, 18, 21}, (18) = {5, 10, 11, 14, 17, 19}, (19) = {5, 11, 12, 14, 18, 20}, (20) = {5, 6, 12, 13, 14, 19}, (21) = {6, 8, 14, 15, 16, 17}}), `GRAPHLN/table/1008`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 7, 9, 10}, (2) = {1, 3, 5, 6, 7, 15}, (3) = {1, 2, 4, 7, 8, 9, 16, 17}, (4) = {1, 3, 5, 9, 10, 18}, (5) = {1, 2, 4, 6, 10, 11, 12, 18}, (6) = {1, 2, 5, 7, 11, 12, 13, 14, 15, 19, 20, 21}, (7) = {1, 2, 3, 6, 8, 15, 16, 21}, (8) = {3, 7, 9, 16, 17, 21}, (9) = {1, 3, 4, 8, 10, 11, 17, 18}, (10) = {1, 4, 5, 9, 11, 18}, (11) = {5, 6, 9, 10, 12, 17, 18, 19}, (12) = {5, 6, 11, 13, 17, 19}, (13) = {6, 12, 14, 17, 19, 20}, (14) = {6, 13, 15, 17, 20, 21}, (15) = {2, 6, 7, 14, 16, 21}, (16) = {3, 7, 8, 15, 17, 21}, (17) = {3, 8, 9, 11, 12, 13, 14, 16, 18, 19, 20, 21}, (18) = {4, 5, 9, 10, 11, 17}, (19) = {6, 11, 12, 13, 17, 20}, (20) = {6, 13, 14, 17, 19, 21}, (21) = {6, 7, 8, 14, 15, 16, 17, 20}}), `GRAPHLN/table/1009`, 0), GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], Array(1..21, {(1) = {2, 3, 4, 5, 6, 7, 8, 10, 11, 12}, (2) = {1, 3, 6, 7, 8, 16}, (3) = {1, 2, 4, 8, 9, 10, 16, 17}, (4) = {1, 3, 5, 10, 11, 18}, (5) = {1, 4, 6, 11, 12, 18}, (6) = {1, 2, 5, 7, 12, 13}, (7) = {1, 2, 6, 8, 12, 13, 14, 15, 16, 19, 20, 21}, (8) = {1, 2, 3, 7, 9, 16}, (9) = {3, 8, 10, 16, 17, 21}, (10) = {1, 3, 4, 9, 11, 12, 17, 18}, (11) = {1, 4, 5, 10, 12, 18}, (12) = {1, 5, 6, 7, 10, 11, 13, 17, 18, 19}, (13) = {6, 7, 12, 14, 17, 19}, (14) = {7, 13, 15, 17, 19, 20}, (15) = {7, 14, 16, 17, 20, 21}, (16) = {2, 3, 7, 8, 9, 15, 17, 21}, (17) = {3, 9, 10, 12, 13, 14, 15, 16, 18, 19, 20, 21}, (18) = {4, 5, 10, 11, 12, 17}, (19) = {7, 12, 13, 14, 17, 20}, (20) = {7, 14, 15, 17, 19, 21}, (21) = {7, 9, 15, 16, 17, 20}}), `GRAPHLN/table/1010`, 0)]

 

false

(1)

 

 

 


 

Download VC.mw

  1. You should not upload code to third party sites - particulalrly when that code does not generate the error you specify. In future please upload code directly to this site using the big green up-arrow in the Mapleprimes toolbar
  2. Your basic problem is that 257^(1/2)  is either 16.03121954 (approximately), or -16.0312195 (approximately). One of these values is less than -79999999/10000000 (approximately(-7.999999900), and one of these values is not.
  3. Which of these values do you intend - or are you expecting Maple to guess

If I define the Poincare disk as the unit circle centred at [0,0] and shift both of your points by [1, I] so that their relative placement remains the same, but they are now both "inside" the Poincare disk, then the attached shows the caolculation and the values obtained for z0 and theta

  restart;
  with(plots):
#
# Do all floating point calculations using 20 digits to avoid
# floating point "rounding" problems. Although 20 digts are
# used for calculations, display just 10 digits just to avoid
# the output being too cluttered
#
  Digits:=20:
  interface(displayprecision=10):
  assume(theta, real):
#
# Op was doing everything wrt a Poincare disk centred at [1,1]
# so shift both his/her points of interest by -(1+I) to place
# these in a disk centred at [0,0]
#

  pt1:=0.6034736951 + 0.9595354989*I-(1+I):
  pt2:=1.072181278 + 0.2889812336*I-(1+I):
#
# Plot the points and the disk
#
  complexplot( [pt1, pt2, exp(I*theta)],
               theta=0..2*Pi,
               style=[point, point, line],
               symbol=solidcircle,
               symbolsize=24,
               color=[green, red, blue]
             );
#
# Define the transformation
#
  trans:= z-> exp(theta*I)*(z - z0)/(1 - conjugate(z0)*z):
#
# Solve the transformation for z0 - using abs() effectively
# gets rid of the exp(I*theta) term, since (with theta real)
# this abs(exp(I*theta)) has a magnitude of 1.
#
  z0:= fsolve( abs(trans(pt1))=abs(pt2));
#
# Having obtained z0, coppute the value of theta which sends
# pt1 to pt2. Although theta has been assumed real, fsolve()
# insists on returning a tiny imaginary part whihc gets even
# smaller if the setting of Digits is simcreased, so
#
#     fnormal( expr, 1.0e-09 )
#
# is used to convert any term <1e-09 to 0.0 and then
#
#     simplify( ...., zero)
#
# is used to convert "complex" numbers of the form a+0.0*I
# to a.
#
  theta:= simplify
          ( fnormal
            ( fsolve( trans(pt1)=pt2 ),
              1.0e-09
            )
          );
#
# Having obtained values for z0 and theta, check that
#
# trans(pte)=pt2
#
# Seems to be true!!
#
  trans(pt1);
  pt2;
  

 

.43970952599364798656+0.44871239003267567448e-1*I

 

1.5702724026950090467

 

0.72181278000000000005e-1-.71101876639999999998*I

 

0.72181278e-1-.7110187664*I

(1)

 

Download hypTrans.mw

For your example, the code in the attached finds solutions for a[1]..a[7], subject to the conditions that

  1. a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7] is minimized
  2. all a[i] are integers
  3. all a[i]>=1

Is this what you would consider a "minimum" "positive" "integer" solution ?

  restart;
  sys:= { a[1] = 2*a[5],
          a[1] = a[4],
          4*a[1]+2*a[3] = a[6]+2*a[7],
          2*a[2]+2*a[3] = 2*a[6],
          a[2] = a[4]+a[5],
          2*a[2]-a[1] = 2*a[4]
         }:
  sol:= isolve( sys );
  ans:= Optimization:-LPSolve(add(rhs~(sol)), rhs~(sol)>=~1, assume=integer );
  eval(sol, ans[2]);

{a[1] = 2*_Z1, a[2] = 3*_Z1, a[3] = -5*_Z1+2*_Z2, a[4] = 2*_Z1, a[5] = _Z1, a[6] = -2*_Z1+2*_Z2, a[7] = _Z2}

 

[14, [_Z1 = 1, _Z2 = 3]]

 

{a[1] = 2, a[2] = 3, a[3] = 1, a[4] = 2, a[5] = 1, a[6] = 4, a[7] = 3}

(1)

 

Download opt.mw

This is a conceptual problem.

You state that the indefinite integral of x*(x^2-1)^5 should(?) be (x^2-1)^6/12.

In the latter expression, where did the constant term 1/12 come from?

Expand x*(x^2-1)^5 to get x^11 - 5*x^9 + 10*x^7 - 10*x^5 + 5*x^3 - x. You ought to be able to integrate this mentally term by term. Which of these (indefinite)  integrations gives rise to the constant term 1/12

First 35 36 37 38 39 40 41 Last Page 37 of 207