Items tagged with loop

Feed

Ok, I'm  a confident Matlab user, but for some reason Maple befuddles me.

Let's say I have two functions, x=f(t) and y=g(t) and I want to fill both two vectors with values, with t=-n:n.  How do I construct a loop to do that?

 

 I need help regarding this figure. i want to write both equations in maple 18. Second equation is related to first equation.So, please help me to write this code. I will be grateful. 

 

 

I've been using maple every few years since 1986, but am a bit rusty again.  I want to save a sequence of variables created in a do loop. I'm sure this is an old easy question, but can't find the answer searching.  For example

for i from 1 to 10 do
a:=i:
save a, `i.m`:
od:
quit

Keeps overwriting the file i.m, but I want files 1.m, 2.m, 3.m, etc.  Don't see how to do this, but should be easy.  

 

How do I solve the problem that attached? Please give me the correction. thank you

Hello!

Hope everyone good. I am facing problem to define a loop. Actually I want to solve the attached file for different values of H like H=[100,125,140,160] for this I don't know how to tackle it. My program do working on single value of H. Please solve my problem as soon as possible. I am waiting your positive response. 

Help.mw

With my best regards and sincerely.

Muhammad Usman

School of Mathematical Sciences 
Peking University, Beijing, China

Dear all,

I am trying to run a maple worksheet as an input file, in another maple worksheet. Therefore, I have exported my input worksheet to an inputfile (.mpl).

In the input file I have a variable H, which I vary in the second worksheet.

restart;
with(ExcelTools);
with(ListTools);
B := Import("C:\\Users\\s110950\\Dropbox\\Afstuderen\\New formula\\Importdata\\161005 - Staalprofielen.xlsx", "Blad1", "A7:AA344");

V := ["IPE 330", "IPE 360"];
currentdir("C:\\Users\\s110950\\Dropbox\\Afstuderen\\New formula\\Afrondingstraal")

for i  from 1 to 2 do
H := V[i];
cmaple.exe<"C:\\Users\\s110950\\Dropbox\\Afstuderen\\New formula\\Afrondingstraal\\Model38loop.mpl">;
 end do; 

However, it does not run the file. Does anyone know how to make it run?

Kind regards,
Bastiaan Overdorp

I  encountered a non-integrable integral in the process of solving the following process, . How to achieve its numerical solution? Such as in a looping   code:

#######
pa[i] := pa[i-1]-(Int(subs(t = tau, Lpa[i-1]+Na1[i-1]-Na2[i-1]), tau = 0 .. t)); 

pw[i] := pw[i-1]-(Int(subs(t = tau, Lpw[i-1]+Nw1[i-1]-Nw2[i-1]), tau = 0 .. t)); u[i] := u[i-1]-(Int(subs(t = tau, Lu[i-1]+Nu1[i-1]+Nu2[i-1]), tau = 0 .. t));

######
Detailed code see annexBC2.mw

When I write an conditional command I come back and press enter again and again but I need only last one for example 

>f:=x->x^2+x+1

>g:=y->y^2+2*y+6

>x:=0;y:=0

>if f(x) <g(x) then;

>x:=x+1 elif f(x) >g(x) then;

>y:=y+1 elif f(x)=g(x) then;

>x;

>y;

>f(x) end if;

I push enter and it write x:=1 then I click if command and push enter again and it writes x:=2 and continues like y:=1, x:=3, y:=2, x:=4,  y:=3 and lastly 

4

3

21

But I only need last one. Can I do this only push enter once. Of course my problem is more complicated than this f(x) , g(x) . Thanks

 

 

hy

i have to develop a code i which i have system of nonlinear equation 

i have to generate the matrix of that nonlinear equation then i want to do or apply any method say newton method and make a loop which help us to find a solution using some tolerance 

at the end i get a result in form of a table which give nth matrix then value of function matrix at nth value then error i-e xn-x(n-1) 

thanx in advance

I need to write a procedure that adds all multiples of 5 and 7 less than an arbitrary number. I was thinking something maybe with mod? I am very new to Maple. 

 

On in this same assignment, we are also supposed to generate a sequence using the Fibonacci equation but from an arbitrary pair of initial conditions. So if there are some parallels between these two problems, I would love to learn from that angle.  

We recently in class learned about do loops, so if there is a way to attack these problems with do loops, I would like to hear!

