acer

32373 Reputation

29 Badges

19 years, 334 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

The following might get you started, at least for steps 1-3.

Step 4 does not seem to allow for the fact that the names R__ct,R__s,R__w,C__dl, and omega can be expressed in terms of the a[i] and b[i] in more than one way. Below is a solution (with a check on it), but it may not be the same choice of representation by a[i] and b[i] that you want(?).

restart

with(numapprox)

Y := 1/(R__s+1/(s*C__dl+1/(R__ct+1/(sqrt(s)/sigma+1/R__w))))

1/(R__s+1/(s*C__dl+1/(R__ct+1/(s^(1/2)/sigma+1/R__w))))

padey := pade(Y, x = sqrt(s), [1, 1])

(C__dl*s^(3/2)*R__ct*R__w+C__dl*R__ct*s*sigma+C__dl*R__w*s*sigma+s^(1/2)*R__w+sigma)/(C__dl*s^(3/2)*R__ct*R__s*R__w+C__dl*R__ct*R__s*s*sigma+C__dl*R__s*R__w*s*sigma+s^(1/2)*R__ct*R__w+s^(1/2)*R__s*R__w+R__ct*sigma+R__s*sigma+sigma*R__w)

The padey2 term isn't really needed. I include it to match the given document.

padey2 := sort(collect(padey, s, factor), order = plex(s), ascending)

(sigma+R__w*s^(1/2)+C__dl*sigma*(R__ct+R__w)*s+C__dl*R__ct*R__w*s^(3/2))/(sigma*(R__ct+R__s+R__w)+R__w*(R__ct+R__s)*s^(1/2)+C__dl*R__s*sigma*(R__ct+R__w)*s+C__dl*R__ct*R__s*R__w*s^(3/2))

padey3 := sort(collect(padey, s, proc (u) options operator, arrow; simplify(u/(sigma*(R__ct+R__s+R__w))) end proc), order = plex(C__dl, s), ascending)

(1/(R__ct+R__s+R__w)+R__w*s^(1/2)/(sigma*(R__ct+R__s+R__w))+(R__ct+R__w)*C__dl*s/(R__ct+R__s+R__w)+R__ct*R__w*C__dl*s^(3/2)/(sigma*(R__ct+R__s+R__w)))/(1+R__w*(R__ct+R__s)*s^(1/2)/(sigma*(R__ct+R__s+R__w))+R__s*(R__ct+R__w)*C__dl*s/(R__ct+R__s+R__w)+R__ct*R__s*R__w*C__dl*s^(3/2)/(sigma*(R__ct+R__s+R__w)))

N, M := op(padey3)

One way to get the equations from padey3:
eqs := {seq(a[i-1] = eval(op(i, N), s = 1), i = 1 .. nops(N)), seq(b[i-1] = eval(op(i, 1/M), s = 1), i = 1 .. nops(1/M))}

{a[0] = 1/(R__ct+R__s+R__w), a[1] = R__w/(sigma*(R__ct+R__s+R__w)), a[2] = (R__ct+R__w)*C__dl/(R__ct+R__s+R__w), a[3] = R__ct*R__w*C__dl/(sigma*(R__ct+R__s+R__w)), b[0] = 1, b[1] = R__w*(R__ct+R__s)/(sigma*(R__ct+R__s+R__w)), b[2] = R__s*(R__ct+R__w)*C__dl/(R__ct+R__s+R__w), b[3] = R__ct*R__s*R__w*C__dl/(sigma*(R__ct+R__s+R__w))}

Another way to get the equations from padey3:
temp1 := `assuming`([map(evala, eval(N, s = s^2))], [s > 0]); temp2 := `assuming`([map(evala, eval(1/M, s = s^2))], [s > 0]); eqs := {seq(a[i] = coeff(temp1, s, i), i = 0 .. 3), seq(b[i] = coeff(temp2, s, i), i = 0 .. 3)}

