Joe Riel

9530 Reputation

23 Badges

20 years, 23 days

MaplePrimes Activity


These are answers submitted by Joe Riel

The Maple assignment operator is two-characters:

  Dmax := 0;

Change the equations that are supposed to be assignments. Also, I don't know what D.i is supposed to represent, but that cannot be on the lhs of an assignment. Maybe you are trying to create a table of values, in which case you'd use D[i],except that D is protected (it corresponds to a differential operator), so use d[i].

@mostafaorooji One approach is to to use LargeExpressions:-Veil:

with(LargeExpressions):
subsindets(ans, specfunc(exp), Veil[Z]);
              w(x) = _C1*Z[1]+_C2*Z[2]+_C3*Z[3]+_C4*Z[4]

Check the help for LargeExpressions.

{ op(s1), op(s2), ... }

It seems like you just want to count in base 3.  This could be down with MixedRadixTuples in the Iterator package:

with(Iterator):
C := MixedRadixTuples([3,3,3]):
S := [l,m,h]:
seq([NULL
     , cat(CPC_, S[c[1]+1])
     , cat(SIZE_,S[c[2]+1])
     , cat(SH_,  S[c[3]+1])
    ], c in C);

Am thinking it is asking whether you want to upgrade your 2018.1 to 2018.2, which has been recently released.

See the help page OpenMaple,C,callBackCallBack.  Then look at the source code for the example mentioned there (callBackCallBack.c); it uses a Maple-side call to callback to call the callBackCallBack C function. Basically, the purpose of callback is to invoke the user's callBackCallBack function.  

The callback function is not something you would ever call interactively from Maple.  Rather it would be called by Maple code that is being executed by an external program using OpenMaple to interact with the Maple engine. It isn't formally documented because its arguments and effect are completely determined by the callBackCallBack function, something the user defines.

How 'bout

    ModuleApply:= proc({a :: algebraic := KandR:-a,
                        b :: algebraic := KandR:-b,
                        c :: algebraic := KandR:-c,
                        e :: algebraic := KandR:-e
                       }, $)
    local opt;
        for opt in _passed do
            thismodule[lhs(opt)] := rhs(opt);
        end do;
      return NULL;
   end proc;

That is a demo of the Intermediate Axis Theorem, which can be readily modeled using MapleSim, see IAT.msim.  MapleSim uses Maple as the engine. While it is possible to extract the Maple equations that are generated, for this example they are not particularly enlightening and too large to post here.

Internally, Maple reduces the first, (x^2 + y^2 = 1)^2, to x^2 + y^2 - 1.  It doesn't modify the second, (x^2 + y^2 -1)^2 , and solving that is considerably more difficult for a numerical solver as the expression never crosses zero.

This is explained in the help page worksheet,documenting,styles.  Here's a summary

Click Format > Styles and then modify the character styles appropriately.

Click Format > Manage Style Sets and then Export your style set.  After doing so, click User-defined Style Set radio button and select the mw file to which you exported the style.  Click OK and it should then be used as the style set for new worksheets.

You have to use the tensor product to create the metric, and use, say, dtheta, to refer to the base one-form, not d(theta).

  g1 := evalDG(dr &t dr + r^2*dtheta &t dtheta);

There is a minor issue with calling rand directly in your dice procedure; each call generates a separate procedure. Doing so is more expensive than necessary.  It also isn't clear how this affects the random sequence obtained. Here's an approach that uses an appliable module to ensure that rand is only called one time.

dice := module()
local ModuleApply, ModuleLoad, die;
    ModuleLoad := proc()
        die := rand(1..6);
    end proc:
    ModuleApply := proc()
        (die(), die());
    end proc:
    ModuleLoad(); # needed because this module isn't being loaded from a library
end module:
seq([dice()], 1..4);
    [5, 2], [5, 6], [2, 3], [4, 4]

Note that the ModuleLoad isn't needed here, rather die could be directly assigned rand(1..6) in the module body, however, if this were being written to a Maple archive (library) it would probably be better to delay the assignment to when the module is loaded, versus when it is assigned.

Another possibility is to use select:

L1 := [[1],[2]]:
L2 := [[3],[1]]:                                                                                                                                                                                    L2 := [[3],[1]]:
select(member, L1, L2);
                          [[1]];

Note that the handling of repeated items is problematic, both with this and the set approach.

While there is nothing wrong with using a Vector, another approach is to use a list. For example

iterativepower := proc(base, index, n :: nonnegint)
local k;
  [seq(base^(index^k), k=0..n)];
end proc:

Unless you're interested in the discrete steps, it might be better to look at base^p, as p increases. This can be easily plotted, here with base=1+I:

plots:-complexplot((1+I)^p, p=0..25);

Before using subsindets or evalindets, it's usually a good idea to call indets to see what expressions are being operated on. Thus

x := u(i, j)^2*v(i, j)+u(i-1, j):
E := indets(x, 'specfunc(symbol, u)');         # --> {u(i, j)}
F := indets(x, 'specfunc(`+`, u)');            # --> {}
G := indets(x, 'specfunc({`+`, symbol}, u)');  # --> {u(i, j), u(i - 1, j)}

That makes sense to me (see Carl's comments for details). A variation of this is to use an unassigned symbol for the applied function in the call to subsindets:

subsindets(x, 'specfunc(symbol, u)', Z);
      Z(u(i,j))^2*v(i,j)+u(i-1,j)
First 15 16 17 18 19 20 21 Last Page 17 of 114