Preben Alsholm

13471 Reputation

22 Badges

20 years, 249 days

MaplePrimes Activity


These are answers submitted by Preben Alsholm

with(LinearAlgebra):
L,S:=3,4:
V:=Matrix(L,S,symbol=v);
W:=Matrix(L,S,symbol=w);
X:=Matrix(L,S,symbol=x);
Y:=Matrix(L,S,symbol=y);
seq(Transpose(V)[i].W[1..,i]<=Transpose(X)[i].Y[1..,i],i=1..S);

I have used LinearAlgebra:-Transpose to avoid the complex conjugation which is used in V[1.., i].W[1.., i]

 

You cannot prevent A1 in A1*A2 fom being multiplied onto each element of A2, but you could use any operator of the form &anything, e.g. the obvious idea &* like this A:=A1&*A2;

eval(A,`&*`=`*`);

will give you back the original A.

&* was (is) used for a product of matrices of the old structure 'matrix' (lower case m), but that is irrelevant in this context.

ODE1 should be ode1.

Conditions like f ' (0) = 0 should be written D(f)(0)=0.

There are not enough requirements in ics for a numerical solution.

Something like the following might work.

ExpandSum:=proc(A)
    if not hastype(A,specfunc(anything,{Sum,sum})) then return A end if;
    if not type(A,specfunc(anything,{Sum,sum})) then
      evalindets(A,specfunc(anything,{Sum,sum}),procname,_rest)
    elif type(op(1,A),`+`) then
      map(op(0,A),op(A))
    else
      expand(A,_rest)
    end if
end proc;

S:=Sum(c*a[i]+d*b[i],i=1..n);

ExpandSum(S);

#It prioritizes sums over products, so if constants have to be expanded too, then

ExpandSum(%);  #or just expand(%);

Here is a way that works under the assumption that the summand is of type `+`.

map(op(0,ans),op(ans));
isolate(%=0,op(1,%));

It seems that occasionally something similar to IntegrationTools:-Expand could be useful.

The problem is that you declare U, S, and Vt local, and that SingularValues expects the global names.

So change the local names to U1, S1, and Vt1, but keep the global U, S, and Vt in SingularValues.

I just tried Tools/Options/General/Browser

There you can select a "browser" which does absolutely nothing, provided you create an entirely empty file with an .exe extension, e.g. do_nothing.exe.

That will of course give you problems if you need a browser in Maple for another purpose.

But you are right, these hyperlinked error messages are at the moment rarely useful as far as the hyperlinking is concerned.

I wouldn't want the error messages to disappear of course.

(Added: The Maple Cloud and export to html are unaffected by the change to a do_nothing browser.)

Is collect what you need?

u:=(x+k-n+5)*(x-3*k+n^2+2);
collect(u,k);
collect(u,[k,n]);
collect(u,[k,n],distributed);

How about

ExtractRadicands:=proc(u::algebraic,{[roots,root]::{fraction,{list,set}(fraction),identical('all')}:='all' }) local r,R;
  R:=map([op],indets(u,`^` ));
  if type(roots,fraction) then r:={roots} elif roots<>'all' then r:=convert(roots,set) end if;
  if roots='all' then R else select(x->member(op(2,x),r),R) end if
end proc;

The output is a set of lists of the form [radicand, power]

Examples:

q:=1+2*sqrt(x+1)+1/sqrt(y^2+98)+89^(-1/3)+t^(5/7);
ExtractRadicands(q);
ExtractRadicands(q,roots=1/2);
ExtractRadicands(q,roots=2/3);
ExtractRadicands(q,roots=[-1/2,1/3]);
ExtractRadicands(q,roots=[-1/2,1/3,1/7]);
ExtractRadicands(q,roots=1/7);
g := 1+2*sqrt(x+sqrt(7));
ExtractRadicands(g);
ExtractRadicands(1/sqrt(1+x));

I didn't write a procedure, but that should be easy to do by using the following examples:

u:=1+2*sqrt(x+1);
indets(u,algebraic^(1/2));
op(map2(op,1,%));
w:=1+2*sqrt(x+1)+1/sqrt(y^2+98);
indets(w,{algebraic^(1/2),algebraic^(-1/2)});
op(map2(op,1,%));

I have to guess at your intention (see my comment to your question). Supposing you meant

equ2 := (w*.87)*(1-(1/x)^.2385)-(288*(x^.3174-1))/(.85);

Then you could do

seq(fsolve(equ2=0,x=1..10),w=[600,700,800,900]);

#An illustration

plots:-animate(plot,[equ2,x=0..10,-5..1],w=600..900);

I noticed that you already answered your question yourself by replacing sum by add, which is the better idea.

However, sum can be used like this:

sum('numbcomb(80, x)*numbcomb(100, 27-x)', x = 1 .. 27);

The use of unevaluation quotes prevents numcomb from complaining prematurely.

Dams := proc (f, x, c)
local A;
printf("\nDin funktion er %a", f);
A := diff(f, x);
printf("\nDen differentierede funktion er %a", A);
printf("\nFunktionens værdi i %a", c);
printf(" er %a",eval(f,x=c));
printf("\nFunktionen f(x) ser således ud:"); plot(f,x=-10..10)
end proc;

It could be that replacing Transpose with LinearAlgebra:-Transpose solves the problem, since the error message seems to suggest that Transpose is not acting. Inside procedures you need the full name, in this case  LinearAlgebra:-Transpose.

I got one. I don't consider it in any way perfect, but since you ask I have uploaded a worksheet containing that and two procedures which it uses. Examples are provided. I haven't had time to translate text in the procedures from Danish into English. It was never meant for a large audience. I use it myself as part of a large package. I tested the worksheet's first few examples to see if MultiAnimate depended on other private procedures than Chop and NestDo, but I didn't test all the examples.  MultiAnimate.mw

First 141 142 143 144 145 146 147 Last Page 143 of 158