{a[0] = 1/(R__ct+R__s+R__w), a[1] = R__w/(sigma*(R__ct+R__s+R__w)), a[2] = (R__ct+R__w)*C__dl/(R__ct+R__s+R__w), a[3] = R__ct*R__w*C__dl/(sigma*(R__ct+R__s+R__w)), b[0] = 1, b[1] = R__w*(R__ct+R__s)/(sigma*(R__ct+R__s+R__w)), b[2] = R__s*(R__ct+R__w)*C__dl/(R__ct+R__s+R__w), b[3] = R__ct*R__s*R__w*C__dl/(sigma*(R__ct+R__s+R__w))}

U := simplify(eliminate(eqs, [R__s, C__dl, R__ct, sigma, R__w, a[3], b[3]]))

ans := Equate([R__s, C__dl, R__ct, sigma, R__w], eval([R__s, C__dl, R__ct, sigma, R__w], U[1]))

[R__s = b[2]/a[2], C__dl = -a[2]^2/(a[0]*b[2]-a[2]), R__ct = (-a[1]*b[2]+a[2]*b[1])/(a[2]*a[1]), sigma = (-a[0]*b[1]+a[1])/a[1]^2, R__w = (-a[0]*b[1]+a[1])/(a[1]*a[0])]

W := Equate(simplify(eval([a[3], b[3]], U[1])), [a[3], b[3]])

[a[2]*(a[1]*b[2]-a[2]*b[1])/(a[0]*b[2]-a[2]) = a[3], b[2]*(a[1]*b[2]-a[2]*b[1])/(a[0]*b[2]-a[2]) = b[3]]

Z := sort(collect(simplify(eval(N, ans), W), s), order = plex(s), ascending)/sort(collect(simplify(eval(1/M, ans), W), s), order = plex(s), ascending)

(a[0]+a[1]*s^(1/2)+a[2]*s+a[3]*s^(3/2))/(1+b[1]*s^(1/2)+b[2]*s+b[3]*s^(3/2))

Download maple_attempt_ac.mw

The six periodic values have two sets of three, negations of each other.

The two sets of three can be alternately obtained by setting the parameter in the solve(...,allsolutions) result to either an odd or even integer.

Below I set that parameter (eg. _Z1) to 1, though I also have merged both sets of three from using both 1 and 0.

We can sort the roots of the derivative by the values that would attain by substitution into the original expression. This allows us to pick off a value of t which attains the maximal value.

There doesn't seem to be any simplification benefit to conversion to exp&ln, with a larger form as well as the presence of I the imaginary unit.

The optimal symbolic values below for both t and the expression seem reasonably compact.

restart;

expr:=sin(sqrt(3)*t)*cos(sqrt(3)*t)*(sqrt(3)*cos(sqrt(3)*t) - sin(sqrt(3)*t))/3;

(1/3)*sin(3^(1/2)*t)*cos(3^(1/2)*t)*(3^(1/2)*cos(3^(1/2)*t)-sin(3^(1/2)*t))

S:=[solve(diff(expr,t),t,allsolutions)]:
v:=indets(S,suffixed(_Z))[1];

_Z1

plots:-display(
  plots:-pointplot([seq(Re~(evalf([s,eval(expr,[t=s])])),s=simplify(S,{v=1}))],
                   symbol=solidcircle,symbolsize=15,color=blue),
  plot(expr,t=-2*Pi..2*Pi), size=[600,300])

H:=simplify(evalc(simplify(S,{v=1}))):

HH := sort(H, (a,b)->is(eval(expr,t=a)>eval(expr,t=b))):

t_opt := HH[1];

-(1/3)*3^(1/2)*(arctan(2^(1/2)*cos((1/3)*arctan((1/19)*503^(1/2)))+3^(1/2)*2^(1/2)*sin((1/3)*arctan((1/19)*503^(1/2)))-(2/3)*3^(1/2))-Pi)

evalf( eval(expr, t=t_opt) );

.3242632442

