Joe Riel

7767 Reputation

22 Badges

14 years, 215 days

MaplePrimes Activity


These are answers submitted by Joe Riel

In html input mode, use &lt; and &gt; to input < and >, respectively. For an ampersand, use &

Just add the independent variables as arguments to a function call: y1(u1,u2), y2(u1,u2). A slightly nicer way to do this is to use the alias command (see ?alias for details): alias(y1=y1(u1,u2), y2=y2(u1,u2) ): J := (y1-y10)^2+(y2-Y20)^2+k*(u1)^2+k*(u2)^2: diff(J,u1); 2*(y1-y10)*(diff(y1, u1))+2*(y2-Y20)*(diff(y2, u1))+2*k*u1
Use the frontend command; it freezes various subexpressions.
z := a*f(x)+b*g(y)+c*x+d*y:
frontend(diff, [z,f(x)]);
                     a
frontend(diff, [z, x]);
                     c
The arguments of an unevaluated function call, which is what your exp(I*theta) is, can be extracted, as an expression sequence, using the op command:
op(exp(I*theta));
            exp*theta
Use op with an integer to extract a particular argument:
op(2, f(a,b,c));
                 b
Be aware that the Maple structure array has been largely superceded by Array. A simple procedure that does generates an Array, indexed from 0 to n and initialized with corresponding values 0 to n, is
MyArray := proc(n::nonnegint) Array(0..n, [seq(0..n)] ) end proc:
If you want to start the indexing from 1, you might use a Vector, which is, more or less, a one-dimensional Array with an index that starts from unity:
MyVector := proc(n::nonnegint) Vector([seq(0..n)]) end proc:
The problem is with the formal parameters. Indexed variables (the subscripted variables) don't work as formal parameters. Nor does the imaginary unit (by default `I'). It is, by the way, an appropriate place to ask.
For a few ideas, possibly not relevant to your application, you might look at a package I created quite a while ago, called manifold. It's written for Maple V R4, so is quite dated and rather crude. However, the documentation isn't too bad (there is a postscript of the typeset source code). It isn't limited to three dimensions and can integrate forms over manifolds. I don't have a local copy, but it is available here.
To generate all permutations, do
> with(combinat):
> perms := permute([1$9,2$9,3$9],9): # you don't want to print them
> perms[1];
         [1, 1, 1, 1, 1, 1, 1, 1, 1]
> perms[234];
         [1, 1, 1, 1, 3, 3, 2, 3, 3]
> perms[-1]; # last one
         [3, 3, 3, 3, 3, 3, 3, 3, 3]
To just count the number of permutations, you can do
> numbperm([1$9,2$9,3$9],9);
                19683
How long did you wait? Does your loop do anything? On my machine:
convert(90*time(proc() to 10^7 do od end())*Unit(sec), units, Unit(minute));
           4.528500000*Unit(min)
Maple V R5 is old; I don't have a version that runs on Linux, so can only give some hints. First, read the file as one long text string. One way is to read each line and catenate:
fd := fopen(filename);
input := "";
line := readline(fd);
while line <> 0 do
   input := cat(input,line);
   line := readline(fd);
od;
fclose(filename);
Now you need to convert `input' to a set of sets of characters. In Maple 10 this can be readily accomplished with
use StringTools in
  RegSplit("[^a-zA-Z]", input);
  map(str -> {op}(Explode(str)),{%});
  remove(`=`,%,{});
  map(curry(map,parse),%);
end use;
With Maple V you have some work to do. You'll need to use the substring command to access each character, then determine whether to convert it to a name (via parse) or to split the string and start a new set. I don't recall whether Maple V has any regular expression matching, I think not. So you might designate just a few characters as `splitters' (comma, space, newline) and check for those individually.
I've always used rpn (first was my dad's HP-35) and struggle with algebraic entry. I've owned an HP-15 since they came on the market (early 80s). About six years ago there was a version of Maple that ran on a handheld device, a Casioppia, I believe. I got to use it for a few months. It proved useful when I was consulting and didn't have a laptop (still don't).
Use the print command. If a copyright is included in the options statetement, you will also need to set interface(verboseproc=2), otherwise, in the gui it is displayed as proc() ... end proc.
interface(verboseproc=2):
print(simplify);
Try the following
i := diff(q(t),t);
KirchoffLaw:=E[R]+E[L]+E[C]-E[emf]=0;
E[R]:=R*i;
E[L]:=L*diff(i,t);
E[C]:=1/C*q(t);
KirchoffLaw;
et := convert(piecewise(t<1,0,t<3,100,0),Heaviside);
odeQ := eval( KirchoffLaw, {E[emf]=et,R=50,C=0.01,L=1});
ics:=q(0)=0, D(q)(0)=0;
dsolve({odeQ,ics},q(t));
Check out the VectorCalculus package (?VectorCalculus). The ?examples,VectorCalculus worksheet gives examples of line integrals.
In the Standard GUI you can create symbols with arrows over them. Open the Layout palette, insert the Symbol with the `b' over the `A', then open the Arrows palette and change the `b' to the desired arrow shape. If you use lprint to print the Maple output, you can see how to create this via typing. The code inserted by the palettes contains optional fields to set the colors. If you are happy with the defaults you can omit them and then do, for example:
xvec := `#mover(mi("x"),mo("&rarr;"))`;
That displays xvec as an x with a right pointing arrow on top. Now, if you actually want to assign a Vector to the fancy x, things get a little tricker. Messing with the palettes gets tedius, so, you could set an alias (see ?alias for details). Using worksheet mode in the Standard GUI you could do
restart:
alias(`#mover(mi("x"),mo("&→"))` = xvec):
If you then type
xvec := <1,2,3,4>;
an assignment is displayed with the left side being the x with the arrow over it, the right side being the Vector. This can also be done in Document mode, but because the left side of assignments are normally suppressed, the x with an → over it is not shown, so there isn't much point. To simplify the process you can assign a procedure
MakeVector := x ->  nprintf("#mover(mi(\"%A\"),mo(\"&rarr;\"))", x):
then use it as
alias(MakeVector(x) = xvec, MakeVector(y) = yvec):
xvec := <1,2,3>;
yvec := <4,5,6>;
First 96 97 98 99 100 101 Page 98 of 101