acer

32405 Reputation

29 Badges

19 years, 346 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

The nprintf command is more suitable and straightforward than cat, for such concatenation (to a name).

restart;

Sol1:=1/4: Sol2:=1/5: Sol3:=1/7:

nprintf("Solution : A=%a, B=%a, C=%a.",Sol1,Sol2,Sol3);

`Solution : A=1/4, B=1/5, C=1/7.`

 


Download nprintf.mw

If you don't need the 1/2 pretty-printed as 2D Math then I suggest you go with Rouben's straightforward suggestion.

But if you want the 1/2 as an exact value and typeset in 2D Math then you could do it as follows. (There first example displays in the Maple's Standard GUI with the desired space after the word "for". That space is missing below due to a bug in the Mapleprimes inline renderer.)

ss1:=-2:  ss2:=1/2:  ss3:=-5:

 

print(`The 3 equations in A, B, C for`*s=ss1,s=ss2,`and `*cat(s,`=`,ss3,` :`));

`The 3 equations in A, B, C for`*s = -2, s = 1/2, `and `*`s=-5 :`

 

Or if you prefer an upright font for the words,

 

Typesetting:-mn(`The 3 equations in A, B, C for`)*s=ss1, s=ss2,
Typesetting:-mn(`and `)*cat(s,`=`,ss3,` :`);

Typesetting:-mn(`The 3 equations in A, B, C for`)*s = -2, s = 1/2, Typesetting:-mn(`and `)*`s=-5 :`

 


Download sent.mw

You could Explore a function call of the parameter.

restart;

m:=Matrix(1..10,1..10,(i,j)->(j/10.0)^(i)):

Explore((A->plots:-pointplot(m[A,1..10],[.1,.2,.3,.4,.5,.6,.7,.8,.9,1]))(a),
        parameters=[a=1..10]);
which is the same as,
restart;

m:=Matrix(1..10,1..10,(i,j)->(j/10.0)^(i)):

F:=A->plots:-pointplot(m[A,1..10],[.1,.2,.3,.4,.5,.6,.7,.8,.9,1]):

Explore(F(a), parameters=[a=1..10]);

It may well be that global optimization (using DirectSerach say) is the best way to go.

But I thought that I'd show that, at least for the given example, it is possible to find "all" the roots of the derivative system. Note that I use the output=numeric and method=RS options to RootFinding:-Isolate, and it may be that instead allowing an interval output could even encapsulate some small ranges within which a global minimum attains. On a fast machine it found 14 roots in about 15 minutes, and on a slightly slower machine the same in about 30 minutes. Of course that may be prohibitively long, for you. But it may be faster than other attempts.

It isn't clear to me how many digits are to be allowed in a solution. I mean, what is a very much better solution is only possible within a very restricted range of difference in some variable way out beyond the 15th decimal place?

And (for fun, mostly), I just added in some goofing around with Optimization:-Minimizepoly_opt.mw

First I clicked on the Download link on the webpage linked in the Question. That prompted me to download a file named adty_v1_0.tar.gz which  I saved to a new folder named wkptest located in my home directory.

Note my "home directory" is also the string that Maple returns when I issue the Maple command kernelopts(homedir) .

Then I unpacked that adty_v1_0.tar.gz file to the same folder (directory). (I use Linux, which has a utility tar for unpacking such files. On MS-Windows you may have to use something else. It's possible that modern MS-Windows will know how to extract the files by right-click.)

Two files were unpacked:

  exam_wkptest.mws
  wkptest_cpc

The first file, exam_wkptest.mws is a worksheet whose first few lines were commands to create a new Maple Library archive, and adjust libname . Below I'll show you how I changed those lines.

The second file wkptest_cpc contains the Maple source code for the wkptest package. NOTE that this source file also contains a call to savelib at its end. So DON'T use the Maple command read on it if you don't first make correct edits (as shown below) to adjust libname appropriately.

These are the lines that I removed from the exam_wkptest.mws file.

libname:=`i:\\ptest`,libname;
march(create,libname[1],100);
read`i:\\ptest\\wkptest_cpc`;

I replaced those lines in exam_wkptest.mws with the following:

restart:
sourcefolder:=cat(kernelopts('homedir'),"/wkptest");
installfolder:=cat(kernelopts('homedir'),"/maple/toolbox/wkptest/lib");
FileTools:-MakeDirectory(installfolder, 'recurse'=true);
libraryfile:=cat(installfolder,"/wkptest.mla");
try
  FileTools:-Remove(libraryfile);
catch:
end try:
LibraryTools:-Create(libraryfile);
libname:=libraryfile,libname;
read cat(sourcefolder,"/wkptest_cpc");

Note that the output of the Mapel command cat(kernelopts('homedir'),"/wkptest") matches the folder into which I unpacked the adty_v1_0.tar.gz file.

Those lines above, which build the Maple Library archive, only need to be executed once. I suggest saving a copy of the exam_wkptest.mws which does not contain them. (In Maple 18 at least, such a revised .mw/.mws file will need to be Closed and re-Opened in the GUI, for the examples to run.)

By creating the .mla Maple Library archive in an appropriate folder (directory) under cat(kernelopts('homedir'),"/maple/toolbox") there will be no need to adjust libname in future sessions in order to load and access the wkptest package.

After doing the above steps the package loaded file with the with(wkptest) command, and the examples in the .mws worksheet executed OK.

Note to others: The files in question are the intellectual property of that website. Please do not upload them to Mapleprimes without explicit permission of the authors.

Last week or so _Maxim_ mentioned wrapping calls involving large Arrays in try..catch, presumably so that an error could be rethrown with a terse (or no) message string.

I noticed that in Maple 18(?) the error message arising from an invalid call to say InageTools:-Embed would elide the large Array/Matrix from the formatted error string.

So sometime between Maple 18 and Maple 2017 something has changed. If I'm right then it would be worthwhile pinning down the version where it changed, perhaps figure out if it were accidental or deliberate regression, and (in either case) submitting a bug report.

 

Using two calls to ArrayTools:-BlockCopy this can be done very quickly.

For N=10^4 and P=5 my machine does it so quickly that the elapsed time is reported as 0 seconds, because the time is below the timer threshold. Memory allocation increase is not measurably more than the memory footprint of the result Matrix. Garbage collection effects are also too small to measure (except in kilobytes, ie. tiny).

The only caveat is that the datatype of A and B must match.  But that allows for the case where neither has a specified datatype. (And mixed float[8] and complex[8] could be accomodated with minor changes).

In the attachment below I show it running for unspecified datatype (ie. `anything`) as well as float[8]. For interest I compare with Tom's two methods.

If you need to re-use Matrix C from some earlier use then it'd be a trivial change to edit the procedure F so that C is passed in as an argument. Of course you could then add boilerplate to verify that dimensions match, etc.

restart;

F:=proc(a::Matrix,b::Matrix,N::posint,P::posint)
  local C, dta, dtb;
  dta:=rtable_options(a,':-datatype');
  dtb:=rtable_options(b,':-datatype');
  if dta<>dtb then error "expecting matrices with same datatype";
  end if;
  C:=Matrix(N,2*P,':-datatype'=dta):
  ArrayTools:-BlockCopy(A,0,N,N,P,C,0,2*N,N,P);
  ArrayTools:-BlockCopy(B,0,N,N,P,C,N,2*N,N,P);
  C;
end proc:

n:=4;
p:=5;

4

5

A:=LinearAlgebra:-RandomMatrix(n,p,generator=1..10);

_rtable[18446883882722325438]

B:=LinearAlgebra:-RandomMatrix(n,p,generator=-10..-1);

_rtable[18446883882722328438]

F(A,B,n,p);

_rtable[18446883882722327598]

nr:=1000:
nc:=5:
A:=LinearAlgebra:-RandomMatrix(nr, nc):
B:=LinearAlgebra:-RandomMatrix(nr, nc):

M:=CodeTools:-Usage( Matrix
                                        ( [ seq
                                            ( [A[..,k], B[..,k]][],
                                              k=1..op([1,2],A)
                                            )
                                          ]
                                        )
                                     ):

memory used=30.86MiB, alloc change=1.00MiB, cpu time=195.00ms, real time=196.00ms, gc time=0ns

P:=CodeTools:-Usage( Matrix
                                        ( ListTools:-Interleave
                                          ( [LinearAlgebra:-Column(A,[1..op([1,2],A)])],
                                            [LinearAlgebra:-Column(B,[1..op([1,2],B)])]
                                          )
                                        )
                                     ):

memory used=29.74MiB, alloc change=0 bytes, cpu time=192.00ms, real time=193.00ms, gc time=12.00ms

Q:=CodeTools:-Usage( F(A,B,nr,nc) ):

memory used=83.35KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns, gc time=0ns

LinearAlgebra:-Norm(P-M);

0

LinearAlgebra:-Norm(P-Q);

0

A:=LinearAlgebra:-RandomMatrix(nr, nc, datatype=float[8]):
B:=LinearAlgebra:-RandomMatrix(nr, nc, datatype=float[8]):

M:=CodeTools:-Usage( Matrix
                                        ( [ seq
                                            ( [A[..,k], B[..,k]][],
                                              k=1..op([1,2],A)
                                            )
                                          ]
                                        )
                                     ):

memory used=30.04MiB, alloc change=0 bytes, cpu time=189.00ms, real time=191.00ms, gc time=8.00ms

P:=CodeTools:-Usage( Matrix
                                        ( ListTools:-Interleave
                                          ( [LinearAlgebra:-Column(A,[1..op([1,2],A)])],
                                            [LinearAlgebra:-Column(B,[1..op([1,2],B)])]
                                          )
                                        )
                                     ):

memory used=30.04MiB, alloc change=0 bytes, cpu time=196.00ms, real time=194.00ms, gc time=12.00ms

Q:=CodeTools:-Usage( F(A,B,nr,nc) ):

memory used=83.43KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns, gc time=0ns

LinearAlgebra:-Norm(P-M);

0.

LinearAlgebra:-Norm(P-Q);

0.

 


Download interleavecolumns.mw

From that website you should be able to right-click and Save-As from your webbrowser, and then use File-Open in Maple's GUI.

But if that is a problem for you, here's that example opened directly from within Maple (done in two related ways).
 

restart;

kernelopts(version);

`Maple 2016.2, X86 64 LINUX, Jan 13 2017, Build ID 1194701`

str:=Import("http://www.yorku.ca/marko/ComPhys/maple6-files/SpecialRel.mws"):

# Write it to a file.
# Here I'm writing it out to "/tmp/SpecialRel.mws" on Linux.
# On MS-Windows you could use an appropriate location, say
# "C:/TEMP/SpecialRel.mws" or what have you.

filename := "/tmp/SpecialRel.mws";
FileTools:-Text:-WriteFile(filename, str);

"/tmp/SpecialRel.mws"

93552

# Open that saved .mws file in a new Standard GUI tab.

Worksheet:-DisplayFile(filename);

# Optionally, open it immediately in a new tab of the Standard GUI.

streamcall(INTERFACE_WORKSHEET(':-display', ':-text'=str));

 

 

Download import_mws.mw

A MathContainer component is a very poor choice for storing numeric data. That is borne out by the absurdity of having to paste in a whole Matrix (or set its `expression` to the whole Matrix), and the inability to efficiently extract entries.

A DataTable component is much more suitable to storing a Matrix or Vector. A DataTable is tied directly to an actual Matrix/Vector so programmatic extraction and update is as usual, and efficient. The data is stored in the document and available after restart or close/re-open. 

@Earl 

It is a common misunderstanding about the solve command that it somehow requires you to solve for all variables, or is otherwise weirdly picky about which.

A related misunderstanding is that when solve returns NULL it means that there is no solution at all for the supplied variables. But it can mean that there is no solution for the solving-variables that allows the remaining variables to be unrestricted.

The essence is in whether solve can return solutions in which all the variables are either free or defined in terms of those that are free.

In your example you cannot solve only for xp, since x and tp are otherwise restricted. And you cannot solve for just xpx, and tp because then t and v are still restricted. Even if you evaluate those particular expressions PrimeTime and PrimeLength beforehand at the special values of x and tp then solve would still need to get at least one of t or v as a solving variable, because t and v are restricted by each other.

So if you want to utilize solve for your example then you have to include at least one of t or v in the set of solving-variables (or pass the parametric option so that restrictions can be handled and expressed via piecewise, but that has limited support for inequalites and non-polynomial expressions).

Another command for this kind of thing (often overlooked) is eliminate. For your example it can return a formula for xp (and other solving-variable subsets) as well as the set of restrictions on the remaining variables.

When the second component of the list returned by eliminate is the empty set then there are no restrictions on the remaining variables, which means that the particular call to eliminate would also have succeeded with solve.

See attached: SpecialRelativity_1.mw

Yes, this is handled in Maple 2017 via new Typesetting:-Settings(typesetdot) functionality.

See the second bullet point of the first section of the help page with topic updates,Maple2017,compatibility .

restart

kernelopts(version)

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

interface(typesetting = extended)

fun1 := diff(x(t), t, t)+2*xi*(diff(x(t), t))+omega[n]*x(t) = a*omega[f]^2*y(t)

diff(diff(x(t), t), t)+2*xi*(diff(x(t), t))+omega[n]*x(t) = a*omega[f]^2*y(t)

Typesetting:-Settings(typesetdot = true)

fun1

diff(diff(x(t), t), t)+2*xi*(diff(x(t), t))+omega[n]*x(t) = a*omega[f]^2*y(t)

``

 

Download dotfun.mw

It looks like you may have inadvertently entered one of those r-subscript-i instances as r__i instead of r[i] , in that call to `seq`.

Make sure that those subscripts are with square bracket indexing and not with double underscores. Otherwise they won't be mutable with respect to index `i` as it takes on takes from 1 to 8.

Also make sure that all the others are like r[1] , r[2] , etc.

In other words, you need to be consistent.

The alternative is to use double underscore subscripting for all 8, and then build the pair inside `seq` dynamically with concatenation. That would be ugly code.

For the example with HankelH1(0,...), without the change of variables. And a few observations about handling the imaginary part.

restart;

kernelopts(version);

`Maple 2017.3, X86 64 LINUX, Sep 27 2017, Build ID 1265877`

ig:=cos(alpha*s)*(1/8*I)*(-HankelH1(0, beta*s)-(2*I)*BesselK(0, beta*s)/Pi)/beta^2;

((1/8)*I)*cos(alpha*s)*(-HankelH1(0, beta*s)-(2*I)*BesselK(0, beta*s)/Pi)/beta^2

bah:=int(ig, s=0..infinity); # Bah.

(1/8)/(beta^3*((alpha^2+beta^2)/beta^2)^(1/2))

evalf(eval([bah, Int(ig,s=0..infinity)], [alpha=1,beta=3/2]));

[0.3081667755e-1, 0.3081667757e-1-0.4969039950e-1*I]

newig:=convert(ig,Bessel);

((1/8)*I)*cos(alpha*s)*(-BesselJ(0, beta*s)-I*BesselY(0, beta*s)-(2*I)*BesselK(0, beta*s)/Pi)/beta^2

conds:=s>0, alpha>0, beta>0, seq(r::real,r=indets(newig,specfunc({BesselJ,BesselY,BesselK})));

0 < s, 0 < alpha, 0 < beta, (BesselJ(0, beta*s))::real, (BesselK(0, beta*s))::real, (BesselY(0, beta*s))::real

ans:=int(newig,s=0..infinity) assuming conds;

(1/2)*2^(1/2)*Pi^(1/2)*(-((1/8)*I)*2^(1/2)*Heaviside(beta-alpha)/(Pi^(1/2)*(-alpha^2+beta^2)^(1/2)*beta^2)-(1/8)*2^(1/2)*Heaviside(-beta+alpha)/(Pi^(1/2)*(alpha^2-beta^2)^(1/2)*beta^2)+(1/8)*2^(1/2)/(Pi^(1/2)*(alpha^2+beta^2)^(1/2)*beta^2))

rans:=radnormal(convert(ans,piecewise,alpha)) assuming alpha>0, beta>0;

rans := piecewise(alpha < beta, -(I*sqrt(alpha^2+beta^2)-sqrt(-alpha^2+beta^2))/(8*sqrt(alpha^2+beta^2)*beta^2*sqrt(-alpha^2+beta^2)), alpha = beta, ((undefined*I)*sqrt(alpha^2+beta^2)*sqrt(alpha^2-beta^2)-undefined*sqrt(alpha^2+beta^2)*sqrt(-alpha^2+beta^2)+sqrt(-alpha^2+beta^2)*sqrt(alpha^2-beta^2))/(8*sqrt(alpha^2+beta^2)*beta^2*sqrt(-alpha^2+beta^2)*sqrt(alpha^2-beta^2)), beta < alpha, (sqrt(alpha^2-beta^2)-sqrt(alpha^2+beta^2))/(8*sqrt(alpha^2+beta^2)*beta^2*sqrt(alpha^2-beta^2)))

evalf(eval([ans,rans,Int(ig,s=0..infinity)], [alpha=1,beta=3/2]));

[0.3081667754e-1-0.4969039945e-1*I, 0.3081667754e-1-0.4969039949e-1*I, 0.3081667757e-1-0.4969039950e-1*I]

evalf(eval([ans,rans,Int(ig,s=0..infinity)], [alpha=2,beta=3/2]));

[-0.1977383032e-1, -0.1977383033e-1, -0.1977383033e-1+0.6e-13*I]

plots:-display(
    plot3d([Re,Im](rans),alpha=0..beta,beta=0..2, view=-1..1, color=[red,blue], style=surface),
    plot3d([Re,Im](rans),alpha=beta..2,beta=0..2, view=-1..1, color=[red,blue], style=surface)
);

 

I suspect that the following relates to how it can lose the imaginary part.

 

ig_hmm:=simplify(Im(newig)) assuming conds;

-(1/8)*cos(alpha*s)*BesselJ(0, beta*s)/beta^2

int(ig_hmm, s=0..infinity); # Bah. We are lucky this didn't happen for `ans` above!

0

 

We can look at similar ways to get it right, or wrong...

 

another:=evalc(Re(newig)+Im(newig)*I) assuming conds;

(1/8)*cos(alpha*s)*(BesselY(0, beta*s)*Pi+2*BesselK(0, beta*s))/(beta^2*Pi)-((1/8)*I)*cos(alpha*s)*BesselJ(0, beta*s)/beta^2

int(another, s=0..infinity): simplify(%) assuming conds; # Bah
evalf(eval(%, [alpha=1,beta=3/2]));

(1/8)/(beta^2*(alpha^2+beta^2)^(1/2))

0.3081667757e-1

int(another, s=0..infinity) assuming conds: simplify(%) assuming conds;
evalf(eval(%, [alpha=1,beta=3/2]));

-((1/8)*I)*Heaviside(beta-alpha)/((-alpha^2+beta^2)^(1/2)*beta^2)-(1/8)/(beta^2*(alpha^2-beta^2)^(1/2))+(1/8)*Heaviside(beta-alpha)/(beta^2*(alpha^2-beta^2)^(1/2))+(1/8)/(beta^2*(alpha^2+beta^2)^(1/2))

0.3081667757e-1-0.4969039948e-1*I

int(evalc(Re(newig)+Im(newig)*I), s=0..infinity) assuming conds;
simplify(%) assuming conds;
evalf(eval(%, [alpha=1,beta=3/2]));

(1/2)*2^(1/2)*Pi^(1/2)*(-((1/8)*I)*2^(1/2)*Heaviside(beta-alpha)/(Pi^(1/2)*(-alpha^2+beta^2)^(1/2)*beta^2)-(1/8)*2^(1/2)*Heaviside(-beta+alpha)/(Pi^(1/2)*(alpha^2-beta^2)^(1/2)*beta^2)+(1/8)*2^(1/2)/(Pi^(1/2)*(alpha^2+beta^2)^(1/2)*beta^2))

-((1/8)*I)*Heaviside(beta-alpha)/((-alpha^2+beta^2)^(1/2)*beta^2)-(1/8)/(beta^2*(alpha^2-beta^2)^(1/2))+(1/8)*Heaviside(beta-alpha)/(beta^2*(alpha^2-beta^2)^(1/2))+(1/8)/(beta^2*(alpha^2+beta^2)^(1/2))

0.3081667757e-1-0.4969039948e-1*I

 


Download IntcosBesselJ.mw

[edited] Somehow I missed the following simpler variant, in which after converting to the integrand `Bessel` the extra assumptions on the Bessel calls are not needed. (I wonder what I was doing that made me think it was needed above... likely I just got confused.)

restart;

kernelopts(version);

`Maple 2017.3, X86 64 LINUX, Sep 27 2017, Build ID 1265877`

integrand:=cos(alpha*s)*(1/8*I)*(-HankelH1(0, beta*s)-(2*I)*BesselK(0, beta*s)/Pi)/beta^2;

((1/8)*I)*cos(alpha*s)*(-HankelH1(0, beta*s)-(2*I)*BesselK(0, beta*s)/Pi)/beta^2

ans1:=int(convert(integrand,Bessel), s=0..infinity) assuming alpha>0, beta>0;

(1/2)*2^(1/2)*Pi^(1/2)*(-((1/8)*I)*2^(1/2)*Heaviside(beta-alpha)/(Pi^(1/2)*(-alpha^2+beta^2)^(1/2)*beta^2)-(1/8)*2^(1/2)*Heaviside(-beta+alpha)/(Pi^(1/2)*(alpha^2-beta^2)^(1/2)*beta^2)+(1/8)*2^(1/2)/(Pi^(1/2)*(alpha^2+beta^2)^(1/2)*beta^2))

ans2:=simplify(convert(ans1,piecewise,alpha)) assuming alpha>0, beta>0;;

ans2 := piecewise(alpha < beta, -(I*sqrt(alpha^2+beta^2)-sqrt(-alpha^2+beta^2))/(8*sqrt(alpha^2+beta^2)*beta^2*sqrt(-alpha^2+beta^2)), alpha = beta, ((undefined*sqrt(alpha^2+beta^2)*beta^2+sqrt(alpha^2-beta^2))*sqrt(-alpha^2+beta^2)+(undefined*I)*sqrt(alpha^2-beta^2)*sqrt(alpha^2+beta^2)*beta^2)/(8*sqrt(alpha^2-beta^2)*sqrt(-alpha^2+beta^2)*sqrt(alpha^2+beta^2)*beta^2), beta < alpha, (sqrt(alpha^2-beta^2)-sqrt(alpha^2+beta^2))/(8*sqrt(alpha^2+beta^2)*beta^2*sqrt(alpha^2-beta^2)))

evalf(eval([ans1,ans2,Int(integrand,s=0..infinity)], [alpha=1,beta=3/2]));

[0.3081667754e-1-0.4969039945e-1*I, 0.3081667754e-1-0.4969039949e-1*I, 0.3081667757e-1-0.4969039950e-1*I]

evalf(eval([ans1,ans2,Int(integrand,s=0..infinity)], [alpha=2,beta=3/2]));

[-0.1977383032e-1, -0.1977383033e-1, -0.1977383033e-1+0.6e-13*I]

plots:-display(
    plot3d([Re,Im](ans1),alpha=0..beta,beta=0..2, view=-1..1, color=[red,blue], grid=[600,50], style=surface),
    plot3d([Re,Im](ans1),alpha=beta..2,beta=0..2, view=-1..1, color=[red,blue], grid=[600,50], style=surface)
);

 


Download IntcosBesselJ_2.mw

The name Psi is the name of an assigned special function in Maple. Use another name. Eg,

restart;
with(PDEtools):

U := diff_table(PSI(`&psi;_2`, `&psi;_1`)):

pde := `&psi;_2`*(diff(PSI(`&psi;_2`,`&psi;_1`),`&psi;_1`))+`&psi;_1`*U[`&psi;_1`]+2*U[] = 0:

pdsolve(pde);

                                   _F1(&psi;_2)
          PSI(&psi;_2, &psi;_1) = --------------------
                                                    2
                                 (&psi;_1 + &psi;_2)

The most important thing that I suspect you might not have realized is that there is a huge difference between the typeset 2D Math ft as a unit (which gets pretty-printed in upright roman font) versus ft as a name (which gets pretty-printed in italics).

Before Maple 2017 units were typeset within double-brace fencing. In Maple 2017 the braces have gone, which is nice for some people but confusing for others.

There are three common ways to enter an actual unit:
1) Using the Units palette (in the left panel of the GUI). This always typesets it in upright roman, even for input.
2) Typing the keystrokes Unit, and then either typing in round-brackets to make that a function call, or using command-completion (Esc key, say) to turn such 2D Input into the brace-less upright roman font form.
3) Typing keyboard accelerations like Alt-shift-u (for Linux, but varies with platforms) to get into unit entry mode.

