## save a sequence of variables...

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? ...

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

## Problem to create a loop...

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.

School of Mathematical Sciences
Peking University, Beijing, China

## How to run an input file .mpl...

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

## How to achieve its numerical solution？...

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

## If condition with loop...

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

## iterative method for nonlinear equation...

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)

## How can I write a procedure to add all multiples o...

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!

## Suggestions on how to check the progress of a proc...

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.

## Maple crashes when trying this loop with this nest...

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

## Find highest "isprime" which Maple can handle...

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.

## how to creat a matrix from a many array...

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

Thank a lots.

## The opery awards

by: Maple

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)

 >
 (1)
 >

## Vector equation: generate matrix for substitution ...

I have the following problem consisting of multiple seteps.

I have a vector equation consisting of n equations with n parameters (a[n]). Usually the n <= 15. As example data I will use the case n=4.

equations := Vector[column]([ a[1], a[2], a[3],a[4]])-Vector[column]([ b[1], b[2], b[3],b[4]])=0;

The first thing I want to create is a matrix with a format 2^n x n (here: rows=16 by columns=4). The matrix only consists of ones and zeros which contains all possible combinations of ones and zeros. E.G. for n=4

subsMatrix := Matrix([[ 0 , 0 , 0 , 0 ],[ 1 , 0 , 0 , 0 ],[ 0 , 1 , 0 , 0 ],[ 0 , 0 , 1 , 0 ],[0 , 0 , 0 , 1],[1, 1 , 0 , 0],[1, 0 , 1 , 0],[1, 0 , 0 , 1],[0, 1 , 1 , 0],[0, 1 , 0 , 1],[0,0,1,1],[1, 1 , 1 , 0],[1, 1, 0 , 1],[1, 0 , 1 , 1],[0, 1 , 1 , 1],[1, 1 , 1 , 1]]);

Question 1: How do I create such a matrix for the general case? I have absolutely no idea how to achieve this with Matple

The next thing I want to do is to use the rows as substitution equations for the a[i] values, only if the value of the subsMatrix is 0. E.G. in the first case I want to set a[1]=a[2]=a[3]=a[4]=0, then a[2]=a[3]=a[4]=0, then a[1]=a[3]=a[4]=0, and so forth and save the equation as a new equation

I tried the following:

rows:=RowDimension(subsMatrix);

columns:=ColumnDimension(subsMatrix);

for i from 1 by 1 while  i<=rows do

subsEquations[i]:=equations

for j from  1 by 1 while  j<=columns do

if subsMatrix[i,j] =0 then

subsEquations[i]:= subs(a[j]=subsMatrix[i,j],subsEquations[i])

else

#do nothing if the value in the subsMatrix[i,j]=1

end if

end do:

end do:

Question 2: What is my error? Maple says the loop is indeterminate. But I don't see why it is not working.

I would be thankful if someone could help me out. I am open to other kind of strategies to this problem :).