acer

32368 Reputation

29 Badges

19 years, 333 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

You can map the diff command over the Matrix.

step1calshelper_ac.mw

I also show various simplifications (and their effects on the size of the Matrix entries).

Make a Matrix with the two lists as its columns (ie. column Vectors).

A := [[0, 1, 2, 3, 4, 5], [0, 2, 4, 6, 8, 10]]:
M:=<<A[1]>|<A[2]>>:
ExportMatrix(test, M, delimiter=" "):

Alternatively, create the Matrix with the lists as the rows, and export its transpose.

A := [[0, 1, 2, 3, 4, 5], [0, 2, 4, 6, 8, 10]]:
M:=Matrix(A):
ExportMatrix(test, M^%T, delimiter=" "):

It cannot be done straight from Maple, AFAIK.

It would be interesting if someone proved me wrong by showing a way using the Maple's HTTP or URL (or lower level via Sockets). Its not clear to me how login or authentification might work.

It'd be trickier still, since uploads to Mapleprimes are attachments to posts. It might be more effort to upload without a post (and then somehow post separately and attach the prior raw upload) or to effect both directly from Maple.

Upload and insertion of a link to the worksheet, or inlining of the worksheet, is available from within Mapleprimes using the green up-arrow that appears in the menubar of the Question/Reply/Post editor.

Upload to the Maplecloud is possible, directly from Maple. But I'm not aware that Mapleprimes and the Maplecloud have any functional interchange.

The easiest way is to put both subpackages within a single parent package.

If you really want them distinct then you can utilize an abbreviation scheme. Here are two choices for that:

1) Utilize the $define preprocessor directive in the source. (I prefer to load all my packages from source code stored in plaintext files outside of any worksheet.) For example,

$define OPFCN OriginalPackage:-Function

# alternatively
$define OP OriginalPackage
$define FCN Function

The second of those would be utilized by accessing OP:-FCN in the subsequent code.

At the end of the source file you can utilize the corresponding $undef directives.

2) Utilize the uses syntax at the start of the source for each procedure in the dependent (2nd) package. For example,

NewFunction := proc(x)
  local blah,blech;
  uses OP=OriginalPackage,
       OPFCN=OriginalPackage:-Function;

  blah := OP:-OtherFunction(x);
  blech := OPFCN(blah*x);
end proc;

If the whole equation is assigned to the name eqn , then how about,

collect( expand(lhs(eqn)), Rm, simplify ) = rhs(eqn);

Here are some ideas for reducing the size of the over expression, and one example of substituting names for common subexpressions.

restart;

A:=Matrix([[phi,conjugate(psi),chi,conjugate(rho)],
          [psi,-conjugate(phi),rho,-conjugate(chi)],
          [lambda1*phi,conjugate(lambda1)*conjugate(psi),
           lambda2*chi,conjugate(lambda2)*conjugate(rho)],
          [lambda1*psi,-conjugate(lambda1)*conjugate(phi),
           lambda2*rho,-conjugate(lambda2)*conjugate(chi)]]);

Matrix(4, 4, {(1, 1) = phi, (1, 2) = conjugate(psi), (1, 3) = chi, (1, 4) = conjugate(rho), (2, 1) = psi, (2, 2) = -conjugate(phi), (2, 3) = rho, (2, 4) = -conjugate(chi), (3, 1) = lambda1*phi, (3, 2) = conjugate(lambda1)*conjugate(psi), (3, 3) = lambda2*chi, (3, 4) = conjugate(lambda2)*conjugate(rho), (4, 1) = lambda1*psi, (4, 2) = -conjugate(lambda1)*conjugate(phi), (4, 3) = lambda2*rho, (4, 4) = -conjugate(lambda2)*conjugate(chi)})

d := LinearAlgebra:-Determinant(A):

d; length(%);

