casperyc

962 Reputation

10 Badges

17 years, 157 days
University of Kent
Dr

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are questions asked by casperyc

Hi all,

I have been trying to improve my code to speed up a bit.

Here is the toy example:

######################

restart:

myfunc:=proc(phi,p,CH)
 # dummy code
 # dummy code
 # dummy code
 # dummy code
end proc;

a:=myfunc(phi,p1,CH1)
b:=myfunc(phi,p2,CH1)
c:=myfunc(phi,p3,CH1)

ANS1:=w1*a+w2*b+(1-w1-w2)*b

a:=myfunc(phi,p1,CH2)
b:=myfunc(phi,p2,CH2)
c:=myfunc(phi,p3,CH2)

Hi all,

#####################################
myp:=proc(a,b,c)

local ans;

ans:=zip(`+`,a,b);

ans:=ans*c;

return ans;

end proc;
myp([$1..4],[x,y,z,w],2);
map2(myp,[$1..4],{[x,y,z,w],[x2,y2,z2,w2],[x3,y3,z3,w3]},4);

map2(myp,[$1..4],{[x,y,z,w],[x2,y2,z2,w2],[x3,y3,z3,w3]},10);
map2(myp,[$1..4],{[x,y,z,w],[x2,y2,z2,w2],[x3,y3,z3,w3]},0.5);

#####################################

Is it possible to use something like

Hi all,

##################################################################

restart:

K:=50;C:=20;

st:=time():

    for j from 2 to K do
        for c to C do
            solve({log(cat(p,j,'C',c)/(1-cat(p,j,'C',c)))=mu+cat(tau,j)+cat(eta,c)+cat(mix,j,c)},cat(p,j,'C',c));
            assign(%);
  ...

Hi all,

restart:
a:=<1,2;3,4>;
whattype(a);
b:=Matrix(2,2,[1,2,3,4]);
whattype(b);
evalb(a=b);

Is there any real difference between these two methods of creathing matrices?

How do I check if two matrices are equal?

Thanks,

Casper

Hi all,

I am trying to get the following matrix:

restart:
int00:=Matrix(3,3);
int00[2,2]:=a;
int00[2,3]:=b;
int00[3,2]:=c;
int00[3,3]:=d;
int00;
cols:=MTM:-sum(int00,1);
rows:=MTM:-sum(int00,2);
int00[1,1..3]:=-cols:
int00[1..3,1]:=-rows:
int00;

int00[1,1]:=a+b+c+d:
int00;
MTM:-sum(int00,1);
MTM:-sum(int00,2);

How do I get the sum of all elemnets in the 'original' matrix? Bascially, the int00[1,1] term in the toy example.

First 13 14 15 16 17 18 19 Last Page 15 of 31