pauldaas

20 Reputation

One Badge

1 years, 355 days

MaplePrimes Activity


These are questions asked by pauldaas

I want to create a graph from y1 to yn+1.

Something like:

f(x)=piecewise(

x<a[1],y(x)[1],

for i from 2 to n+1,

a[i-1] <=  x  <=  a[i], y(x)[i];

od:);

plot(f(x),x=0..l);

But then something that works.

Can anyone help me with an example?

 

 

Hi, in attached code pauldaas_05.mw, the procedure 'aFshear' and 'aFmoment' must be called within procedure ´aF0011´.

The procedures ´aF0011´, 'aFshear', 'aFmoment' build the matrixes R, C1 and C2 respectively.

Unfortunately ('aFshear' and 'aFmoment') gives 'Error, invalid left hand side in assignment'.

It is strange that ´aF0011´ can call them separately ('aFshear' or 'aFmoment') but not both ('aFshear' and 'aFmoment').

Maybe there should be an 'unassign' statement for 'L'  somewhere. I tried that but without result.

Is there anyone who can help me.

 

 

restart:
with(linalg):
L:=Vector[row]([''RA'',''MA'',''thetaA'',''yA'',''RB'',''MB'',''thetaB'',''yB'']):
R:=Matrix(0,8,0):
C1:=Matrix(0,10,0):
C2:=Matrix(0,10,0):


aF0011:=proc(nr,a,l,F,EI)
local B,RA,MA,thetaA,yA,RB,MB,thetaB,yB,aF;
global R;
R:=extend(R,1,0,0);
B[RA]:=0;
B[MA]:=0;
B[thetaA]:=F*(l-a)^2/(2*EI);
B[yA]:=-F*(a^3-3*a*l^2+2*l^3)/(6*EI);
B[RB]:=F;
B[MB]:=-F*(l-a);
B[thetaB]:=0;
B[yB]:=0;
B:=Matrix( [seq(B[i],i in [RA,MA,thetaA,yA,RB,MB,thetaB,yB])]);
copyinto(B,R,nr,1);
aFshear(nr,R);   #nested procedure
aFmoment(nr,R);  #nested procedure
end:

aFshear:=proc(nr,R)
local i,c;
global C1;
C1:=extend(C1,1,0,0);
R:=convert(R,Matrix);
zip(assign,L,R[nr,..]);
c[0]:=RA;
c[1]:=0;
c[2]:=0;
c[3]:=0;
c[4]:=-F;
c[5]:=0;
c[6]:=0;
c[7]:=0;
c[8]:=0;
c[9]:=0;
c:=Matrix([seq(c[i],i in [0,1,2,3,4,5,6,7,8,9])]);
copyinto(c,C1,nr,1);
end proc:

aFmoment:=proc(nr,R)
local i,c;
global C2;
C2:=extend(C2,1,0,0);
R:=convert(R,Matrix);
zip(assign,L,R[nr,..]);
c[0]:=MA;
c[1]:=RA;
c[2]:=0;
c[3]:=0;
c[4]:=0;
c[5]:=-F;
c[6]:=0;
c[7]:=0;
c[8]:=0;
c[9]:=0;
c:=Matrix([seq(c[i],i in [0,1,2,3,4,5,6,7,8,9])]);
copyinto(c,C2,nr,1);
end proc:

aF0011(1,a__1,l,F__1,EI):
aF0011(2,a__2,l,F__2,EI):
aF0011(3,a__3,l,F__3,EI):
R:=convert(R,Matrix);
C1:=convert(C1,Matrix);
C2:=convert(C2,Matrix);

l:=8000:
F__1:=15000:
F__2:=20000:
F__3:=35000:
a__1:=2000:
a__2:=2000:
a__3:=6000:
EI:=2E+5*2.49E+7:
R;
C1;
C2;

Hi, in the 'assign' command below, a certain row from matrix 'R' is assigned to the variables RA, MA .. yB. The command works well. However, I wonder if it could not be better/ shorter. So, without having to write out R [1], R [2] .. R [8].

I would be very happy if someone could advise me on this.

Here is the algorithm:

restart:with(linalg):
R:=Matrix(2,8,[1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18]);


aFshear:=proc(nr,R)
assign(('RA','MA','thetaA','yA','RB','MB','thetaB','yB')
= (R[1],R[2],R[3],R[4],R[5],R[6],R[7],R[8]));
end:


aFshear(2,row(R,2));
print(thetaB);

 

 

Page 1 of 1
´╗┐