-conjugate(lambda2)*conjugate(chi)*conjugate(lambda1)*conjugate(psi)*chi*psi+conjugate(lambda2)*conjugate(chi)*conjugate(lambda1)*conjugate(psi)*phi*rho+conjugate(lambda2)*conjugate(chi)*conjugate(psi)*chi*lambda2*psi-conjugate(lambda2)*conjugate(chi)*conjugate(psi)*lambda1*phi*rho-conjugate(lambda2)*conjugate(chi)*conjugate(phi)*chi*lambda1*phi+conjugate(lambda2)*conjugate(chi)*conjugate(phi)*chi*lambda2*phi+conjugate(lambda2)*conjugate(rho)*conjugate(lambda1)*conjugate(phi)*chi*psi-conjugate(lambda2)*conjugate(rho)*conjugate(lambda1)*conjugate(phi)*phi*rho-conjugate(lambda2)*conjugate(rho)*conjugate(psi)*lambda1*psi*rho+conjugate(lambda2)*conjugate(rho)*conjugate(psi)*lambda2*psi*rho-conjugate(lambda2)*conjugate(rho)*conjugate(phi)*chi*lambda1*psi+conjugate(lambda2)*conjugate(rho)*conjugate(phi)*lambda2*phi*rho+conjugate(chi)*conjugate(lambda1)*conjugate(psi)*chi*lambda1*psi-conjugate(chi)*conjugate(lambda1)*conjugate(psi)*lambda2*phi*rho+conjugate(chi)*conjugate(lambda1)*conjugate(phi)*chi*lambda1*phi-conjugate(chi)*conjugate(lambda1)*conjugate(phi)*chi*lambda2*phi-conjugate(chi)*conjugate(psi)*chi*lambda1*lambda2*psi+conjugate(chi)*conjugate(psi)*lambda1*lambda2*phi*rho+conjugate(rho)*conjugate(lambda1)*conjugate(psi)*lambda1*psi*rho-conjugate(rho)*conjugate(lambda1)*conjugate(psi)*lambda2*psi*rho-conjugate(rho)*conjugate(lambda1)*conjugate(phi)*chi*lambda2*psi+conjugate(rho)*conjugate(lambda1)*conjugate(phi)*lambda1*phi*rho+conjugate(rho)*conjugate(phi)*chi*lambda1*lambda2*psi-conjugate(rho)*conjugate(phi)*lambda1*lambda2*phi*rho

2161

simplify(d,size); length(%);

((conjugate(rho)*conjugate(phi)-conjugate(psi)*conjugate(chi))*(chi*psi-phi*rho)*conjugate(lambda2)+(chi*phi*(lambda1-lambda2)*conjugate(phi)+conjugate(psi)*(chi*lambda1*psi-lambda2*phi*rho))*conjugate(chi)-conjugate(rho)*((chi*lambda2*psi-lambda1*phi*rho)*conjugate(phi)-psi*rho*conjugate(psi)*(lambda1-lambda2)))*conjugate(lambda1)+((-chi*phi*(lambda1-lambda2)*conjugate(phi)+conjugate(psi)*(chi*lambda2*psi-lambda1*phi*rho))*conjugate(chi)-conjugate(rho)*((chi*lambda1*psi-lambda2*phi*rho)*conjugate(phi)+psi*rho*conjugate(psi)*(lambda1-lambda2)))*conjugate(lambda2)+lambda1*lambda2*(conjugate(rho)*conjugate(phi)-conjugate(psi)*conjugate(chi))*(chi*psi-phi*rho)

1045

collect(d,[rho,chi],u->simplify(u,size)); length(%);

((psi*(lambda1-lambda2)*(conjugate(lambda1)-conjugate(lambda2))*conjugate(rho)+phi*conjugate(chi)*(conjugate(lambda2)-lambda2)*(conjugate(lambda1)-lambda1))*conjugate(psi)-conjugate(rho)*phi*conjugate(phi)*(conjugate(lambda2)-lambda1)*(conjugate(lambda1)-lambda2))*rho+((phi*(lambda1-lambda2)*(conjugate(lambda1)-conjugate(lambda2))*conjugate(phi)-psi*conjugate(psi)*(conjugate(lambda2)-lambda1)*(conjugate(lambda1)-lambda2))*conjugate(chi)+conjugate(rho)*psi*conjugate(phi)*(conjugate(lambda2)-lambda2)*(conjugate(lambda1)-lambda1))*chi

