Robert Israel

6577 Reputation

21 Badges

18 years, 209 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are answers submitted by Robert Israel

> fullCombine(2*sin(t)+sqrt(3)*cos(t));
2*sin(t)+cos(t)*3^(1/2) It works better, I think, if you include trig as a second argument to combine in pairCombine.
The first set of parametric equations only involves one parameter t. Is that supposed to be a curve or a surface? If it's a curve (actually a straight line), use spacecurve in the plots package. To combine the two plots, use display, also in the plots package. Thus:
> with(plots):
  display([
    spacecurve([1-2*t, -t, 3+t, t=-20..20], colour=red),
    plot3d([5+3*s-4*t, 7-5*s-5*t, -2-s+6*t], s = -5 .. 5, 
        t = -5 .. 5, style=patchnogrid)],
    axes = box, scaling = constrained);
I don't think there's a very easy way to do this, but here's one way. This should take any sum of constant coefficients times sines and cosines and combine the compatible sines and cosines.
> cosify1:= proc(T)
  local p,R,a,x;
  if patmatch(T,a::constant*exp(x::algebraic),R) then
    p := convert(subs(R,a), polar);
    convert(op(1,p)*exp(I*op(2,p)+subs(R,x)), trig)
  else convert(T,trig)
  end if
 end proc;
 cosify2:= proc (T) 
  local x; 
  x := expand(op(T)); 
  if type(x,`+`) then convert(map(exp,convert(x,list)),`*`) 
  else exp(x) 
  end if 
 end proc;
 cosify:= proc(X)
  local X1, exps;    
   X1:= evalindets(expand(convert(X,exp),exp),
           specfunc(anything,exp),cosify2);
   exps:= indets(X1, specfunc(Non(constant),exp));
   simplify(map(cosify1,collect(X1,exps)));
 end proc;
Then:
> cosify(1/2*cos(t)-sqrt(3)/2*sin(t));
cos(1/3*Pi+t) Or for a more complicated example:
> cosify(3*sin(t)+1/2*cos(t-Pi/6)-sqrt(3)/2*sin(t+Pi/4));
-1/4*(184-6*2^(1/2)-26*3^(1/2)*2^(1/2))^(1/2)*cos(-arctan(1/3*(-13+3^(1/2)*2^(1/2))*3^(1/2)/(2^(1/2)-1))+t)
You're using the old, deprecated, linalg package rather than the newer LinearAlgebra package. There's no linalg[Matrix], you must mean linalg[matrix]; the top-level Matrix command constructs a Matrix structure, used by the LinearAlgebra package, while linalg[matrix] constructs the matrix structure used by the linalg package. The following code takes the integers i and j and finds the determinant of the matrix
[ X    Y    1 ]
[ x[i] y[i] 1 ]
[ x[j] y[j] 1 ]
using the linalg package:
> f:= (i,j) -> linalg[det](linalg[matrix](3,3,
         [X,Y,1,x[i],y[i],1,x[j],y[j],1]));
A version using the LinearAlgebra package would be
> F:= (i,j) -> LinearAlgebra[Determinant](Matrix(3,3,
         [X,Y,1,x[i],y[i],1,x[j],y[j],1]));
Both of these assume that X, Y, x and y are global names. If you want these names to be local variables of another procedure, you must either define f or F within that procedure (so that lexical scoping will apply) or include those names as parameters of f or F.
According to the help page ?Units,Standard:
If an input has only one unit, the output uses that unit. If an input has more than one unit, the output is automatically converted to the default unit in the current system of units. The default system of units in the Units package is SI. To change the default system of units, use the UseSystem command.
I'm a bit surprised to see that this happens without loading the Units package: the help page for Unit doesn't even mention that (since Maple 10) Unit is a top-level command, rather than just in the Units package. Anyway, if you want to use the foot-pound-second system of units, try
> Units[UseSystem](FPS):
  with(Units[Standard]):
It depends on the situation. Do you want the least upper bound and greatest lower bound, or would any bounds be sufficient? In some cases maximize and minimize will work.
For example:
> plot(x, x = 0 .. 3600, tickmarks=[[0=3500, 3500=0],default],
    axes = box);
A more flexible way might be to use a Maplet, and have the information shown to the user within the Maplet (say in a TextBox or MathMLViewer).
One thing you can do is use alias. For example (assuming it's the Standard GUI in a recent version of Maple)
> alias(`#msub(m1("x"),mn("1"))`=x1);
This `#msub(m1("x"),mn("1"))` comes from using the palette in 2D Math input mode. And then any x1 in your input becomes what looks like x[1] (but is actually a symbol rather than a table reference). There is also the `print/f` facility for functions. And some things can be done with the Typesetting package.
1. What does L mean? Linear span? If so, the null space of the matrix with those vectors as rows might be useful to you... 2. If A is a diagonal matrix, what is A^n?
To expand, you use expand. But what would you expect to be the result of this expansion?
> expand((ln(1+x))^2);
ln(1+x)^2 That's the same as the original expression: there is no useful expansion in this case. For partial derivatives, use diff. For example,
> diff(x*y^2, y);
2*x*y
This should be no problem: you just use coords=spherical. Here it is using a sample of data for the surface r = sin(phi)^2 you mentioned.
 
> pts:= [seq]([seq]([sin(phi)^2,theta, phi], 
        theta = evalf(Pi/20)*[$0..40]), 
        phi = evalf(Pi/20)*[$0..20]):
  plots[surfdata](pts, coords=spherical, style=wireframeopaque, 
      scaling=constrained, colour=black);
The output of BSplineCurve is in parametric form [x(t), y(t), t=a..b]. If by "integrate the output" you mean you want int(y,x=x[a]..x[b]), that would be int(y(t)*`x'`(t),t=a..b) Thus:
> C:= BSplineCurve(..., t);
  int(C[2]*diff(C[1],t), C[3]);
Do you mean something like this?
 
> f:= (a,b,c) -> 1+b/a*c:
  pts:= [seq(seq(seq([10*A,10*B,5*C],C=0..6),A=B..12),
     B=3..12)]:
  fvals:= map(f @ op, pts):
  fmax:= max(op(fvals)): fmin:= min(op(fvals)):
  colors:= map(t -> COLOR(RGB,(t-fmin)/(fmax-fmin),0,1-(t-fmin)/(fmax-fmin)), 
    fvals):
  pointplot3d(pts,color=colors,axes=box,labels=[x,y,z]);
Note: this does not work in Classic, due to a bug.
> `type/octonionicscalar`:= proc(t)
      local e;
      e:= [e1,e2,e3,e4,e5,e6,e7];
      type(t, polynom(algebraic,e)) and degree(t,e) <= 1;
  end proc:
  map(type, [expr1,expr2,expr3,expr4,expr5,expr6],
      octonionicscalar);
[true, true, true, true, false, false]
First 123 124 125 126 127 128 129 Last Page 125 of 138