Items tagged with loop loop Tagged Items Feed

 

Hello

I have Problem with the Maple command plotsetup, it does not seem to work within an if-statement.

What i would like to do is this:

1. Make a matrix with 0 or 1 as enteries

2. convert this matrix into a list where the 1's are points. (So the Matrix entery Matrix[1][1]:=1 would give the listvector:=[1,1]

3. plot these vectors as graphs and store them with the help of plotsetup

4. changing the matrix and rinse and repet 2,3,4 until satisfied

Hi,

i have to make an iteration in the following way, but i have a problem to plot the result. Has someone an idea how to plot?

 

s_1 := 0.779e-1*t^2-.1345*t+.2031:
s_2 := 1.3502*t-6.8742:
s_3 := .1112*t^2-1.5108*t+11.527:
s_4 := 1.9322*t-15.099:
s_5 := -0.178e-1*t^2+2.648*t-22.312:
V_0 := .3*.15:
p_0 := 100000:

t:= 0:
tmp:= p_0:
S := 0:

while t do

if t >= 0 and t if t > 9.5 and t if t > 12.875...

q2.mw

Hi!

I have a question on result storage of for loop.  The program in attached.

The program is relative complex, it is not necessary to look part 1.

The question is in part 2.

The result I proposed is:

r=([17400,12500],[13900])

but, the real result of r is:

r=table([1.0=[1.0,17400,12500],2.0=[2.0,13900],()=[]])

what should I do to modify the program?



y = 0;

0 = 0

 

`\`if'`(0 = 0, x, 0 = Float(infinity))

 

0, 0

 

`\`if'`(1 = 0, x, 0 = -1.)

 

1, 0

 

`\`if'`(2 = 0, x, 0 = .5000000000)

 

2, 0

 

0.

(1)

``



Download lattsum1.mw

Hi, I am trying to put a for loop inside another for loop, but it is not working. but if i split it up, it works, may I know what is it i miss out please?

eta is a diagonal matrix.

I tried writting

for i from 1 to 17 do
nod:=(2*(i-1))+1;
diz:=eta(i,i)
end do

for j from 2 to 18 do
nod:=(2*(i-1))+1;
diz2:=eta(j,j)
end do

but when i try to combine it

for i from 1 to 17 do
for j from 2 to 18 do

Dear Maple users

I am having a problem with a simple for loop. I cannot seem to figure out what is wrong. I want to define a number of Random Variables of the ChiSquare kind, with increasing number of degrees of freedom as the figure below suggest. When defining them one line after another everything works well. My idea was then to make a for loop, since I might want many Random Variables defined. It doesn't work however in the way I do it. All...

Hmmm, I'm not sure if this possible but worth asking...and maybe useful for creating custom loop simulations:

I have a trajectory profile (via 1D Lookup Table in MapleSim) whose duration is for 10 seconds.

Is it possible to create a simulation with an end time greater than 10 seconds and have the 1D Lookup Table repeat its profile after it ends:

Example: Simulation end time = 20second. Thereby having the Lookup Table execute twice.

Suggestions on approach? Thanks.

Hi, these are what I have, I'm trying tot get a set of answers.

elenum:=16:

nodes:=elenum*2+1:

L:=evalf((Pi*2)/(elenum*2)):

interface(rtablesize=infinity):

E0:=Matrix([[L/3,2*L/3,L/3)],[(2*L/3,11*L/15,2*L/3)],[(L/11,2*L/3,L/110]]):

for i from 1 to elenum do
node:=(2*(i-1))+1;
E0M[node..node+2,node..node+2]:=E0M[node..node+2,node..node+2]+E0
end do:

E0M:

What should I do if i want a different outcome of...

First of, thank you commenters, you have helped me so much in the past!

I am doing a matrix inversion with random numbers and I would like to loop the process, and have each inverstion go into a matrix, such that the matrix will be a bunch of rows ( i number of rows) and three columns (the matrix inversion yeieds three values)

 

> for i to 2 do;
>
> a1h := Generate(float(range = 0.1316881e-2 .. 0.1359706e-2)); a1f := Generate(float(range = .317149811 .. .327463626...

I want to assign the output of a function that has been passed to timelimit. Currently I have to pass, say, X in by reference (as a single element list) and do  timelimit( 0.5, F(X,args) ); where F := proc( X::list ); X[1] := f(args); end proc; --- which is not really desireable. 

More generally I want my proceudre to skip loop iterations that are taking too long. 

Hi,

I am trying to create a do loop to generate y values from a series of vectors containing the x's. In the end, I will be exporting this data to Excel, so I want to put it into a Vector.

My problem is that sometimes I have 11 x's and sometimes I only have 9 x's.

 
observed := rtable(1 .. 2, 1 .. 3)
for k from 1 to 2 do 
for j from 1 to 3 do 
observed[k][j] := evalf(subs(HK[1] = C1[k, 1...

Hello

I am trying to do a do loop that solve ODEs with initials conditions but i am having problems asking my do loop to use what we get from first run to run the secound one.

For example:

for i from 1 to 10 do

a

b

c

end do;

so first when i =1 we get a b and c then for i=2 we want what we get from i=1 to do i=2 and so on. 

Is it possible to do such a do loop? to ask maple to save what it get from...

Hi all,

A while ago, I had asked a question relating to calling to an MapleSim .msim simulation within maple .mw worksheet. (Thank you Acer! :) I got it working but then another issue just popped up...The basic structure is as follows:

********************************************************************

A := MapleSim:-LinkModel('filename' = "TriplePendulum_WORKS_v2.msim")

for z from 1 to 50 do

     initialize_variables;

Hi,

I would like to know how can I go out from two nested loops. I tried with the command 'break', but it go out only from the one loop. For example,

for i from 0 to 10 do

for j from 0 to 10 do

for z from 0 to 10 do

p:=i*j*z;

if p<=40 then print(p)

else break fi;

od; od;

do loop ...on error goto?

January 25 2012 by brian bovril 324 Maple

Postage_Stamp_proble.mw

Hi

I have a program which I need to exit a loop when an error is thrown. it should then output the value of a. but it doesn't....

 

1 2 3 4 5 Page 1 of 5