761

collect(d,[psi,phi],u->simplify(u,size)); length(%);

((rho*(lambda1-lambda2)*(conjugate(lambda1)-conjugate(lambda2))*conjugate(rho)-chi*conjugate(chi)*(conjugate(lambda2)-lambda1)*(conjugate(lambda1)-lambda2))*conjugate(psi)+chi*conjugate(rho)*conjugate(phi)*(conjugate(lambda2)-lambda2)*(conjugate(lambda1)-lambda1))*psi+((chi*(lambda1-lambda2)*(conjugate(lambda1)-conjugate(lambda2))*conjugate(phi)+rho*conjugate(psi)*(conjugate(lambda2)-lambda2)*(conjugate(lambda1)-lambda1))*conjugate(chi)-conjugate(rho)*rho*conjugate(phi)*(conjugate(lambda2)-lambda1)*(conjugate(lambda1)-lambda2))*phi

761

collect(d,[lambda1,lambda2],u->map(factor,simplify(u,size))); length(%);

(-(conjugate(psi)*conjugate(chi)-conjugate(rho)*conjugate(phi))*(chi*psi-phi*rho)*lambda2+(phi*conjugate(phi)+psi*conjugate(psi))*(chi*conjugate(chi)+conjugate(rho)*rho)*conjugate(lambda1)-conjugate(lambda2)*(conjugate(rho)*psi+phi*conjugate(chi))*(chi*conjugate(phi)+rho*conjugate(psi)))*lambda1+(-(conjugate(rho)*psi+phi*conjugate(chi))*(chi*conjugate(phi)+rho*conjugate(psi))*conjugate(lambda1)+conjugate(lambda2)*(phi*conjugate(phi)+psi*conjugate(psi))*(chi*conjugate(chi)+conjugate(rho)*rho))*lambda2+conjugate(lambda2)*conjugate(lambda1)*(conjugate(rho)*conjugate(phi)-conjugate(psi)*conjugate(chi))*(chi*psi-phi*rho)

983

R1:=abs(lambda1)^2+abs(lambda2)^2-conjugate(lambda2)*lambda1-conjugate(lambda1)*lambda2=K1:
R2:=abs(lambda1)^2+abs(lambda2)^2-conjugate(lambda2)*conjugate(lambda1)-lambda1*lambda2=K2:
R3:=conjugate(psi)*phi*rho*conjugate(chi)=K3:
R4:=chi*conjugate(phi)*conjugate(rho)*psi=conjugate(K3):
temp := simplify(collect(d,[rho,chi],u->simplify(u,size))):
new := simplify(subs([R1,R2,R3,R4],temp),size);
(rhs=lhs)(R1);
(rhs=lhs)(R2);
(rhs=lhs)(R3);

-4*Im(lambda1)*Im(lambda2)*(conjugate(K3)+K3)+(K1*abs(phi)^2+abs(psi)^2*K2)*abs(chi)^2+abs(rho)^2*(K1*abs(psi)^2+K2*abs(phi)^2)

K1 = abs(lambda1)^2+abs(lambda2)^2-conjugate(lambda2)*lambda1-conjugate(lambda1)*lambda2

K2 = abs(lambda1)^2+abs(lambda2)^2-conjugate(lambda2)*conjugate(lambda1)-lambda1*lambda2

K3 = conjugate(chi)*conjugate(psi)*phi*rho

# check
subs([(rhs=lhs)(R1),(rhs=lhs)(R2),(rhs=lhs)(R3)], new):
combine(simplify(eval(simplify((% - d)),
                      [lambda1=Re(lambda1)+I*Im(lambda1),
                       lambda2=Re(lambda2)+I*Im(lambda2)])));

0

 

Download some_simp.mw

