acer

32333 Reputation

29 Badges

19 years, 322 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

It should probably emit an error if method=_MonteCarlo is forced and epsilon is supplied smaller than the method supports. And perhaps it should emit a Warning and bump up the tolerance if that method alone is supplied.

But I don't understand your initial statement, "...all the others seem to fail". Your example works even if no method or options are supplied.

Do you understand that forcing method=_CubaVegas may also fail at default options but succeed at others? It works for me using epsilon=1e-4. See the Help pages for additional details on suboptions, ie, ?evalf,int,cuba

restart:

interface(version)

`Standard Worksheet Interface, Maple 2015.2, Linux, December 21 2015 Build ID 1097895`

int(cos(x*y), [x=-1..3, y=-1..-1/5]);
evalf[15](%);

Si(3)+Si(1)-Si(3/5)-Si(1/5)

2.00705070023234

CodeTools:-Usage( evalf(Int(cos(x*y), [x=-1..3, y=-1..-0.2])) );

memory used=158.95KiB, alloc change=32.00MiB, cpu time=15.00ms, real time=16.00ms, gc time=0ns

2.007050700

CodeTools:-Usage( evalf[10](Int(cos(x*y), [x=-1..3, y=-1..-0.2], method=_Gquad)) );

memory used=0.84MiB, alloc change=0 bytes, cpu time=10.00ms, real time=13.00ms, gc time=0ns

2.007050700

CodeTools:-Usage( evalf[10](Int(cos(x*y), [x=-1..3, y=-1..-0.2], method=_CubaVegas)) );

memory used=43.17KiB, alloc change=0 bytes, cpu time=12.28s, real time=12.28s, gc time=0ns

Int(Int(cos(x*y), x = -1. .. 3.), y = -1. .. -.2)

CodeTools:-Usage( evalf(Int(cos(x*y), [x=-1..3, y=-1..-0.2], method=_MonteCarlo, epsilon=5e-5)) );

memory used=30.62KiB, alloc change=0 bytes, cpu time=2.00ms, real time=2.00ms, gc time=0ns

2.007013766

infolevel[`evalf/int`]:=2:
forget(`evalf/int`);
CodeTools:-Usage( evalf(Int(cos(x*y), [x=-1..3, y=-1..-0.2], method=_MonteCarlo, epsilon=1e-5)) );
infolevel[`evalf/int`]:=0;

Control_multi: integrating on [-1, -1] .. [3, -.2] the integrand

cos(x*y)

evalf/int: error from Control_multi was:
"NAG d01gbc expects epsilon >= 0.5e-4, but received %1", .1e-4
memory used=212.05KiB, alloc change=0 bytes, cpu time=2.00ms, real time=7.00ms, gc time=0ns

Int(Int(cos(x*y), x = -1. .. 3.), y = -1. .. -.2)

0

 

Download evalf_Int_ac.mw

 

restart;

kernelopts(version);

`Maple 2017.2, X86 64 LINUX, Jul 19 2017, Build ID 1247392`

# current value
kernelopts(stacklimit);

8160

# output the previous value
kernelopts(stacklimit=2^15);

8160

# current value
kernelopts(stacklimit);

32768

 

Download stacklimit.mw

L := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:

[seq(L[2*i-1]..L[2*i],i=1..nops(L)/2)];

        [1 .. 2, 3 .. 4, 5 .. 6, 7 .. 8, 9 .. 10]