expr_opt := combine(expand(eval(expr, t=t_opt)));

-(1/9)*(-6*3^(1/2)*sin((2/3)*arctan((1/19)*503^(1/2)))+3*2^(1/2)*sin((1/3)*arctan((1/19)*503^(1/2)))+cos((1/3)*arctan((1/19)*503^(1/2)))*6^(1/2)+6*cos((2/3)*arctan((1/19)*503^(1/2)))-10)/(-(4/3)*cos((1/3)*arctan((1/19)*503^(1/2)))*6^(1/2)+2*3^(1/2)*sin((2/3)*arctan((1/19)*503^(1/2)))-4*2^(1/2)*sin((1/3)*arctan((1/19)*503^(1/2)))-2*cos((2/3)*arctan((1/19)*503^(1/2)))+19/3)^(3/2)

 

Download some_trig_opt.mw

The following sorts, in ascending order of exponents, by the indexed `Δy` names taken in descending order of index.

I used `collect` to first factor the coefficients of those names.

The result seems to match what you gave as target form.

(I used Maple 2015.)

restart;

expr := ((1/2)*r*(r-1)+(1/6)*r*(r-1)*(r-2))*`Δy`[-1]^3+(1/2)*r*(r-1)*`Δy`[-1]^2+(1/120)*r*(r-1)*(r-2)*(r-3)*(r-4)*`Δy`[-2]^7+((1/6)*r*(r-1)*(r-2)+(1/12)*r*(r-1)*(r-2)*(r-3)+(1/120)*r*(r-1)*(r-2)*(r-3)*(r-4))*`Δy`[-2]^5+((1/6)*r*(r-1)*(r-2)+(1/24)*r*(r-1)*(r-2)*(r-3))*`Δy`[-2]^4+((1/24)*r*(r-1)*(r-2)*(r-3)+(1/60)*r*(r-1)*(r-2)*(r-3)*(r-4))*`Δy`[-3]^7+((1/24)*r*(r-1)*(r-2)*(r-3)+(1/60)*r*(r-1)*(r-2)*(r-3)*(r-4))*`Δy`[-3]^6+r*`Δy`[0]+y[0];

((1/2)*r*(r-1)+(1/6)*r*(r-1)*(r-2))*`Δy`[-1]^3+(1/2)*r*(r-1)*`Δy`[-1]^2+(1/120)*r*(r-1)*(r-2)*(r-3)*(r-4)*`Δy`[-2]^7+((1/6)*r*(r-1)*(r-2)+(1/12)*r*(r-1)*(r-2)*(r-3)+(1/120)*r*(r-1)*(r-2)*(r-3)*(r-4))*`Δy`[-2]^5+((1/6)*r*(r-1)*(r-2)+(1/24)*r*(r-1)*(r-2)*(r-3))*`Δy`[-2]^4+((1/24)*r*(r-1)*(r-2)*(r-3)+(1/60)*r*(r-1)*(r-2)*(r-3)*(r-4))*`Δy`[-3]^7+((1/24)*r*(r-1)*(r-2)*(r-3)+(1/60)*r*(r-1)*(r-2)*(r-3)*(r-4))*`Δy`[-3]^6+r*`Δy`[0]+y[0]

S:=sort([indets(expr,specindex(`&Delta;y`))[]], (a,b)->op(1,a)<=op(1,b)):

sort(collect(expr,S,factor),
     order=plex(S[]), ascending);

y[0]+r*`&Delta;y`[0]+(1/2)*r*(r-1)*`&Delta;y`[-1]^2+(1/6)*r*(r-1)*(r+1)*`&Delta;y`[-1]^3+(1/24)*r*(r-1)*(r-2)*(r+1)*`&Delta;y`[-2]^4+(1/120)*r*(r-1)*(r-2)*(r+2)*(r+1)*`&Delta;y`[-2]^5+(1/120)*r*(r-1)*(r-2)*(r-3)*(r-4)*`&Delta;y`[-2]^7+(1/120)*r*(r-1)*(r-2)*(r-3)*(-3+2*r)*`&Delta;y`[-3]^6+(1/120)*r*(r-1)*(r-2)*(r-3)*(-3+2*r)*`&Delta;y`[-3]^7