In my Maple 2018.1 the integral of dex for t=0..phi2 can be done symbolically, under assumptions consisting of the bounds of the outer variables' ranges of integration. This leads to a triple integral that can be done quickly and accurately, numerically, without need to specify a particular method.

restart;

with(LinearAlgebra):

r1 := Vector([0, 0, 1]):

r2 := Vector([sin(theta1), 0, cos(theta1)]):

r3 := Vector([sin(theta2)*cos(phi2), sin(theta2)*sin(phi2), cos(theta2)]):

M := Matrix([r1, r2, r3]);

Matrix(3, 3, {(1, 1) = 0, (1, 2) = sin(theta1), (1, 3) = sin(theta2)*cos(phi2), (2, 1) = 0, (2, 2) = 0, (2, 3) = sin(theta2)*sin(phi2), (3, 1) = 1, (3, 2) = cos(theta1), (3, 3) = cos(theta2)})

ex := simplify(Determinant(M)/(1+DotProduct(r1,r2)+DotProduct(r1,r3)+DotProduct(r2,r3)))
      assuming theta1 > 0, theta2 > 0, phi2 > 0;

sin(theta1)*sin(theta2)*sin(phi2)/((cos(theta1)+1)*cos(theta2)+sin(theta1)*sin(theta2)*cos(phi2)+cos(theta1)+1)

dex := eval(simplify(diff(arctan(ex), phi2)), phi2 = t);

(1/2)*sin(theta1)*((cos(theta2)+1)*(cos(theta1)+1)*cos(t)+sin(theta2)*sin(theta1))*sin(theta2)/((cos(theta2)+1)*(cos(theta1)+1)*(sin(theta1)*sin(theta2)*cos(t)+cos(theta2)*cos(theta1)+1))

Q := simplify(int(dex, t = 0 .. phi2))
       assuming theta1 > 0, theta1 < Pi, theta2 > 0, theta2 < Pi, phi2 > 0, phi2<Pi;

(1/2)*phi2-arctan((cos(theta2)*cos(theta1)-sin(theta2)*sin(theta1)+1)*sin((1/2)*phi2)/(cos((1/2)*phi2)*abs(cos(theta2)+cos(theta1))))*signum(cos(theta2)+cos(theta1))

Tother := 2*Int( 2*Q/(4*Pi) * 2*Pi*sin(theta1)*sin(theta2)/(4*Pi*4*Pi),
                 [phi2 = 0 .. Pi, theta2 = 0 .. Pi, theta1 = 0 .. Pi] );

2*(Int((1/16)*((1/2)*phi2-arctan((cos(theta2)*cos(theta1)-sin(theta2)*sin(theta1)+1)*sin((1/2)*phi2)/(cos((1/2)*phi2)*abs(cos(theta2)+cos(theta1))))*signum(cos(theta2)+cos(theta1)))*sin(theta1)*sin(theta2)/Pi^2, [phi2 = 0 .. Pi, theta2 = 0 .. Pi, theta1 = 0 .. Pi]))

alt := simplify(combine(Tother));

Int(-(1/32)*(cos(-theta2+theta1)-cos(theta2+theta1))*(2*arctan((1/2)*(sin((1/2)*phi2+theta2+theta1)+sin((1/2)*phi2-theta2-theta1)+2*sin((1/2)*phi2))/(abs(cos(theta2)+cos(theta1))*cos((1/2)*phi2)))*signum(cos(theta2)+cos(theta1))-phi2)/Pi^2, [phi2 = 0 .. Pi, theta2 = 0 .. Pi, theta1 = 0 .. Pi])

evalf(alt);  # no special method specified

.1250000000

T := 2*Int( 2*Int(dex, t = 0 .. phi2)/(4*Pi) * 2*Pi*sin(theta1)*sin(theta2)/(4*Pi*4*Pi),
              [phi2 = 0 .. Pi, theta2 = 0 .. Pi, theta1 = 0 .. Pi] );

