Joe Riel

9660 Reputation

23 Badges

20 years, 4 days

MaplePrimes Activity


These are answers submitted by Joe Riel

These ideas are useful, thanks.  Anyone know where Maple's configuration file exists on a Windows installation?  I don't use Windows enough to recall.  On linux, it typically is at ~/.maple/15/maplerc, with 15 being replaced by the major release. How 'bout on a Mac? 

There is an extra opening parenthesis to the left of Ts(t).

That's the basic idea. Thanks. The problem with that is that it requires specific knowledge of the browser executable.  I'd like to be access the browser from Maple with code that works on various platforms. I suppose one way to do this is to extract the executable information from Maple's configuration file. That's a bit kludgy, but doable, however, that only handles part of the problem.  What I'd really like to do is simply call a command, say, DisplayInBrowser("some url"), and the configured browser would open with the contents of "some url" displayed. The GUI already has this ability, what is missing is an API accessible to the user.

One way to do this is to connect an ideal rolling wheel (1-D Mechanical --> Rotational --> Common --> Ideal Rolling Wheel) to the output, set the radius of the wheel to whatever is appropriate, then attach a probe to the hub.  MapleSim currently doesn't output units; the plots are scaled in the standard SI units (velocity is in meters/second).  One way to scale the plot is to multiply the radius of the wheel by 1000.

Given that the Ackermann function will rapidly consume all of Maple's stack space, the following might be instructive.  Note the use of the forward quotes (and ?procname) to prevent full evaluation.

A := proc(m,n)
    if m=0 then 'procname'(args)
    elif n=0 then procname(m-1,1);
    else
        'procname'(m-1,procname(m,n-1));
    end if
end proc:

A(4,10);
       A(3, A(3, A(3, A(3, A(3, A(3, A(3, A(3, A(2, A(1, A(0, A(0, 1))))))))))))))

Note that ?mul acts analogously to ?add; you may or may not want to replace the ?product with ?mul. To see the difference, try Robert's routine with, say, F(a,-1).

 

plot3d(x^2+y^2+2*x, x = 0 .. 3, y = piecewise(x<2,sqrt(4-x^2),0) .. sqrt(9-x^2);

You can use the MathML notation when defining aliases.  For example,

alias(`#msup(mi("y"),mi("*"))` = ystar):

That  creates the symbol with the star in the exponent slot.

Also, there is another facility, ?macro, for achieving almost the same thing. The order of the defining equation is reversed:

macro(ystar = `#msup(mi("y"),mi("*"))`):

In some ways macro makes more sense here, where you are creating a shortcut for entering a name.

The drawback with either technique is that they don't expand during input. Because I normally use Maple input that isn't an issue, however, if you are using 2D input it would be nice if the pretty-printed form appeared while typing, that is, as an actual shortcut.

The following does what you want. The technique is to declare the parameters as ?uneval, and then evaluate them inside the body of the procedure.

f := proc(A::uneval, B::uneval)
local a,b,La,Lb;
    a := convert(A,string);
    b := convert(B,string);
    La := eval(A);
    Lb := eval(B);
    return a = La, b = Lb;
end proc:

A1 := [1,2]:
B1 := [3,4]:

f(A1,B1);
                         "A1" = [1, 2], "B1" = [3, 4]

 

It isn't apparent that a symbolic solution can be found; the equations correspond to a set of quartic polynomials.

You can always use backquotes (also known as left single quotes) to form a Maple ?name from non-alphabetic characters:

`Y*` := whatever;

You could manually restructure the sum:

H:=proc(y,a,b) local z;
    z := piecewise((y>0), a,b);
    z + y;
end proc:
prep2trans(H);
proc(y, a, b)
local z;
    z := (if 0 < y then a else b end if); z + y
end proc

As Acer points out, op(0,.) is the way to go. One might imagine that ?unapply could be used here.  That is, 

unapply(f(x),x);
                                    x -> f(x)

could return f, rather than a procedure.  Just thinking

Note that eval isn't doing anything special here, other than substituting and evaluating an expression.  In the first case, g(u) becomes proc() ll end(u), which evaluates to ll.  In the second, g(u) becomes ll(u), and unless ll is assigned a procedure, it returns unevaluated.

 

Maple doesn't normally return x*x. One way that can happen is if one of the x's is an escaped local.  For example,

x * proc() local x; x; end proc();
                                 x*x

You might run the output through indets and see if the variables are independent:

indets(%);
                     {x, x}

That's a pretty good sign that that is what has happened.

First 48 49 50 51 52 53 54 Last Page 50 of 114