I don't see how your question makes it clear whether you want the braces or their contents to be colored. So I have to guess. I guess it's the contents. (If it's the brackets -- or both -- then I don't see that you've sensibly described how to color it.)

It's not clear exactly how you want the colors "tweaked" with each iteration. But you might adjust this to taste:

restart;

F := proc(n, c::list:=[0,0,0])
    local i,k:
    uses Typesetting, ColorTools;
    if n <= 0 then return mn("1",
                             ':-mathcolor'=RGB24ToHex(RGBToRGB24(c)),
                             ':-size'="16",
                             ':-fontweight'="bold");
    end if:
    F(n-2, (c+(n)*[1,0,0])/(n+1)) %+ F(n-1, (c+(n)*[0,1,0])/(n+1)):
end proc:

F(1);

Parse:-ConvertTo1D, "invalid input %1", `%+`(Typesetting:-mn("1", mathcolor = "#800000", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#008000", size = "16", fontweight = "bold"))

F(2);

Parse:-ConvertTo1D, "invalid input %1", `%+`(Typesetting:-mn("1", mathcolor = "#AA0000", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#805500", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#00D500", size = "16", fontweight = "bold")))

F(3);

Parse:-ConvertTo1D, "invalid input %1", `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#DF0000", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#608000", size = "16", fontweight = "bold")), `%+`(Typesetting:-mn("1", mathcolor = "#AA4000", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#807500", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#00F400", size = "16", fontweight = "bold"))))

F(4);

Parse:-ConvertTo1D, "invalid input %1", `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#EE0000", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#A25500", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#22D500", size = "16", fontweight = "bold"))), `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#DF1A00", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#609900", size = "16", fontweight = "bold")), `%+`(Typesetting:-mn("1", mathcolor = "#AA5100", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#807D00", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#00FD00", size = "16", fontweight = "bold")))))

F(5);

Parse:-ConvertTo1D, "invalid input %1", `%+`(`%+`(`%+`(Typesetting:-mn("1", mathcolor = "#FA0000", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#7A8000", size = "16", fontweight = "bold")), `%+`(Typesetting:-mn("1", mathcolor = "#BC4000", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#887500", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#09F400", size = "16", fontweight = "bold")))), `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#EE0E00", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#A25C00", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#22DC00", size = "16", fontweight = "bold"))), `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#DF1F00", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#609E00", size = "16", fontweight = "bold")), `%+`(Typesetting:-mn("1", mathcolor = "#AA5400", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#807F00", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#00FF00", size = "16", fontweight = "bold"))))))

F(6);

Parse:-ConvertTo1D, "invalid input %1", `%+`(`%+`(`%+`(Typesetting:-mn("1", mathcolor = "#FD0000", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#A95500", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#29D500", size = "16", fontweight = "bold"))), `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#E51A00", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#659900", size = "16", fontweight = "bold")), `%+`(Typesetting:-mn("1", mathcolor = "#AE5100", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#817D00", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#02FD00", size = "16", fontweight = "bold"))))), `%+`(`%+`(`%+`(Typesetting:-mn("1", mathcolor = "#FA0500", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#7A8400", size = "16", fontweight = "bold")), `%+`(Typesetting:-mn("1", mathcolor = "#BC4300", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#887600", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#09F600", size = "16", fontweight = "bold")))), `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#EE1100", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#A25D00", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#22DD00", size = "16", fontweight = "bold"))), `%+`(`%+`(Typesetting:-mn("1", mathcolor = "#DF2000", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#609F00", size = "16", fontweight = "bold")), `%+`(Typesetting:-mn("1", mathcolor = "#AA5500", size = "16", fontweight = "bold"), `%+`(Typesetting:-mn("1", mathcolor = "#807F00", size = "16", fontweight = "bold"), Typesetting:-mn("1", mathcolor = "#00FF00", size = "16", fontweight = "bold")))))))

 

This is somewhat fragile, depending on what you typeset and how.

 

value(subsindets(F(6),specfunc(Typesetting:-mn),
      u->op(2..,Typesetting:-Parse(u))));

21

 

Download color_recur.mw

[edit] Transitioning from color to color can be a subtle business. You might prefer the "Lab" colorspace rather than "RGB" since the former grades perceptually evenly (RGB runs evenly in terms of the monitor output, not perceptually). Two colors whose midpoint isn't some gray near the white point may also be nicer. Just let me know.

Also, the braces can be colored, but if that's desired then I'm not understanding the target details.

You can use the command evalf to compute that single floating-point arctrig call.

evalf[15](arccos(0.62))

             0.902053623592525

The command factor can be used to factor this polynomial.

p := x^5-11*x^4+27*x^3+67*x^2-320*x+300:

factor(p)

                       2        2
        (x + 3) (x - 2)  (x - 5) 

Are you trying to compute approximations of only the real roots, or also complex roots?

You still haven't shown your larger example where computation takes too long. is it a polynomial sysyem?

How much accuracy do you want?

The eliminate command can (fortuitously) be used to see that d[1] also has a special value. And c[0] and d[0] can be recognized by the trivial eq[7] and eq[8]. But RootFinding:-Isolate would also find the real solutions without that finesse.

There are various other possible apporaches (using calls to solve, eliminate, evalf, etc). But if you are only looking for the real roots of a polynomial system with exact coefficient then Isolate has the advantage of attaining a target accuracy without so much fuss over having to raise working precision to avoid roundoff error.

restart;

eq[1] := -3*c[0]+3*c[1] = c[0]*(1-259*d[0]*(1/192)+43*d[1]*(1/64)-11*d[2]*(1/64)+(1/64)*d[3])-23/6:
eq[2] := -3*d[0]+3*d[1] = d[0]*(-2+23*c[0]*(1/80)+139*c[1]*(1/320)-17*c[2]*(1/160)+3*c[3]*(1/320))-1:
eq[3] := -4*c[0]*(1/3)+c[2]+(1/3)*c[3] = (8*c[0]*(1/27)+4*c[1]*(1/9)+2*c[2]*(1/9)+(1/27)*c[3])*(1-2657*d[0]*(1/5184)-343*d[1]*(1/1728)-185*d[2]*(1/1728)-79*d[3]*(1/5184))-3:
eq[4] := -4*d[0]*(1/3)+d[2]+(1/3)*d[3] = (8*d[0]*(1/27)+4*d[1]*(1/9)+2*d[2]*(1/9)+(1/27)*d[3])*(-2+109*c[0]*(1/8640)+553*c[1]*(1/1440)+559*c[2]*(1/2880)+37*c[3]*(1/1080))-5/6:
eq[5] := -(1/3)*c[0]-c[1]+4*c[3]*(1/3) = ((1/27)*c[0]+2*c[1]*(1/9)+4*c[2]*(1/9)+8*c[3]*(1/27))*(1-673*d[0]*(1/5184)-455*d[1]*(1/1728)-505*d[2]*(1/1728)-767*d[3]*(1/5184))-49/27:
eq[6] := -(1/3)*d[0]-d[1]+4*d[3]*(1/3) = ((1/27)*d[0]+2*d[1]*(1/9)+4*d[2]*(1/9)+8*d[3]*(1/27))*(-2-173*c[0]*(1/4320)+241*c[1]*(1/2880)+59*c[2]*(1/180)+2191*c[3]*(1/8640))-11/36:
eq[7] := c[0] = 1:
eq[8] := d[0] = 0:

 

evars := {c[0],d[1],d[0]};
new := eliminate({seq(eq[i],i=1..8)},evars);
specvals:=new[1];
newsys:=new[2];
newvars:=[op(indets(newsys,name) minus evars)]

{c[0], d[0], d[1]}

[{c[0] = 1, d[0] = 0, d[1] = -1/3}, {576*c[1]+11+33*d[2]-3*d[3], 4338*c[1]*d[2]+2892*c[1]*d[3]+16992*c[2]*d[2]+11328*c[2]*d[3]+13146*c[3]*d[2]+8764*c[3]*d[3]-723*c[1]-2832*c[2]-2191*c[3]-105756*d[2]-226024*d[3]-56894, 6660*c[1]*d[2]+948*c[1]*d[3]+3330*c[2]*d[2]+474*c[2]*d[3]+555*c[3]*d[2]+79*c[3]*d[3]-66324*c[1]+106806*c[2]+41129*c[3]+4440*d[2]+632*d[3]+189064, 9090*c[1]*d[2]+4602*c[1]*d[3]+18180*c[2]*d[2]+9204*c[2]*d[3]+12120*c[3]*d[2]+6136*c[3]*d[3]-173802*c[1]-67668*c[2]+141512*c[3]+1515*d[2]+767*d[3]+201721, 19908*c[1]*d[2]+3318*c[1]*d[3]+10062*c[2]*d[2]+1677*c[2]*d[3]+1776*c[3]*d[2]+296*c[3]*d[3]-13272*c[1]-6708*c[2]-1184*c[3]-336306*d[2]-94931*d[3]-125716}]

{c[0] = 1, d[0] = 0, d[1] = -1/3}

{576*c[1]+11+33*d[2]-3*d[3], 4338*c[1]*d[2]+2892*c[1]*d[3]+16992*c[2]*d[2]+11328*c[2]*d[3]+13146*c[3]*d[2]+8764*c[3]*d[3]-723*c[1]-2832*c[2]-2191*c[3]-105756*d[2]-226024*d[3]-56894, 6660*c[1]*d[2]+948*c[1]*d[3]+3330*c[2]*d[2]+474*c[2]*d[3]+555*c[3]*d[2]+79*c[3]*d[3]-66324*c[1]+106806*c[2]+41129*c[3]+4440*d[2]+632*d[3]+189064, 9090*c[1]*d[2]+4602*c[1]*d[3]+18180*c[2]*d[2]+9204*c[2]*d[3]+12120*c[3]*d[2]+6136*c[3]*d[3]-173802*c[1]-67668*c[2]+141512*c[3]+1515*d[2]+767*d[3]+201721, 19908*c[1]*d[2]+3318*c[1]*d[3]+10062*c[2]*d[2]+1677*c[2]*d[3]+1776*c[3]*d[2]+296*c[3]*d[3]-13272*c[1]-6708*c[2]-1184*c[3]-336306*d[2]-94931*d[3]-125716}

[c[1], c[2], c[3], d[2], d[3]]

 

Solnew := RootFinding:-Isolate(newsys,newvars,digits=25):
nops(Solnew);
map(print@evalf[5],Solnew):
Rnew:=[seq(evalf[25](eval(newsys,s)),s=Solnew)]:
seq([i,(max@op)(abs~(Rnew[i]))],i=1..nops(Rnew));

8

[c[1] = -2.3306, c[2] = -22.900, c[3] = 66.253, d[2] = 29.421, d[3] = -120.18]

[c[1] = 0., c[2] = -1., c[3] = -2., d[2] = -.33333, d[3] = 0.]

[c[1] = 6.2559, c[2] = -25.023, c[3] = 207.60, d[2] = -95.022, d[3] = 159.56]

[c[1] = 9.1174, c[2] = -371.93, c[3] = 510.06, d[2] = -105.71, d[3] = 591.42]

[c[1] = 371.76, c[2] = -945.22, c[3] = 1136.0, d[2] = -4795.7, d[3] = 18630.]

[c[1] = 779.33, c[2] = -1730.0, c[3] = 2009.3, d[2] = -8192.4, d[3] = 59520.]

[c[1] = 3922.0, c[2] = -9816.4, c[3] = 11794., d[2] = -59902., d[3] = 94114.]

[c[1] = 4131.4, c[2] = -10268., c[3] = 11989., d[2] = -61067., d[3] = 0.12149e6]

[1, 0.375e-16], [2, 0.1e-20], [3, 0.1561e-15], [4, 0.86e-15], [5, 0.4e-13], [6, 0.3e-12], [7, 0.37e-11], [8, 0.818e-11]

Solnew;

[[c[1] = -2.330639949724738343595716, c[2] = -22.89982197238880713869523, c[3] = 66.25310856709412628545785, d[2] = 29.42142564084380129840955, d[3] = -120.1805216312012810212058], [c[1] = 0., c[2] = -1., c[3] = -2., d[2] = -.3333333333333333333333333, d[3] = 0.], [c[1] = 6.255927282038413380435825, c[2] = -25.02271769693028720860972, c[3] = 207.5971290707517134952033, d[2] = -95.02218904239454035739991, d[3] = 159.5606253517020917789461], [c[1] = 9.117361146634459023171301, c[2] = -371.9293025401432341913410, c[3] = 510.0565426353267608425015, d[2] = -105.7073276505637045189833, d[3] = 591.4194026642820494067401], [c[1] = 371.7635884642179771452827, c[2] = -945.2237683753527116079604, c[3] = 1136.034971220020243070197, d[2] = -4795.651786369653511157575, d[3] = 18630.10600173032965582763], [c[1] = 779.3348107669203714939377, c[2] = -1729.971889940637220732631, c[3] = 2009.330823610934201173010, d[2] = -8192.404076947565715736100, d[3] = 59519.50548749215512040560], [c[1] = 3922.030291239845500202869, c[2] = -9816.385589616708397183330, c[3] = 11794.05189113569212529481, d[2] = -59901.78175819962660063243, d[3] = 94113.88324452111009866092], [c[1] = 4131.379895585846677049795, c[2] = -10268.33219677264457867323, c[3] = 11989.31825704926459215125, d[2] = -61067.24168520026862839832, d[3] = 121488.9480819462737478459]]

#RootFinding:-Isolate(newsys,newvars,output=interval;

 

Complex solutions

 

Digits:=25;

25

Sol2:=[solve(newsys,explicit,allsolutions)]:
nops(Sol2);

10

F2:=evalf[100](Sol2):
F2:=evalf(F2):
map(print@evalf[5],F2):
R2:=[seq(eval(newsys,[s[],specvals[]]),s=F2)]:
seq([i,(max@op)(abs~(R2[i]))],i=1..nops(R2));

{c[1] = 0., c[2] = -1., c[3] = -2., d[2] = -.33333, d[3] = 0.}

{c[1] = -2.3306, c[2] = -22.900, c[3] = 66.253, d[2] = 29.421, d[3] = -120.18}

{c[1] = 1.9664-.53923*I, c[2] = 25.504+4.4859*I, c[3] = -17.994-44.772*I, d[2] = -30.377+9.9872*I, d[3] = 47.070+6.3277*I}

{c[1] = 6.2559, c[2] = -25.023, c[3] = 207.60, d[2] = -95.022, d[3] = 159.56}

{c[1] = 9.1174, c[2] = -371.93, c[3] = 510.06, d[2] = -105.71, d[3] = 591.42}

{c[1] = 371.76, c[2] = -945.22, c[3] = 1136.0, d[2] = -4795.7, d[3] = 18630.}

{c[1] = 779.33, c[2] = -1730.0, c[3] = 2009.3, d[2] = -8192.4, d[3] = 59520.}

{c[1] = 3922.0, c[2] = -9816.4, c[3] = 11794., d[2] = -59902., d[3] = 94114.}

{c[1] = 4131.4, c[2] = -10268., c[3] = 11989., d[2] = -61067., d[3] = 0.12149e6}

{c[1] = 1.9664+.53923*I, c[2] = 25.504-4.4859*I, c[3] = -17.994+44.772*I, d[2] = -30.377-9.9872*I, d[3] = 47.070-6.3277*I}

[1, 0.1e-20], [2, 0.375e-16], [3, 0.7e-17], [4, 0.1561e-15], [5, 0.86e-15], [6, 0.4e-13], [7, 0.3e-12], [8, 0.37e-11], [9, 0.818e-11], [10, 0.7e-17]

F2;

[{c[1] = 0., c[2] = -1., c[3] = -2., d[2] = -.3333333333333333333333333, d[3] = 0.}, {c[1] = -2.330639949724738343595716, c[2] = -22.89982197238880713869523, c[3] = 66.25310856709412628545785, d[2] = 29.42142564084380129840955, d[3] = -120.1805216312012810212058}, {c[1] = 1.966382890860046002901190-.5392254859538496928610527*I, c[2] = 25.50351374246731635537461+4.485878800516206959178223*I, c[3] = -17.99357494982858498521487-44.77206000855391465107483*I, d[2] = -30.37657950249959283154526+9.987184666310217030202304*I, d[3] = 47.06980718429997807669723+6.327738026273246302903227*I}, {c[1] = 6.255927282038413380435825, c[2] = -25.02271769693028720860972, c[3] = 207.5971290707517134952033, d[2] = -95.02218904239454035739991, d[3] = 159.5606253517020917789461}, {c[1] = 9.117361146634459023171301, c[2] = -371.9293025401432341913410, c[3] = 510.0565426353267608425015, d[2] = -105.7073276505637045189833, d[3] = 591.4194026642820494067401}, {c[1] = 371.7635884642179771452827, c[2] = -945.2237683753527116079604, c[3] = 1136.034971220020243070197, d[2] = -4795.651786369653511157575, d[3] = 18630.10600173032965582763}, {c[1] = 779.3348107669203714939377, c[2] = -1729.971889940637220732631, c[3] = 2009.330823610934201173010, d[2] = -8192.404076947565715736100, d[3] = 59519.50548749215512040560}, {c[1] = 3922.030291239845500202869, c[2] = -9816.385589616708397183330, c[3] = 11794.05189113569212529481, d[2] = -59901.78175819962660063243, d[3] = 94113.88324452111009866092}, {c[1] = 4131.379895585846677049795, c[2] = -10268.33219677264457867323, c[3] = 11989.31825704926459215125, d[2] = -61067.24168520026862839832, d[3] = 121488.9480819462737478459}, {c[1] = 1.966382890860046002901190+.5392254859538496928610527*I, c[2] = 25.50351374246731635537461-4.485878800516206959178223*I, c[3] = -17.99357494982858498521487+44.77206000855391465107483*I, d[2] = -30.37657950249959283154526-9.987184666310217030202304*I, d[3] = 47.06980718429997807669723-6.327738026273246302903227*I}]

 

Download poly_system.mw

So, you have four different instances of the pair of tables Beams and Beams2?

Why not store them with one more (cheap) layer of indirection? That is to say, have four differently named parent tables (eg, BeamsTable[1], BeamsTable[2], ...) each of which contains their own distinct pair?

BeamsTable[1][Beams] is one, from a pair
BeamsTable[1][Beams2] is the other, from that pair

Or you could name the distinct parents BeamsTable1BeamsTable2, etc. That could mean slightly less effort in storing them, with completely separate calls.

You don't even need to use different .mla files. You could utilize just one.

One of the points I tried to convey in my response to your previous (related) question is that you need to manage the global namespace of your Maple sessions. I likely was not clear enough about that. It should be done through deliberately assigned names (in Maple), and not attempted as a byproduct of external filenames/locations.

Saying it another way: don't store different things under identical names in .mla files if you want to retrieve them as distinct things. Trying to leverage the file system for that (provided that you don't need more than one distinct access per restart) could be accomplished, but it's really not a good way to go about it. And more general access (within restart) is going to present some near-impossible scenarios.

nb. In your earlier thread I did not mention storing in plaintext (input Maple notation), because I assumed that you would not want any solution which incurred the overhead of reparsing the language input code -- per session.

What precisely do you mean? You haven't given any example to illustrate. The LinearAlgebra:-Eigenvectors command already returns both vectors and values, so you must mean something else. I will guess.

Are you trying to say that you like the syntax where the number of computed and returned objects depends on the number of entries in the sequence on the left-hand side of the assignment statement? That is, where the particular computation (with the same right-hand side of the statement) varies according to whether the assignmnent is,
  (a,b) := ....
or
  a := ....
The former computes and returns two items (eg, both the eigen-vectors and values), while the latter computes just one (eg. only the eigen-values).

Personally, I find that syntax to be poor and disjointed. I am glad that no other commands have taken up this un-Maplelike syntax (as any further cloying attempt at Matlab emulation). I suppose it's a matter of personal preference.

For those interested, that functionality is implemented using the _nresults item in the context of procedure parameter-processing.

MTM is now a regular package of Maple (alone), rather than a toolbox. (Documentation of connectivity with Matlab is not great. But the MTM computational commands are available.)

Is this the kind of thing that you're trying to accomplish? (I looked at only ev7...)

I used Maple 15.01, since your attechment seems to have been last saved in Maple 15.

``

restart

NULL

ross_d := diff(d(t), t) = -(3*d(t)-sqrt(3)*y(t)*l)*(1-d(t)^2):

ross_y := diff(y(t), t) = (-sqrt(3)*y(t)^2*d(t)*l)*(1/2)+(3/2)*y(t)*(2-z(t))*(z(t)-y(t)^2*sqrt(1-d(t)^2))/z(t):

ross_z := diff(z(t), t) = (3*(1-z(t)))*(z(t)-y(t)^2*sqrt(1-d(t)^2)):

NULL

rossler_sys := ross_d, ross_y, ross_z:

NULL

fp_sol := solve({rhs(ross_d) = 0, rhs(ross_y) = 0, rhs(ross_z) = 0}, {d(t), y(t), z(t)}):

fp1 := fp_sol[1]:

fp2 := fp_sol[2]:

fp3 := fp_sol[3]:

fp4 := fp_sol[4]:

fp5 := fp_sol[5]:

fp6 := fp_sol[6]:

fp7 := fp_sol[7];

{d(t) = (1/3)*3^(1/2)*RootOf(_Z^2*l^2+3*_Z^4-3)*l, y(t) = RootOf(_Z^2*l^2+3*_Z^4-3), z(t) = 1}

NULL

J := frontend(Student:-VectorCalculus:-Jacobian, [map(rhs, [rossler_sys]), ([d, y, z])(t)], [{`*`, `+`, list}, {}]):

ev1 := Student[LinearAlgebra][Eigenvalues](eval(J, fp1)):

ev2 := Student[LinearAlgebra][Eigenvalues](eval(J, fp2)):

ev3 := Student[LinearAlgebra][Eigenvalues](eval(J, fp3)):

ev4 := Student[LinearAlgebra][Eigenvalues](eval(J, fp4)):

ev5 := Student[LinearAlgebra][Eigenvalues](eval(J, fp5)):

ev6 := Student[LinearAlgebra][Eigenvalues](eval(J, fp6)):

ev7 := Student[LinearAlgebra][Eigenvalues](eval(J, fp7)):

 

sort(evalf(eval(ev7, l = 2)))

Vector[column]([[-2.14073503395190], [-1.39444872453606-.795806290992892*I], [-1.39444872453606+.795806290992892*I]])

 

fpexplicit := [solve({rhs(ross_d) = 0, rhs(ross_y) = 0, rhs(ross_z) = 0}, {d(t), y(t), z(t)}, explicit)]:

J8 := eval(J, fpexplicit[8]):

sort(evalf[15](eval(EV8, l = 2))); sort(simplify(LinearAlgebra:-Eigenvalues(evalf(eval(J8, l = 2))), zero))

Vector[column]([[-2.14073503395407], [-1.39444872453496-.795806290993298*I], [-1.39444872453496+.795806290993298*I]])

Vector[column]([[-2.140735032], [-1.394448726-.7958062921*I], [-1.394448726+.7958062921*I]])

P8 := LinearAlgebra:-CharacteristicPolynomial(J8, lambda):

9459

sort(evalf[15](eval(TT8, l = 2)))

Vector[column]([[-2.14073503518263], [-1.39444872392046-.795806291569942*I], [-1.39444872392046+.795806291569942*I]])

TT8

Vector[column]([[(1/72)*(2*(36*(((-28*l^20-2754*l^16-50544*l^12+644436*l^8+14184882*l^4+22674816)*(l^4+36)^(1/2)-27779274*l^6-160613280*l^2+28*l^22-99144*l^10+95580*l^14+3258*l^18)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(94*l^22+3828*l^18+63342*l^14+2382372*l^10+45865764*l^6+184547808*l^2)*(l^4+36)^(1/2)-816293376-713154456*l^4-3176496*l^12-83482164*l^8-117018*l^16-5520*l^20-94*l^24)^(1/2)+((-434*l^8-10908*l^4-22032)*(l^4+36)^(1/2)+18720*l^6+148068*l^2+434*l^10)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(-756*l^10-27540*l^6-172044*l^2)*(l^4+36)^(1/2)+839808+545292*l^4+756*l^12+41148*l^8)^(2/3)+1080*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)*l^2-2232*l^2*(l^4+36)^(1/2)+36*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)*l^6-36*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)*l^4*(l^4+36)^(1/2)+18144+4896*l^4-148*l^6*(l^4+36)^(1/2)+148*l^8-432*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)*(l^4+36)^(1/2)-108*(36*(((-28*l^20-2754*l^16-50544*l^12+644436*l^8+14184882*l^4+22674816)*(l^4+36)^(1/2)-27779274*l^6-160613280*l^2+28*l^22-99144*l^10+95580*l^14+3258*l^18)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(94*l^22+3828*l^18+63342*l^14+2382372*l^10+45865764*l^6+184547808*l^2)*(l^4+36)^(1/2)-816293376-713154456*l^4-3176496*l^12-83482164*l^8-117018*l^16-5520*l^20-94*l^24)^(1/2)+((-434*l^8-10908*l^4-22032)*(l^4+36)^(1/2)+18720*l^6+148068*l^2+434*l^10)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(-756*l^10-27540*l^6-172044*l^2)*(l^4+36)^(1/2)+839808+545292*l^4+756*l^12+41148*l^8)^(1/3)-(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)*(l^4+36)^(1/2)*(36*(((-28*l^20-2754*l^16-50544*l^12+644436*l^8+14184882*l^4+22674816)*(l^4+36)^(1/2)-27779274*l^6-160613280*l^2+28*l^22-99144*l^10+95580*l^14+3258*l^18)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(94*l^22+3828*l^18+63342*l^14+2382372*l^10+45865764*l^6+184547808*l^2)*(l^4+36)^(1/2)-816293376-713154456*l^4-3176496*l^12-83482164*l^8-117018*l^16-5520*l^20-94*l^24)^(1/2)+((-434*l^8-10908*l^4-22032)*(l^4+36)^(1/2)+18720*l^6+148068*l^2+434*l^10)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(-756*l^10-27540*l^6-172044*l^2)*(l^4+36)^(1/2)+839808+545292*l^4+756*l^12+41148*l^8)^(1/3)+(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)*l^2*(36*(((-28*l^20-2754*l^16-50544*l^12+644436*l^8+14184882*l^4+22674816)*(l^4+36)^(1/2)-27779274*l^6-160613280*l^2+28*l^22-99144*l^10+95580*l^14+3258*l^18)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(94*l^22+3828*l^18+63342*l^14+2382372*l^10+45865764*l^6+184547808*l^2)*(l^4+36)^(1/2)-816293376-713154456*l^4-3176496*l^12-83482164*l^8-117018*l^16-5520*l^20-94*l^24)^(1/2)+((-434*l^8-10908*l^4-22032)*(l^4+36)^(1/2)+18720*l^6+148068*l^2+434*l^10)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(-756*l^10-27540*l^6-172044*l^2)*(l^4+36)^(1/2)+839808+545292*l^4+756*l^12+41148*l^8)^(1/3))/(36*(((-28*l^20-2754*l^16-50544*l^12+644436*l^8+14184882*l^4+22674816)*(l^4+36)^(1/2)-27779274*l^6-160613280*l^2+28*l^22-99144*l^10+95580*l^14+3258*l^18)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(94*l^22+3828*l^18+63342*l^14+2382372*l^10+45865764*l^6+184547808*l^2)*(l^4+36)^(1/2)-816293376-713154456*l^4-3176496*l^12-83482164*l^8-117018*l^16-5520*l^20-94*l^24)^(1/2)+((-434*l^8-10908*l^4-22032)*(l^4+36)^(1/2)+18720*l^6+148068*l^2+434*l^10)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(-756*l^10-27540*l^6-172044*l^2)*(l^4+36)^(1/2)+839808+545292*l^4+756*l^12+41148*l^8)^(1/3)], [-(37/36)*((-((1/74)*I)*3^(1/2)+1/74)*(36*(((-28*l^20-2754*l^16-50544*l^12+644436*l^8+14184882*l^4+22674816)*(l^4+36)^(1/2)-27779274*l^6-160613280*l^2+28*l^22-99144*l^10+95580*l^14+3258*l^18)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(94*l^22+3828*l^18+63342*l^14+2382372*l^10+45865764*l^6+184547808*l^2)*(l^4+36)^(1/2)-816293376-713154456*l^4-3176496*l^12-83482164*l^8-117018*l^16-5520*l^20-94*l^24)^(1/2)+((-434*l^8-10908*l^4-22032)*(l^4+36)^(1/2)+18720*l^6+148068*l^2+434*l^10)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(-756*l^10-27540*l^6-172044*l^2)*(l^4+36)^(1/2)+839808+545292*l^4+756*l^12+41148*l^8)^(2/3)+(54/37+((1/74)*(l^4+36)^(1/2)-(1/74)*l^2)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2))*(36*(((-28*l^20-2754*l^16-50544*l^12+644436*l^8+14184882*l^4+22674816)*(l^4+36)^(1/2)-27779274*l^6-160613280*l^2+28*l^22-99144*l^10+95580*l^14+3258*l^18)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(94*l^22+3828*l^18+63342*l^14+2382372*l^10+45865764*l^6+184547808*l^2)*(l^4+36)^(1/2)-816293376-713154456*l^4-3176496*l^12-83482164*l^8-117018*l^16-5520*l^20-94*l^24)^(1/2)+((-434*l^8-10908*l^4-22032)*(l^4+36)^(1/2)+18720*l^6+148068*l^2+434*l^10)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(-756*l^10-27540*l^6-172044*l^2)*(l^4+36)^(1/2)+839808+545292*l^4+756*l^12+41148*l^8)^(1/3)+((-(9/37)*(l^4+36)^(1/2)*l^4+(270/37)*l^2+(9/37)*l^6-(108/37)*(l^4+36)^(1/2))*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(-(558/37)*l^2-l^6)*(l^4+36)^(1/2)+l^8+4536/37+(1224/37)*l^4)*(I*3^(1/2)+1))/(36*(((-28*l^20-2754*l^16-50544*l^12+644436*l^8+14184882*l^4+22674816)*(l^4+36)^(1/2)-27779274*l^6-160613280*l^2+28*l^22-99144*l^10+95580*l^14+3258*l^18)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(94*l^22+3828*l^18+63342*l^14+2382372*l^10+45865764*l^6+184547808*l^2)*(l^4+36)^(1/2)-816293376-713154456*l^4-3176496*l^12-83482164*l^8-117018*l^16-5520*l^20-94*l^24)^(1/2)+((-434*l^8-10908*l^4-22032)*(l^4+36)^(1/2)+18720*l^6+148068*l^2+434*l^10)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(-756*l^10-27540*l^6-172044*l^2)*(l^4+36)^(1/2)+839808+545292*l^4+756*l^12+41148*l^8)^(1/3)], [(37/36)*((-((1/74)*I)*3^(1/2)-1/74)*(36*(((-28*l^20-2754*l^16-50544*l^12+644436*l^8+14184882*l^4+22674816)*(l^4+36)^(1/2)-27779274*l^6-160613280*l^2+28*l^22-99144*l^10+95580*l^14+3258*l^18)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(94*l^22+3828*l^18+63342*l^14+2382372*l^10+45865764*l^6+184547808*l^2)*(l^4+36)^(1/2)-816293376-713154456*l^4-3176496*l^12-83482164*l^8-117018*l^16-5520*l^20-94*l^24)^(1/2)+((-434*l^8-10908*l^4-22032)*(l^4+36)^(1/2)+18720*l^6+148068*l^2+434*l^10)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(-756*l^10-27540*l^6-172044*l^2)*(l^4+36)^(1/2)+839808+545292*l^4+756*l^12+41148*l^8)^(2/3)+(-54/37+(-(1/74)*(l^4+36)^(1/2)+(1/74)*l^2)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2))*(36*(((-28*l^20-2754*l^16-50544*l^12+644436*l^8+14184882*l^4+22674816)*(l^4+36)^(1/2)-27779274*l^6-160613280*l^2+28*l^22-99144*l^10+95580*l^14+3258*l^18)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(94*l^22+3828*l^18+63342*l^14+2382372*l^10+45865764*l^6+184547808*l^2)*(l^4+36)^(1/2)-816293376-713154456*l^4-3176496*l^12-83482164*l^8-117018*l^16-5520*l^20-94*l^24)^(1/2)+((-434*l^8-10908*l^4-22032)*(l^4+36)^(1/2)+18720*l^6+148068*l^2+434*l^10)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(-756*l^10-27540*l^6-172044*l^2)*(l^4+36)^(1/2)+839808+545292*l^4+756*l^12+41148*l^8)^(1/3)+(-1+I*3^(1/2))*((-(9/37)*(l^4+36)^(1/2)*l^4+(270/37)*l^2+(9/37)*l^6-(108/37)*(l^4+36)^(1/2))*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(-(558/37)*l^2-l^6)*(l^4+36)^(1/2)+l^8+4536/37+(1224/37)*l^4))/(36*(((-28*l^20-2754*l^16-50544*l^12+644436*l^8+14184882*l^4+22674816)*(l^4+36)^(1/2)-27779274*l^6-160613280*l^2+28*l^22-99144*l^10+95580*l^14+3258*l^18)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(94*l^22+3828*l^18+63342*l^14+2382372*l^10+45865764*l^6+184547808*l^2)*(l^4+36)^(1/2)-816293376-713154456*l^4-3176496*l^12-83482164*l^8-117018*l^16-5520*l^20-94*l^24)^(1/2)+((-434*l^8-10908*l^4-22032)*(l^4+36)^(1/2)+18720*l^6+148068*l^2+434*l^10)*(36+2*l^4-2*l^2*(l^4+36)^(1/2))^(1/2)+(-756*l^10-27540*l^6-172044*l^2)*(l^4+36)^(1/2)+839808+545292*l^4+756*l^12+41148*l^8)^(1/3)]])

 

``

Download MaplePrimesacer_ac.mw

restart;

RR := Record( 'center' = [ 0, 1 ], 'radius' = 3,
              'mytable' = table([foo=bar]) ):

LibraryTools:-Save(RR, cat(kernelopts(homedir),"/mapleprimes/MyLib.mla"));

And now, you only need that .mla to be within libname in order to access the Record assigned to name RR,

restart;

libname:=cat(kernelopts(homedir),"/mapleprimes/MyLib.mla"),libname:

eval(RR);

    Record(center = [0, 1], radius = 3, mytable = TABLE([foo = bar]))

RR[center];

                         [0, 1]

entries(RR[mytable]);

                          [bar]

And if you wish you could set libname in your own initialization file, or with an option to your launcher. Or you could even utilize a .mla location such as (for example!),
   cat(kernelopts(homedir),"/maple/toolbox/XXX/lib")
so that the kernel prepends that to libname automatically.

So, in your equation is y=earnings and x=sales? If so then how about using those names in the equation?

Below I take more steps than is completely necessary, to try and make the process a bit more understandable.

One of the key commands I use here is eval, as a means of subsitution. There are several other equally good ways to go about these questions. For example you could set up operators (procedures) in instead of using eval.

restart;

 

This is the given equation for earnings as a function of sales.

 

eqnE := earnings = 2000 + 0.1*sales;

earnings = 2000+.1*sales

 

This is the sales value for question a).

 

s1 := 1488.0;

1488.0

 

Evaluate that equation using the given sales value for question a).

This gives a trivial equation showing the corresponding value for earnings.

 

ans1 := eval(eqnE, sales=s1);

earnings = 2148.80

 

We can pick off the value in several ways. Another way would be rhs(ans1) 

 

e1 := eval(earnings, ans1);

2148.80

 

Form a list of those two values, for later use in plotting.

 

pt1 := [s1, e1];

[1488.0, 2148.80]

 

This is the earnings value for question b).

 

e2 := 2225.0;

2225.0

 

Isolate (or solve) the original equation, to obtain an equation for sales in terms
of earnings.

 

eqnS := sales = solve(eqnE,sales);

sales = -20000.+10.*earnings

 

Evaluate that new equation using the given earnings value for question b).

This gives a trivial equation showing the corresponding value for sales.

 

ans2 := eval(eqnS, earnings=e2);

sales = 2250.0

 

We can pick off the value in several ways. Another way would be rhs(ans2) 

 

s2 := eval(sales, ans2);

2250.0

 

Form a list of those two values, for later use in plotting.

 

pt2 := [s2, e2];

[2250.0, 2225.0]

 

And now plot the original equation (earnings as a function of sales), as well
as a point-plot of the two results.

You can adjust to taste, eg, using options such as symbol, symbolsize, etc.

 

plots:-display(
  plot(eval(earnings, eqnE), sales=0..2500),
  plots:-pointplot([pt1,pt2], symbolsize=20),
  labels=[sales,earnings], axes=box, gridlines
)

 

Download eqnplot.mw

The parameters in an Explore call must be names.

It looks like you have assigned numeric values to names a and b.

explore_jamet.mw

The procedure getFnumer is set up to handle expressions of type `+`, but it is being sent an equation of type `=`.

Perhaps you wanted it to handle (lhs-rhs)(df) in that case?

But it would be much better if you described clearly what getFnumer is supposed to do.

restart;
sys:={3*x+5*y=21, -2*x+y=-1}:

sol:=fsolve(sys);
          
           sol := {x = 2., y = 3.}

eval([x,y],sol);

                  [2., 3.]

eval(<x,y>,sol);

                    [2.]
                    [  ]
                    [3.]

eval(x^2+y^3,sol);

                     31.

eval(x,sol);

                      2.

and so on.

Or, if you want to utilize LinearSolve from your system,

A,B := LinearAlgebra:-GenerateMatrix(sys,[x,y]);

                 [-2    1]  [-1]
         A, B := [       ], [  ]
                 [ 3    5]  [21]

LinearAlgebra:-LinearSolve(A,B);
                    [2]
                    [ ]
                    [3]
First 133 134 135 136 137 138 139 Last Page 135 of 336