2*(Int((1/16)*(Int((1/2)*sin(theta1)*((cos(theta2)+1)*(cos(theta1)+1)*cos(t)+sin(theta2)*sin(theta1))*sin(theta2)/((cos(theta2)+1)*(cos(theta1)+1)*(sin(theta1)*sin(theta2)*cos(t)+cos(theta2)*cos(theta1)+1)), t = 0 .. phi2))*sin(theta1)*sin(theta2)/Pi^2, [phi2 = 0 .. Pi, theta2 = 0 .. Pi, theta1 = 0 .. Pi]))

# vv's idea
new := IntegrationTools:-Change(T, t=s*phi2, [s]):
new := simplify(IntegrationTools:-CollapseNested(frontend(combine,[%],[{`+`,`*`,specfunc(Int)},{}])));

Int((1/16)*sin(theta2)^2*phi2*((cos(theta2)+1)*(cos(theta1)+1)*cos(s*phi2)+sin(theta2)*sin(theta1))*sin(theta1)^2/((cos(theta2)+1)*(cos(theta1)+1)*Pi^2*(sin(theta1)*sin(theta2)*cos(s*phi2)+cos(theta2)*cos(theta1)+1)), [s = 0 .. 1, phi2 = 0 .. Pi, theta2 = 0 .. Pi, theta1 = 0 .. Pi])

subsindets(new,specfunc(Int),u->Int(op(u),method = _CubaCuhre, epsilon = 1e-5)):
evalf(%);

HFloat(0.12500056725173295)

 

Download multi_int.mw

 

Do you mean something like this?

g := expand( (x+1)*(x-2) )/(x-2);

                    2
                   x  - x - 2
              g := ----------
                     x - 2

discont(g,x);

                    {2}
restart;
sys:={x^2+y^2+z^2=4,x^2+y^2-z^2=4,x+y+z=0}:

solve(sys, explicit, allsolutions);

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

fsolve(sys,{x,y,z=0},{x=0..infinity});

              {x = 1.414213562, y = -1.414213562, z = 0.}

fsolve(sys,{x,y,z=0},{y=0..infinity});

              {x = -1.414213562, y = 1.414213562, z = 0.}


restart;
sys:={x^2+y^2+z^2=4,x^2+y^2-z^2=4,x+y+z=0}:

Digits:=18:
fsolve(sys,{x,y,z});

                                                                                 -13
  {x = 1.41421356237308740, y = -1.41421356237310269, z = 0.152880100390764231 10   }


restart;
sys:={x^2+y^2+z^2=4,x^2+y^2-z^2=4,x+y+z=0}:

fsolve( map(unapply,map(rhs-lhs,sys),[x,y,z]) );

                                                                   -9
   [-1.4142135624826409, 1.4142135622635492, 0.21909169874140413 10  ]

It's unfortunate that there are so many variations for which fsolve fails on this example. It ought to be made more robust. Often it almost gets there, but stops too early. It's a long-standing problem that the working precision and stopping criteria cannot be specified.

restart:
sys:={x^2+y^2+z^2=4,x^2+y^2-z^2=4,x+y+z=0}:
infolevel[fsolve]:=6:
fsolve(sys);

Another numeric approach,

restart;
sys:={x^2+y^2+z^2=4,x^2+y^2-z^2=4,x+y+z=0}:

Optimization:-Minimize(x,sys)[2];

    [x = -1.41422084007315, y = 1.41420628467304, z = 0.0000145554001009322]

eval(map((lhs-rhs),sys),%);

                          -9                       -16                      -9
    {-0.105929931493165 10  , -0.473626942786715 10   , 0.317789794479495 10  }

Digits:=20:
Optimization:-Minimize(x,sys,feasibilitytolerance=1e-13)[2];
                                                                                        -6
    [x = -1.4142136550635758637, y = 1.4142134696826142339, z = 0.18538096162967075298 10  ]

eval(map((lhs-rhs),sys),%);

                      -13                -18             -13
         {-0.171831 10   , -0.12924702 10   , 0.515491 10   }

 

restart;

 