Attached below are a Worksheet with 1D Maple Notation and a Document with 2D Input (I used command-completion to enter all the units for the Document).

I've utilized the Units:-Simple package so that arithmetic operations done at the top-level combine units.

I've shown the combine(...,units) command which is the best way to combine units into the "base unit" for the final dimensions of a result.

I've used the Units:-UseUnit command to force the "base unit" for several different combinations of dimension (you may wish to augment this). I find this much superior to the right-click Units Formatting since the latter has to be done every time one wants a result in a preferred unit rather than the default unit for a given dimension.

units1.mw

units2.mw

I'll also mention that if you loaded the Units:-Natural package (instead of Units:-Standard or Units:-Simple) then you would be able to type in names and symbols of units without any extra work (palettes, Unit() command, keyboard acceleration, etc). That's how many Mathcad users are used to doing things. The problem with that scheme in Maple is that things get just too awkward with such a huge number of single-letter names being effectively removed from one's global namespace. Almost nobody uses Units:-Natural . (I consider it unworkable, and wish it would go away...) If you do  not load this subpackage then you cannot simply type a name like `feet` and have Maple interpret it as a unit, but instead you need to use 1), 2), or 3) above (or cut & paste from some actual unit).

First 190 191 192 193 194 195 196 Last Page 192 of 336