Hello

I wonder if there is a way to see the progress of a specific procedure.  I have checked the forum for some answers and found that some of them propose a progress bar. However the progress bar doesn't seem to fit within a procedure.   

I don't need anything fancy but I need to see the progress of the loop inside of the procedure (over 3,000,000 times).   

Any suggestions?   

Many thanks

 

PS. I am running Maple 2016 too but I would rather see a solution that works on Maple 14 too, if possible.

so I'm trying this:

restart;

sigma := 0.143e-18;

l_0 := 1.87;

l0 := 1.87;

roll := rand(0 .. 25.0);

f_gauss := proc (x) options operator, arrow; exp(-(1/2)*x^2/`&sigma;_x`^2)/sqrt(2*Pi*`&sigma;_x`^2) end proc;

f_norm := proc (dx) options operator, arrow; int(f_gauss(x), x = -(1/2)*dx .. (1/2)*dx) end proc;

sol_gauss := proc (mix) options operator, arrow; evalf(eval(-ln((int(f_gauss(x)*exp(-2*sigma*N2O*sqrt((1/4)*l_0^2-x^2)), x = -(1/2)*dx .. (1/2)*dx))/f_norm(dx))/(sigma*N2O), [N2O = 0.25e20*mix/100])) end proc;

for ii to 10 do

a := roll();

eval(sol_gauss(a), [dx = l_0, `&sigma;_x` = l0])

end do

I'd like to find out what number Maple can still calculate the isprime for, and what number will make it go "No thanks, this is madness - ERROR".

I tried isprime (10100,000,000 + 2), and it can still calculate the result. No prime of course, that's the whole point of the +2.

I tried isprime(1010ˆ9 + 2) and it crashed.

But what is the tipping number?

I decided I should write a loop, and let maple write away the last number till it crashes. Is this possible? I think I'll need something like

> for n from 5 to ??? do isprime (10ˆn + 2) and ??? end do

This isn't suitable at all, but I cant figure out how to program "to error" or "write away this number"...

 

I hope the question is clear and look forward to ideas on how to make this work.

 

Dear Pros, I'm a biginer so I have a question about my program.

I have a lot of arrays which are result from 2 while loop. Now, I want creat a matrix from them but i can't. So, could you help me to do it.

For detail: 

V[1]:=[ 1 2 3]

V[2]:=[2 3 4]

V[3]:=[3 4 5]

V[4]:=[2 6 7]

V[5]:=[7 8 9]

...

V[n]

with type of V[i] is a array.

I searched and found a solution by manual to create a matrix as follow:

V_matrix:=<V[1],V[2],V[3]>

but in this case i can't but manual with n=100

please help me to have a Matrix.

Thank a lots.

most effective built in operator code award goes to ppl that wrote the code for the union and intercect set operations for maple. Very important simple example below of  one of its applications.

 

When i work with algorithms, probably one of my most primary ports of enquiry (figuratively jeez skynet)  is to set up and if statement triggered to terminate the loop once the operations performed for any further cycles is INDEMPOTENT. this doesnt always mean your output is convergent in every case but it allows you to minimize the amount of time the cpu needs to collect data( ie the point at which it would produce that same set as it did in the last most loop)

 

 

Y := proc (X) local N, S1, `&Sopf;`; if X <> `union`(X, S1[N]) then N := (rand(1 .. NrANGE))(); S1[N] := {K[1](4+N), K[1](5+N), K[1](6+N), K[1](7+N), K[1](8+N), K[1](9+N), K[1](10+N), K[1](11+N), K[1](12+N), K[1](13+N), K[1](14+N), K[1](15+N)}; `&Sopf;` := `union`(X, S1[N]) else  end if end proc

proc (X) local N, S1, `&Sopf;`; if X <> `union`(X, S1[N]) then N := (rand(1 .. NrANGE))(); S1[N] := {K[1](4+N), K[1](5+N), K[1](6+N), K[1](7+N), K[1](8+N), K[1](9+N), K[1](10+N), K[1](11+N), K[1](12+N), K[1](13+N), K[1](14+N), K[1](15+N)}; `&Sopf;` := `union`(X, S1[N]) else  end if end proc

(1)

``

 

Download idempotency.mwidempotency.mw

 

 

1 2 3 4 5 6 7 Last Page 1 of 14