Download sort_collect.mw

You could send an email to Maplesoft's Technical Support team, at,
     support@maplesoft.com

They'll want to know your Operating System and Maple version number.

Or you could fill out this form.

I'd suggest that using 1D (plaintext) Maple Notation would be one good alternative. If you do that then you can use the arrow notation in the input, to enter the operator, while also using the local declaration.

If you really need to use 2D Input then you could enter it using proc()...end, and optionally throw the procedure options arrow,operator on and get it nicely pretty-printed as output.

This illustrates the warning messages for these expressions.

Omega := proc (a::list) options operator, arrow; (-1)^add(a[i]-1, i = 1 .. nops(a)) end proc; `&Omega;__rev` := proc (a::list) options operator, arrow; (-1)^add(a[i]-i, i = 1 .. nops(a)) end proc

Warning, (in Omega) `i` is implicitly declared local

Warning, (in Omega__rev) `i` is implicitly declared local

proc (a::list) local i; options operator, arrow; (-1)^add(a[i]-1, i = 1 .. nops(a)) end proc

proc (a::list) local i; options operator, arrow; (-1)^add(a[i]-i, i = 1 .. nops(a)) end proc

Omega := proc (a::list) local i; (-1)^add(a[i]-1, i = 1 .. nops(a)) end proc

proc (a::list) local i; (-1)^add(a[i]-1, i = 1 .. nops(a)) end proc

Omega := proc (a::list) local i; options arrow, operator; (-1)^add(a[i]-1, i = 1 .. nops(a)) end proc

proc (a::list) local i; options operator, arrow; (-1)^add(a[i]-1, i = 1 .. nops(a)) end proc

Download warningmessage_ac.mw

As you noticed, the local declation is not yet fully supported for the arrow notation in 2D Input.

The name x is a parameter of your procedure IPM.

But there is a statement in IPM which attempts to perform,
   x := x/ix;
which is an assignment that is not allowed when x has been passed in with a value (here, a Vector).

You could change the name of the procedural parameter to, say xin, and have the procedure assign xin to a new local named x at its beginning. The rest of IPM would then be able to assign to that local x or use its running value.

IOMMcode_ac.mw

I will submit a bug report against the original result you obtained from int, which throws an error even under a call to normal.

However, forcing a particular method, in Maple 2022.2,

restart;

f:=1/(3*u^(2/3)+3*((-4*u^(1/3)+1)*u^(4/3))^(1/2)-12*u);

1/(3*u^(2/3)+3*((-4*u^(1/3)+1)*u^(4/3))^(1/2)-12*u)

anti := int(f,u,method=derivativedivides)

(1/4)*ln((4*u-u^(2/3)+(-(4*u^(1/3)-1)*u^(4/3))^(1/2))/(u^(2/3)*(-4*u^(1/3)+1)^(1/2)))-(1/4)*ln((-4*u+u^(2/3)+(-(4*u^(1/3)-1)*u^(4/3))^(1/2))/(u^(2/3)*(-4*u^(1/3)+1)^(1/2)))-(1/4)*ln(4*u^(1/3))

MmaTranslator:-Mma:-LeafCount(anti);

85

simplify( f - diff(anti,u) );

0

Download indef_int_ex05.mw

Did you call fclose or fflush (or restart)?

If not, then buffered results may not yet be flushed to the file.

Another possibility is that currentdir() is not what you expecting. That's a Maple command.

You could use,

    1+ilog2(n)

Eg,

    1+ilog2(22);

              5

For base 3 you might use the following,

   nops(convert(n,base,3));

and you might be able to use the following for positive integers,

   1+trunc(log[3](Float(n,0)))

Test, to make sure I haven't made mistakes.