`print/%maximize`:=proc(expr::algebraic,
                        u::name=range)
  local rng;
  uses T=Typesetting;
  if interface(':-prettyprint')<2 then
    return %maximize(args);
  end if;
  rng := lhs(u) in [rhs(u)];
  # "#000000" is black
  T:-mrow(T:-munder(T:-mo("max",':-mathcolor'="#606060"),
                    T:-Typeset(T:-EV(rng))),
          T:-mspace(':-width'="0.3em"),
          T:-Typeset(T:-EV(expr)));
end proc:

`print/%minimize`:=subs(["max"="min",
                         ':-%maximize'=':-%minimize'],
                        eval(`print/%maximize`)):

 

%maximize(f(x), x=2..3);

%maximize(f(x), x = 2 .. 3)

value(%);

maximize(f(x), x = 2 .. 3)

%maximize((2*x-3)/(x-2), x=2..3);

%maximize((2*x-3)/(x-2), x = 2 .. 3)

value(%);

infinity

%minimize((2*x-3)/(x-2), x=2..3);

%minimize((2*x-3)/(x-2), x = 2 .. 3)

value(%);

3

%maximize((2*x-3)/(x-2), x=2..3, location);

%maximize((2*x-3)/(x-2), x = 2 .. 3, location)

value(%);

infinity, {[{x = 2}, infinity]}

 

Download max_typeset_edited.mw

