Joe Riel

8338 Reputation

22 Badges

15 years, 326 days

MaplePrimes Activity

These are answers submitted by Joe Riel

It's a standard ascii source file. Such files are not typically "opened" in Maple. Rather they are edited with a text editor and either read into Maple,

   read "";

or loaded into a Maple archive (.mla file) which is then accessed in various ways.

A long time ago I wrote a package for doing that and related stuff, such as generating a type cover for a set of expressions.  For the most part it isn't particularly useful. I haven't kept it current (with newer types).  Here's what it does with 4 (your example):

  {MVIndex, algfun, algnum, atomic, complex, even, finite, integer, literal, numeric, polynom, posint, radfun, radnum, ratpoly, scalar, type, algebraic, anything, appliable, complexcons, constant, embedded_axis, embedded_real, expanded, filedesc, monomial, nonnegative, nonnegint, operator, positive, property, radalgfun, radalgnum, rational, realcons, verification, extended_numeric, extended_rational}

   {`+`, algfun, linear, polynom, radfun, ratpoly, scalar, algebraic, anything, appliable, expanded, radalgfun}

    {list, anything, appliable, indexable, sequential}

Guessing at what you want, here's one approach, a bit crude.

T := table([2=3,3=2,5=6,6=5,7=9,9=7]): # define given transformations of second index
map(proc(x) local y := T[op(2,x)]; if y :: integer then B[op(1,x),y] else x end if; end proc, varA);
[A[1, 0], A[1, 1], B[1, 3], B[1, 2], A[1, 4], B[1, 6], B[1, 5], B[1, 9], A[1, 8], B[1, 7], A[2, 0], A[2, 1], B[2, 3], B[2, 2], A[2, 4], B[2, 6], B[2, 5], B[2, 9], A[2, 8], B[2, 7], A[3, 0], A[3, 1], B[3, 3], B[3, 2], A[3, 4], B[3, 6], B[3, 5], B[3, 9], A[3, 8], B[3, 7]]

I cannot say I've ever depended on using the interrupt button. A better choice might be to use an embedded component toggle button then have the loop query it each time.  Something like

      finish := evalb(DocumentTools:-GetProperty("ToggleButton0","value") = "true");
      if finish then
         # assign something
         # assign something else
      end if;
   end do:

The usual way is

initeqs := [seq(S[i] - a[i-1] = 0, i=1..n)];

however, that assumes the constant ai is indexed rather than an inert symbol constructed via a__i. The latter can be generated with cat

initeqs := [seq(S[i] - cat(a__,i) = 0 i=1..n)];

Your notation is incorrect.  What you want is diff(T,d).

Just remove the list from fibs.  Using a list (or set) causes subs to do a simultaneous substition.  In this case you don't want that because e expands to an expression in terms of c and d, so you need to first substitute for e, then for d, then for c.  So use

fibs := ( e = c + d,  d = b + c, c = a + b ):  # changed brackets to parentheses

There is a package, UTF8, on MapleCloud (coincidentally written by myself), that will compute the length of the string treating multi-byte characters as single characters.

s := "décember"):
S := UTF8(s):

The problem is the loop.  Because you are terminating it with a semicolon, the assignment to Y is being sent to the print stream; you can see this by commenting out the writeto statements. Because this is being run in the GUI the output is converted to typesetting stuff. To turn that off, just terminate the loop with a colon, that will suppress the undesired output.

Another approach is to use complex values. For example

unit := x -> x/abs(x):
road := t + I*(t^3+2*t^2):
edge := road + unit(diff(road,t))*I:
plots:-complexplot([road,edge], t=-3..2, constrained);

The third and fourth arguments to BinarySearch are optional.  If you do supply them, they must correspond to strict less than and equals, respectively.  These would only be supplied if needed, for example, if the elements in the list required a special test. In your case, because the elements are numeric, just use the defaults:

L := [2,3,4,5]:
ListTools:-BinarySearch(L,3); # --> 2

It returns the position (index from 1) of the element in the list. That is, op(2,L) = 3.

For labels you can use html.  For example, change the caption to


About the simplest solution is

rangetolist := rng-> [seq(rng)]:

Adding a type declaration to the formal argument

rangetolist := (rng::range) -> [seq(rng)]:

A somewhat more restrictive type declaration

rangetolist := (rng::(integer..integer)) -> [seq(rng)]:

To handle a range that may decrease

rangetolist := (rng::(integer..integer)) -> [seq(rng,-sign(`-`(op(rng))))]:

Haven't actually tested these...

Another approach

subsindets(A, specfunc(v), f -> subs(t=tau,f));

For fans of minimalism,

subsindets(A, specfunc(v), eval, t=tau);

An alternative, to avoid using an indexed name, is the following (entered as 1D Maple input):


Because typing such variables is time-consuming, I'd consider defining macros or aliases for them. For example

macro(fab = `f__&alpha;,&beta;`):
fab/(1 + fab);
         fα,β/(1 + fα,β)
3 4 5 6 7 8 9 Last Page 5 of 106