For some reason the Sliders don't appear when the worksheet is inlined in this discussion forum. But they're there in the .mw file. You need to execute the definition of F, for it to work.

You should easily be able to add a textplot at the end-point of the 4th arrow.

restart;

with(plots):

F := proc(a,b,c)
  local w:=5, arropts := (':-width'=w,':-head_length'=20);
  uses plots, ColorTools;
  display(arrow(<0,0,0>,<255.0,0.0,0.0>,':-color'="red",arropts),
          arrow(<0,0,0>,<0.0,255.0,0.0>,':-color'="green",arropts),
          arrow(<0,0,0>,<0.0,0.0,255.0>,':-color'="blue",arropts),
          arrow(<0,0,0>,<a,b,c>,':-color'=Color([a,b,c]),arropts),
          ':-view'=[-5..255+w,-10..255+w,-w..255+w],':-axes=none',
          map(L->plottools:-line(L[],':-color'="808080",':-thickness'=3,
                                 ':-linestyle'=':-dot'),
              [[[0,255,255],[0,0,255]],[[0,255,255],[0,255,0]],
               [[255,255,0],[255,0,0]],[[255,255,0],[0,255,0]],
               [[255,0,255],[0,0,255]],[[255,0,255],[255,0,0]],
               [[255,255,255],[255,0,255]],[[255,255,255],[255,255,0]],
               [[255,255,255],[0,255,255]]]),
          ':-orientation'=[-70,75,0], ':-size'=[700,700]);
end proc:

Explore(F(red,green,blue),
        ':-parameters'=[[red=0..255],
                    [green=0..255],
                    [blue=0..255]],
        ':-initialvalues'=[red=217,green=43,blue=143],
        ':-placement'=':-left', width=700);

 

 

 

 

red

 

 

 

 

green

 

 

 

 

blue

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Download expl_rgb.mw

And here is a version that creates it in a new Tab in the GUI (new worksheet). This should subsequently run-standalone, as the definition of procedure F gets put into the Startup Region of that sheet.

Download expl_rgb_mkalone.mw

You might call Optimization:-Maximize on a range restricted to close to a peak. This can be performed on a simplification of abs(q) that is real-valued with less imaginary roundoff noise (artefact).

For example, using Maple 18.02,

restart

kernelopts(version);

`Maple 18.02, X86 64 LINUX, Oct 20 2014, Build ID 991181`

with(plots):