[edited with Carl's suggestions]

It's not clear to me what you are asking for. Is it something like this?

limit( (2*x-3)/(x-2), x=2, right );

                infinity

maximize( (2*x-3)/(x-2), x=2..3 );

                infinity

maximize( (2*x-3)/(x-2), x=2..3, location );

         infinity, {[{x = 2}, infinity]}

It's SetProperty not setProperty .

PolarPlotB_a.mw

I wonder whether it might also be possible to get the value from the inert form of the Variance by collapsing the nested integrals, ie. changing from nested Int(Int(...)) form into (a sum of?) Int(...,[...]) calls.  I suspect that in nested form the inner integrals may not "know" about the real-ness of the outer variables of integration. Just an idea.

Here is something,

restart:

kernelopts(version);

`Maple 2018.1, X86 64 LINUX, Jun 8 2018, Build ID 1321769`

with(Statistics):

X := RandomVariable(Normal(mu__x, sigma__x)):
Y := RandomVariable(Normal(mu__y, sigma__y)):

U := X+Y:

Z := q -> cos(q):

v__z := Variance(Z(X));

-(1/2)*(2*cos(mu__x)^2*exp(sigma__x^2)-exp(2*sigma__x^2)-2*cos(mu__x)^2+1)*exp(-2*sigma__x^2)

V := subs({mu__x=Mean(U), sigma__x=StandardDeviation(U)}, v__z);

-(1/2)*(2*cos(mu__x+mu__y)^2*exp(sigma__x^2+sigma__y^2)-exp(2*sigma__x^2+2*sigma__y^2)-2*cos(mu__x+mu__y)^2+1)*exp(-2*sigma__x^2-2*sigma__y^2)

Variance(Z(X+Y),inert):
value(combine(%)) assuming real, sigma__x>0, sigma__y>0:

lprint(%);

-(1/2)*(4*cos(mu__x)^2*cos(mu__y)^2*exp(sigma__x^2+sigma__y^2)-4*cos(mu__x)*cos(mu__y)*sin(mu__x)*sin(mu__y)*exp(sigma__x^2+sigma__y^2)-4*cos(mu__x)^2*cos(mu__y)^2-2*cos(mu__x)^2*exp(sigma__x^2+sigma__y^2)+4*cos(mu__x)*cos(mu__y)*sin(mu__x)*sin(mu__y)-2*cos(mu__y)^2*exp(sigma__x^2+sigma__y^2)-exp(2*sigma__x^2+2*sigma__y^2)+2*cos(mu__x)^2+2*cos(mu__y)^2+2*exp(sigma__x^2+sigma__y^2)-1)*exp(-2*sigma__x^2-2*sigma__y^2)

simplify(combine(%));

(1/2)*(-cos(2*mu__x+2*mu__y)-1)*exp(-sigma__x^2-sigma__y^2)+(1/2)*cos(2*mu__x+2*mu__y)*exp(-2*sigma__x^2-2*sigma__y^2)+1/2

is(%=V);

true

 

Download Stat_2015_something.mw

I'll submit a bug report.

Don't use evalf(h,3) or evalf[3](h) as that will use only 3 digits of working precision which is not enough to handle floating-point error here.

The syntax evalf(h,3) or evalf[3](h) instructs Maple to use 3 digits of working precision (possibly with a few extra guard digits for atomic operations or special function calls). But it does not instruct Maple to compute the result to 3 digits of accuracy.

If you only want 3 decimal places in the final answer then either,

  • compute with higher (significantly more than Digits=3) working precision, then evalf[3] that intermediate result.
  • compute with higher (significantly more than Digits=3) working precision, but use GUI-driven numeric formatting or interface(displayprecision) to control the display of the result

Download evalf_example.mw

As a general rule, never try and do anything complicated with less than Digits=5 working precision.

Use the syntax evalf[d](expr) instead of evalf(expr, d) since the latter can be problematic in the case that expr is an expression sequence and you want to compare with evalf(expr) .

@wswain The current version is Maple 2018, not Maple 18 which used an older naming scheme and was released in the year 2014.  Since the year 2015 the versions have been named by the year in which they were released.

If you execute the command kernelopts('homedir') then you will see what Maple thinks is your so-called home directory. The form of that will depend on your OS. In Linux it is uusally something like "home/acer" while on MS-Windows it is something more like "C:\Users\acer".

In modern Maple (for many years now, since version Maple 10 (2005) the filename extension of a Maple Library Archive is .mla .  In versions like Maple 9.5 (2004) and older each library archive consisted of two files as a pair, with filename extensions .lib and .ind , but that is no longer relevant in modern Maple and shouldn't concern you.

In a Maple session the assigned value of libname is the comma-separated path of locations (or individual library archive files) which the Maple kernel uses to search for Library archives.

Maple ships with its own library archives. But you can create you own, and add to them, using commands from the LibraryTools package. I recommand using that package instead of using the savelib command.

One way to get Maple to notice and utilize your own custom-made library achives is to append to the assigned value of libname .  Eg,

libname := libname, somenewfolderlocation;

One way to get Maple to automatically notice and utilize your own custom-made library archives -- upon restart of the kernel or re-launch of the GUI -- is to put such a command as above (appending to libname) in a so-called initialization file. The exact, valid location of an initialization file is platform-specfic, see here.

There is a way that is simpler than adding an initialization file and editing it with a line to append to libname.  It relies on the fact that the so-called toolbox locations are treated specially. If kernelopts('homedir') returns, say, "/home/acer" then the following location -- if it exists in the OS file system -- is automatically appended to libname upon restart using any modern Maple version. 

cat(kernelopts('homedir'), "/maple/toolbox/OrthogonalExpansions/lib");
                       
      "/home/acer/maple/toolbox/OrthogonalExpansions/lib"

You can even make it version-specific. The following location -- if it exists in the OS file system -- is automatically appended to libname upon restart using version Maple 2018.x but no other version. 

cat(kernelopts('homedir'), "/maple/toolbox/2018/OrthogonalExpansions/lib");
                       
      "/home/acer/maple/toolbox/2018/OrthogonalExpansions/lib"

So in order to get your custom package to be accessible automatically in all future sessions all you have to do is store it in a library archive that is created in such a special, so-called "toolbox" location. That is less work than having to mess around with libname and initialization files.

Notes:

  • You can create multiple library archives. You can store multiple packages to a single library archive.
  • The Maple kernel re-scans for such valid toolbox directories following each restart .
  • The GUI will also scan such toolbox directories (or directories in libname , including those appended in an initialization file) when looking for Help Database files (.help or older .hdb file extension). But this only happens when the GUI is launched fresh. It does not re-scan after restart (since version Maple 13).
First 171 172 173 174 175 176 177 Last Page 173 of 336