## 7727 Reputation

14 years, 143 days

## cat...

@Carl Love Be aware that || is discouraged (says so right in the help page).  Use cat instead. Also note that the ranges work with character symbols:

cat(x, a..e);
xa, xb, xc, xd, xe


## Inert forms...

@torabi As I mentioned in my first response, use the inert integral form (replace int with Int).  There is no way that that integral can be symbolically evaluated, so why make Maple attempt to do so? The summations can be evaluated (expanded) iff you supply the integer limits.

## rank...

@Carl Love I think the original version of Iterator is still in the Maple Applications Center, however, I don't believe it has the Rank/Unrank functionality, that was added later. If it did it would work slightly differently as originally I had the rank starting at 0 (it was changed for compatibilty with equivalent functions in the combinat package).  If the OP wants to roll his own, the algorithms came from Knuth's Art of Computer Programming, volume 3, section 5.1.1; also see exercise 7 in that section.

There is an unrankperm procedure in combinat that can probably be used here.

## type/linear...

@MDD The type/linear can be used, however, there are some corner cases you may have to handle separately.  Consider

type(a*x + b, linear([x]));  # --> true
type(0*x + b, linear([x]));  # --> false


If missing variables isn't an issue, then you could do something like

L := [a*x + b*y + c, 3*x + y]:
andmap(type, L, linear([x,y])); # --> true


If you want to consider, say, 3 to be linear in x, then you could do something like

vars := [x,y]:
andmap(type, L, Or(freeof(vars),linear(vars)));


That returns true if all expressions in L are either linear in the given variables, or has none of the variables.

## Uniform...

@vv To get a uniform distribution of unitary matrices, I think you need to use a normal distribution for the generator.  Say

with(Statistics): With(LinearAlgebra):
n := 2:
Dist := Normal(0,1):
S := Sample(Dist,[n,n]) + I*Sample(Dist,[n,n]):
U := Matrix(GramSchmidt([seq(S[..,k],k=1..n)],'normalized','conjugate'):


## Workaround...

@Carl Love Here's a hackish way to remove the first statement from latex/int:

latex/int := FromInert(subsindets(ToInert(eval(latex/int)), 'specfunc(_Inert_STATSEQ)', f -> op(0,f)(op(2..,f)))):
latex(Int(x,y,z,a,b,c));
\int x\,{\rm d}y


## SMT...

@Rouben Rostamian  There are SMT-solvers (satisfiability modulo theories) that should be able to handle that, however, Satisfy is a pure SAT-solver, so unless there is a clever way to easily express the inequalities in terms of logic, it won't be useful here.

## Help...

@rquirt The help for the ports (click the help icon on the Configuration header, and then the Ports header) just mentions that the name of a custom port has to be entered.  It really should also mention that the fully qualified name can be used for any port defined in an accessible Modelica library.  I'll add that to the description.

## MapleSAT...

@tomleslie In 2018 Satisfy was upgraded to use MapleSAT (naturally), an external SAT-solver based, at least originally, on miniSAT. This has made it significantly more effective.  I agree, the examples on the Satisfy help page don't give one the impression that it can do much.

## Errata...

Just noticed that the given solution contains no 1 or 2 and 2 81's  Must have missed a necessary condition.  Will investigate tomorrow.

Follow up The fix was to add a rule requiring that the number 1 appears on some cell.

   one := &or(seq(seq(x[i,j,1], i=1..n), j=1..n)):


The adjacency rule than ensures that all other numbers appear.  I uploaded the corrected worksheet but left the post alone.

Later Realized that the actual error was in the formulation of allvals. The simple fix was to remove it completely, with the one rule it (or the corrected version) is not needed.  Uploaded a new mw file.

## bug...

@Carl Love Yes, I started to reply to the OP, then noted the bug.  Have a fix for it, but that won't help now.

## no solution...

@Carl Love Alas, that doesn't give a solution, at least not with the defining boundary and initial conditions:

eq1 := diff(u1(x, t), x, x) = k1*(diff(u1(x, t), t));
eq2 := diff(u2(x, t), x, x) = k2*(diff(u2(x, t), t));
bc1 := u1(0, t) = v1;
bc12 := u1(L,t) = u2(L,t), k1*D[1](u1)(L,t) = k2*D[1](u2)(L,t);
bc2 := u2(2*L, t) = v2;
ic1 := u1(x,0) = 0;
ic2 := u2(x,0) = 0;

sys := {eq1,eq2,bc1,bc2,bc12,ic1,ic2}:
sysnum := subs({L = 10, v1 = 20, v2 = 10, k1 = 10, k2 = 20}, sys);
sol := pdsolve(sysnum, [u1,u2](x,t) );


I don't use pdsolve enough to know whether that should work, but it can handle the simpler

pdsolve({eq1,bc1,u1(L,t)=v2,ic1},[u1](x,t));


Note that bc1 and bc2 conflict with ic1 and ic2 at x=0 and x=2*L, however, I assume that isn't a problem; it wasn't for the simpler case.

## on macro...

@Christopher2222 The Maple macro command isn't all that useful for its intended purpose, which, as mentioned in the first sentence of the help page, is to be "a simple abbreviation facility to be used when writing Maple functions and library code."  While it may have been used for that many releases ago, when Maple library procedures were table-based and hence globally assigned, the transition to modules makes it almost pointless.  The reason is that the call to macro must be at the global level; that doesn't work well when the source for a procedure in which you want to define and use a macro is located in a separate file that is at a lower part of module hierarchy. Maple's preprocessor macros are better suited for this purpose as they can be locally defined and undefined.

## globals...

@Christopher2222 Converting to a string and parsing is going to ensure the names are globals.

## Security Settings...

While you should first try with the correct format, it is possible that the Maple server has been configured to restrict the ability to write to external files.

 1 2 3 4 5 6 7 Last Page 2 of 178
﻿