q := -(-518445+187776*x^4+4096*x^6-48932352*t^2+30670848*t^6-3939840*x^2-13559808*t^4-84934656*t^8-2048*sqrt(2)*x^7+14352384*t^4*x^2+3801088*t^3*x^3+638976*t^2*x^4+49152*t*x^5-14024704*t^4*x^4-589824*t^2*x^6-65536*t*x^7+29097984*t^5*x-113246208*t^7*x-40894464*t^5*x^3-84934656*t^6*x^2-15759360*t*x-3407872*t^3*x^5-85843968*sqrt(2)*t^5-2047860*sqrt(2)*x+4126464*sqrt(2)*t^3+(294912*I)*t^5+(8702976*I)*t^3-(1440*I)*t-4095720*sqrt(2)*t-1064960*sqrt(2)*t^3*x^4-7667712*sqrt(2)*t^5*x^2-221184*sqrt(2)*t^2*x^5-10616832*sqrt(2)*t^6*x-3506176*sqrt(2)*t^4*x^3-28672*sqrt(2)*t*x^6+4700160*sqrt(2)*t^2*x^3+(84934656*I)*t^6*x-(245760*I)*t^2*x^3+3917952*sqrt(2)*t^2*x-1658880*sqrt(2)*t^3*x^2-53096448*sqrt(2)*t^4*x+1391040*sqrt(2)*t*x^2+1866240*sqrt(2)*t*x^4-(835584*I)*t^3*x^2-(1376256*I)*t^4*x+(53035008*I)*sqrt(2)*t^4+(49152*I)*t*x^6+(589824*I)*t^2*x^5+(17301504*I)*t^4*x^3+(4128768*I)*t^3*x^4+(7077888*I)*sqrt(2)*t^6+(541440*I)*sqrt(2)*t^2+(49545216*I)*t^5*x^2+(2193408*I)*sqrt(2)*t*x^3+(44064768*I)*sqrt(2)*t^3*x+(13160448*I)*sqrt(2)*t^2*x^2+(4325376*I)*sqrt(2)*t^4*x^2+(1376256*I)*sqrt(2)*t^3*x^3+(270720*I)*sqrt(2)*t*x+(8257536*I)*sqrt(2)*t^5*x+1502208*t*x^3+211968*t^2*x^2-11169792*t^3*x+186624*sqrt(2)*x^5+231840*sqrt(2)*x^3-7077888*sqrt(2)*t^7-4096*x^8)*exp(I*(3*t-x))/(-518409+91968*x^4-512*x^6-145440*t^2-884736*t^6-34776*x^2-7449600*t^4-1024*sqrt(2)*x^7-516096*t^4*x^2-180224*t^3*x^3-43008*t^2*x^4-6144*t*x^5-884736*t^5*x-139104*t*x-307200*sqrt(2)*t^5-1045458*sqrt(2)*x-950400*sqrt(2)*t^3-2090916*sqrt(2)*t+(7077888*I)*t^7-(1105920*I)*sqrt(2)*t^2*x^2-(184320*I)*sqrt(2)*t*x^3+(69120*I)*sqrt(2)*t*x+(1728*I)*t*x^2+(12288*I)*t^2*x^3+(6912*I)*t^2*x-(245760*I)*t^4*x-(36864*I)*t^3*x^2+(7372800*I)*sqrt(2)*t^4+(1536*I)*t*x^4+(49152*I)*t^2*x^5+(4096*I)*t*x^6+(344064*I)*t^3*x^4+(4128768*I)*t^5*x^2+(1441792*I)*t^4*x^3+(7077888*I)*t^6*x+(138240*I)*sqrt(2)*t^2+(614400*I)*t^5+(57600*I)*t^3+(4147272*I)*t-532480*sqrt(2)*t^3*x^4-3833856*sqrt(2)*t^5*x^2-110592*sqrt(2)*t^2*x^5-5308416*sqrt(2)*t^6*x-1753088*sqrt(2)*t^4*x^3-14336*sqrt(2)*t*x^6+3072*sqrt(2)*t^2*x^3-294336*sqrt(2)*t^2*x+79872*sqrt(2)*t^3*x^2-30720*sqrt(2)*t^4*x+135648*sqrt(2)*t*x^2-3840*sqrt(2)*t*x^4+(2211840*I)*sqrt(2)*t^3*x+735744*t*x^3+4608*t^2*x^2-5867520*t^3*x-384*sqrt(2)*x^5+22608*sqrt(2)*x^3-3538944*sqrt(2)*t^7):

new := `assuming`([simplify(abs(q), size)], [x > -5, x < 5, t > -5, t < 5]):

plot3d(new, x = -5 .. 5, t = -5 .. 5, numpoints = 5000, axes = frame, style = surface, labels = ['x', 't', ""], labelfont = [TIMES, ITALIC, 16], axesfont = [TIMES, ROMAN, 14], shading = ZHUE, orientation = [50, 55, 0]);

sol1 := Optimization:-Maximize(new, t = -.5 .. 1.5, x = -5 .. -2);

[178.124646707148315, [t = HFloat(0.9557075158427223), x = HFloat(-3.5487225916120098)]]

[125.493296995342149, [t = HFloat(-0.9563856851285822), x = HFloat(0.2895352694643224)]]

[29.4557218848098721, [t = HFloat(1.7054438218049695e-8), x = HFloat(3.1825552777668866)]]

plots:-display(plot3d(new, x = -5 .. 5, t = -1.5 .. 1.5, grid = [201, 201], axes = frame, style = surface, labels = ['x', 't', ""], labelfont = [TIMES, ITALIC, 16], axesfont = [TIMES, ROMAN, 14], shading = ZHUE), plots:-pointplot3d([eval([x, t, new], sol1[2]), eval([x, t, new], sol2[2]), eval([x, t, new], sol3[2])], symbolsize = 10, symbol = solidcircle, color = black), orientation = [50, 55, 0]);

 

Download p3dopt.mw

Here is one way, using Maple 17.

In modern Maple there are more ways to get similar effects.

I could have used just plots:-surfdata to get the surface. But coloring that flexibly would be more complicated. And there are a few irritations with using plots:-listdensityplot here.

So instead I construct an interpolating procedure F, which I use for the various pieces.

restart;

kernelopts(version);

`Maple 17.02, X86 64 LINUX, Sep 5 2013, Build ID 872941`

(1)

with(plots): with(plottools):

x:=[0.1, 0.2, 0.3, 0.4, 0.5, 0.1, 0.2, 0.3, 0.4, 0.5,
    0.1, 0.2, 0.3, 0.4, 0.5,0.1, 0.2, 0.3, 0.4, 0.5,
    0.1, 0.2, 0.3, 0.4, 0.5]:

y:=[0.1, 0.1, 0.1, 0.1, 0.1, 0.2, 0.2, 0.2, 0.2, 0.2,
    0.3, 0.3, 0.3, 0.3, 0.3, 0.4, 0.4, 0.4, 0.4, 0.4,
    0.5,0.5,0.5,0.5,0.5]:

z:=[1.971284960, 1.642401616, 1.372353338,1.153620572,0.9762759982,

    1.675502483, 1.411976881, 1.190627373,1.007730234,0.8570007139,

    1.397140245, 1.184230644, 1.003688984,0.852696223,0.7268039317,

    1.144791107, 0.9725020383,0.8257592921,0.7020549659,0.5979974836,                                                        0.9208492326, 0.7816302394, 0.6627749172,0.5620029444,0.4766238930]:

M := Matrix(5,5,z)^%T:

xydat := [<[0.1,0.2,0.3,0.4,0.5]>,<[0.1,0.2,0.3,0.4,0.5]>]:

F := proc(a,b) option remember;
   if not [a,b]::list(numeric) then return 'procname'(args); end if;
   CurveFitting:-ArrayInterpolation(xydat, M,
                                    Array(1..1, 1..1, 1..2,
                                          [[[a,b]]]))[1,1];
end proc:

P3 := plot3d(F(a,b), a=0.1 .. 0.5, b=0.1 .. 0.5,
             color=[F(a,b)/(2-0.5)-0.333, F(a,b)/(2-0.5)-0.333, 1]):

P4 := contourplot(F(a,b), a=0.1 .. 0.5, b=0.1 .. 0.5,
                  color="DarkGreen",contours=5):

display(P3,
        transform((a,b,c)->[a,b,1e-2])(P4),
        plot3d(0, a=0.1 .. 0.5, b=0.1 .. 0.5,
               color="yellow",style=surface),
        labels=["x","y","z"], orientation=[30,75,0]);

 

 

 

Download MAXR_surfcontdat.mw

The index option is not available to the max command in Maple 17. You could see that by reading its Help page in your version.

As a simple (but less efficient) alternative, you could try using,

    ind[k] := ListTools:-Search(max(abs(Y[k])), Y[k]);

instead of your,

   ind[k] := max[index](abs(Y[k]));

Note that there are other problems with the code. You assign to lowercase tol but then try and compare something against all-caps TOL. which has no assigned numeric value. The code tries to use yp, but that is unassigned. And so on.

Here is one way.

The Table looks nicer in actual Maple.

You could suppress the display of the Matrix (ending the line containing the statement that creates it with a full colon), if you're also going to Tabulate it.

The plot was just for fun. (You could also make a dual-axis plot with, say, height on the left vertical axis and velocity on the right vertical axis.) The plot could also be animated.

restart;
with(DocumentTools):

h := -4.9*t^2 + 50*t + 960;

-4.9*t^2+50*t+960

v := diff(h, t);

-9.8*t+50

a := diff(v, t);

-9.8

T := Vector([seq(t, t=0..21, 4.0)]):

H := map(tt->eval(h,t=tt), T):

V := map(tt->eval(v,t=tt), T):

A := map(tt->eval(a,t=tt), T):

data := <<"time"|"height"|"velocity"|"acceleration">,
        <T|H|V|A>>;

Matrix(7, 4, {(1, 1) = "time", (1, 2) = "height", (1, 3) = "velocity", (1, 4) = "acceleration", (2, 1) = 0, (2, 2) = 960., (2, 3) = 50., (2, 4) = -9.8, (3, 1) = 4.0, (3, 2) = 1081.600, (3, 3) = 10.80, (3, 4) = -9.8, (4, 1) = 8.0, (4, 2) = 1046.400, (4, 3) = -28.40, (4, 4) = -9.8, (5, 1) = 12.0, (5, 2) = 854.400, (5, 3) = -67.60, (5, 4) = -9.8, (6, 1) = 16.0, (6, 2) = 505.600, (6, 3) = -106.80, (6, 4) = -9.8, (7, 1) = 20.0, (7, 2) = 0., (7, 3) = -146.00, (7, 4) = -9.8})

Tabulate(data, widthmode=pixels, width=500,
         fillcolor=((val,i,j)->`if`(i=1,"Tan","White"))):

 

time

height

velocity

acceleration

0

960.

50.

-9.8

4.0

1081.600

10.80

-9.8

8.0

1046.400

-28.40

-9.8

12.0

854.400

-67.60

-9.8

16.0

505.600

-106.80

-9.8

20.0

0.

-146.00

-9.8

 

 

plots:-display( plot(h, t=0..20, size=[500,200]),
                plot(<T|H>, style=point, color=blue,
                     symbol=solidcircle, symbolsize=15) );

 

thva.mw

You can store multiple procedures (as well as modules that export procedures) in a special kind of file called a Maple Library Archive. Such a file has .mla as its filename extension.

I suggest that you start by reading the Help pages for the LibraryTools package's documentation.

You could start by calling LibraryTools:-Create to make a .mla file.

Then you could call LibraryTools:-Save to store your various procedures within it. I strongly suggest always using the calling sequence in which you supply the location of the file explicitly (ie. without using savelibname).

Once you have stored a procedure within the personal .mla file you can use it from any other worksheet/document/session as long a its location is one of the items in the path assigned to libname.

For example, suppose that you'd stored procedure MyProc inside a .mla file at location,
    C:/Users/Acer/mystuff/MyArchive.mla
In that case you could augment libname with the Maple command,
   libname := C:/Users/Acer/mystuff/MyArchive.mla, libname;
One way to make that libname adjustment automatic is to put that command inside a personal initialization file.

An alternate way to make that libname adjustment happen automatically upon launch/restart is to use a special kind of location. For example, if my MS-Windows username were "Acer" then the following is such a special location,
   C:/Users/Acer/maple/MyPackage/lib/MyPackage.mla
where "MyPackage" could be some name of my choosing. I'd use this when calling the LibraryTools commands mentioned. Then my stored procedures could be used immediately and directly in any new Maple session.

You might also consider encapsulating a collection of related procedures inside a package, which is a special kind of module. You can read some documentation on this in Chapter 11 of the Programming Guide. That chapter also has a subsection on using LibraryTools, like I described above.

The URLs I give are links to the on-line version of the documentation, usually corresponding to the current version of Maple. You can also access these Help pages -- offline and specific to your version -- from within Maple itself.

First 58 59 60 61 62 63 64 Last Page 60 of 336