## Regrouper suite de résultat en une seule liste...

Bonjour,
Un connaisseur pourrait-il m'aider s'il vous plaît afin de résoudre un petit problème sur Maple.
J'ai un algorithme qui me renvoie les résultats successifs des nombres utilisés pour faire une multiplication égyptienne.
Sauf que les résultats sont renvoyés sur des lignes différentes avec plusieurs références d'une liste que j'ai nommé "L".

Les résultats sont renvoyés donc ainsi :

L:= [21 , 54 , 47]
L:= [20, 41 , 87]
L:= [2, 8, 12]
L:= [3, 7 , 5]

Comment faire pour que les résultats soient regroupés dans une même liste, c'est à dire :

L:= [21 , 54 , 47, 20, 41 , 87, 2, 8, 12, 3, 7 , 5 ]

Voici l'algorithme :

x := 12:
y := 46:
s := 0;
'x' = x:
'y' = y:
'résultat' = s:
while 0 < y do
if type(y, odd) then s := s + x:
y := y - 1:
else x := 2*x:
y := y/2:
end if;
L := [x, y, s];
end do;

I have this results in Maple :
L:= [21 , 54 , 47]
L:= [20, 41 , 87]
L:= [2, 8, 12]
L:= [3, 7 , 5]

How do for have just one list that :

L:= [21 , 54 , 47, 20, 41 , 87, 2, 8, 12, 3, 7 , 5 ]

## Can anyone explain me how 'infinity' is treated in...

Hi

I got, a bit by mistake, a weird result that seems to come from the way "Maple" manipulates infinity (please have a look at the results below)
I couldn't find a correct explanation to these results in the help pages dedicated to infinity or evaluation.

Could anyone explain me why, in some circumstances, 'infinity' seems to be a name (for instance infinity*Pi; does not return  infinity but infiniy/Pi).

 > restart:
 > with(Statistics):
 > f := PDF(Cauchy(0, 1), x)
 (1)
 > m := int(x*f, x=-infinity..+infinity);
 (2)
 > p := int(x*f, x);
 (3)
 > # Naive "proof" : eval(..., infinity) seems to consider infinity as a name (consistent with # the first line in help(infinity) without any particular property. # This seems to be confirmed by the value of p1 and p2 : I expected to get infinity instead # of infinity/Pi. p1 := eval(p, x=-infinity); p2 := eval(p, x=+infinity); p2 - p1;
 (4)
 > # Correct "proof" : a := limit(p, x=-infinity); b := limit(p, x=+infinity); b-a
 (5)
 > # Does Maple treat 'infinity' as a number ? infinity         - infinity; infinity*2       - infinity*2; infinity*(1/3)   - infinity*(1/3); infinity*0.333   - infinity*0.333; infinity*sqrt(2) - infinity*sqrt(2); infinity/Pi      - infinity/Pi;
 (6)
 > limit(sqrt(2)/x, x=0) - limit(sqrt(2)/y, y=0); limit(Pi/x, x=0)      - limit(Pi/y, y=0);
 (7)
 >

## fieldplot with a boundary...

Dear Guys

How can I plot a fieldplot with a boundary. For example I can plot

> fieldplot([y, -sin(x)-(1/10)*y], x = -1 .. 1, y = 0 .. 1);

but I want to see the field plot only in the region x^2+y^2<=1.

Thanks a lot

## FormatTime timestamp...

timestamp is the number of seconds from the epoch, which I thought was Jan 1, 1970.  Maple uses Dec 31, 1969.  It appears there is a maximum number of seconds you can use with timestamp.

FormatTime("%Y-%m-%d", timestamp = 0)
"1969-12-31"

FormatTime("%Y-%m-%d", timestamp = 2147483647)
"2038-01-18"

Who knows if Maple will be around then, however if we add one second more to timestamp we run into the 32 bit integer problem.

FormatTime("%Y-%m-%d", timestamp = 2147483648)
Error, (in StringTools:-FormatTime) timestamp value must be a 32-bit signed integer.

Can Maple get passed 2038 using timestamp?  Is there always that 32 bit limit?

## Number of Partitions of a number...

I couldnt find this command in the number theory package, as far as what i am thinking of doing it should be straight forward but very long winded, so if I have missed this command throughout the packages up to Maple 2016 I would appreciate someone telling me otherwise I suppose it's what i am doing for the next few hours

## Is it possible to write a legend with plots:-inequ...

Hi,

I discovered that the option legend, when used in plots:-inequal, returns an empty graphic.
Is it a bug or a deliberate choice?

Anyways, is it possible to insert a legend in a simple way (that is without using textplot for instance)?

TIA

## Is there six integer numbers a, b, c, d, n, p so t...

I am trying to find six integer numbers a, b, c, d, n, p so that this equation
abs(a*x+b)+abs(c*x+d)+x^2+n*x+p = 0
has 6 integer solutions are 1, 2, 3, 4, 5, 6. I tried
f:=x-> abs(a*x+b)+abs(c*x+d)+x^2+n*x+p;
solve([f(1) = 0, f(2) = 0, f(3) = 0, f(4) = 0, f(5) = 0, f(6) = 0], [a, b, c, d, n, p])

This equation has no solution. Is there six integer numbers a, b, c, d, n, p so that this equation has 6 integer solutions?

I have just found one solution is
solve(abs(-2*x+5)+abs(-2*x+9)-x^2+7*x-16 = 0, x);

With Mathematica, I see at here
https://mathematica.stackexchange.com/questions/212808/find-integers-a-b-c-d-m-n-p-so-equation-has-six-distinct-solutions

## Spliting of a matrix ...

Dear Users!

Hope you would be fine with everything. I have following code to generate marix A of order M by M

restart; with(LinearAlgebra); with(linalg); Digits := 30; M := 10; nu := 1;

for k1 while k1 <= M do

C[k1] := simplify(sum((-1)^(k1-1-i1)*GAMMA(k1-1+i1+2*nu)*GAMMA(nu+1/2)*x^i1/(GAMMA(i1+nu+1/2)*factorial(k1-1-i1)*factorial(i1)*GAMMA(2*nu)), i1 = 0 .. k1-1))

end do;

A := evalm(Matrix(M, M, proc (i, j) options operator, arrow; eval(C[j], x = (i-1)/(M-1)) end proc))

I want to split (or decompose) A into two parts Ad and Ab

A = Ab + Ad

where Ad is M by M matrix of all entries of A but first and last rows of Ad shoud be zero

and Ab is M by M matrix with zero entries expect first and last rows.

For exmaple for M = 5, A, Ab and Ad are given as,

Ab := Matrix(5, 5, {(1, 1) = 1, (1, 2) = -2, (1, 3) = 3, (1, 4) = -4, (1, 5) = 5, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (3, 5) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0, (4, 5) = 0, (5, 1) = 1, (5, 2) = 2, (5, 3) = 3, (5, 4) = 4, (5, 5) = 5});

Ad := Matrix(5, 5, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (2, 1) = 1, (2, 2) = -1, (2, 3) = 0, (2, 4) = 1, (2, 5) = -1, (3, 1) = 1, (3, 2) = 0, (3, 3) = -1, (3, 4) = 0, (3, 5) = 1, (4, 1) = 1, (4, 2) = 1, (4, 3) = 0, (4, 4) = -1, (4, 5) = -1, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = 0, (5, 5) = 0});

Special request @acer @Carl Love @Kitonum @Preben Alsholm

## How to deal with using previously computed values ...

I have hacked together some things so I can use previously computed values without too much hassle

_Last := 0:
# Stores N in a global to be used
Last := proc(N)
global _Last;
_Last := N;
N;
end:

_Last := 1:

seq(Last(_Last*4 + k),k=1..10);

This is quite hacky but does work. It is not very robust. Is there any better way? [The above is just a trivial example, I know it can be solved as a problem easily, that is not the point. The method can also be used in much more non-trivial scenarios to simplify coding them].

## What is the best programming practice for inputtin...

Maple programming is certainly full of pitfalls for the unwary and the inexperienced as my recent difficulty demonstrates.

I have encountered disconcerting behaviour in the way the Maple type system treats tables and names as a result of last name evaluation.  In my case, it created a rather difficult debugging session in a procedure I was writing.

Specifically, in a procedure where a defined table is an argument, within the procedure the table satisfies the type test for a table, as well as for a name and a symbol. In retrospect, I realize that this makes sense when last name evaluation is in play, but I don't recall any mention of this particular side effect in the help files describing parameter processing or tables.  (or I forgot)
Once identified the problem, I found two fixes:

1) test for a table before I testing for a name(symbol).
2) use eval(T) as the argument when calling the procedure.

I feel a bit uneasy about the first approach because I'm not certain there isn't some pitfall writing a procedure where the order of execution changes the outcome. Is the second approach the best way (as a rule of thumb) to feed a table into a procedure.

A somewhat artifical worksheet is attached to illustrate the problem and these approaches.

## Modifying plot geometry...

I was playing with some of the geometry plotting in maple for fun(I rarely use it) and came up with an IFS like system. While I'm sure maple sucks for IFS it is somewhat easy to do. I was just using rectangles though.

Is there any way though to modify a shape using a transform such as a complex map? Not just the vertices but the edges too.

Also, is there any way to do a complex map in some easy way? e.g., "paint the geometry on to a texture" and then map it with a complex plot. Usually one just uses a pixel coloring map and maps that, which would be fine for playing around but I'd like to have more control.

Basically draw something on a plot(geometry, functions, image, etc), transform them in some interesting way(e.g., complex map) and then IFS them to get interesting visuals.

I realize one can do this in maple by turning the edges in to curves and all that mess but I'd like to avoid that since maple is not really good at it anyways(would probably end up very slow).

## solved numerically a system of nonlinear algebraic...

Hi everyone:

How can I solve numerically the system of nonlinear algebraic equations by Newton’s method?

eq1:= (1/2)*x[0]*sqrt(3)-(1/2)*x[1]*sqrt(3) = ((1/2)*x[0]*(t+(1/3)*sqrt(3))*sqrt(3)-(1/2)*x[1]*(t-(1/3)*sqrt(3))*sqrt(3))*(1-(1/6)*y[0]*(t+(1/3)*sqrt(3))*sqrt(3)+(1/6)*y[1]*(t-(1/3)*sqrt(3))*sqrt(3)-(1/8)*y[0]*(5*sqrt(3)*(1/12)-1/4+t)*sqrt(3)+(1/8)*y[1]*(-(1/4)*sqrt(3)-1/4+t)*sqrt(3)-(1/8)*y[0]*((1/4)*sqrt(3)-1/4+t)*sqrt(3)+(1/8)*y[1]*(-5*sqrt(3)*(1/12)-1/4+t)*sqrt(3))-5*t^3*(1/2)+49*t^2*(1/12)+17*t*(1/12)-23/6;
eq2:= (1/2)*y[0]*sqrt(3)-(1/2)*y[1]*sqrt(3) = ((1/2)*y[0]*(t+(1/3)*sqrt(3))*sqrt(3)-(1/2)*y[1]*(t-(1/3)*sqrt(3))*sqrt(3))*(-2+(1/2)*x[0]*(t+(1/3)*sqrt(3))*sqrt(3)-(1/2)*x[1]*(t-(1/3)*sqrt(3))*sqrt(3)+(1/4)*(-(1/12)*sqrt(3)-3/4)*((1/2)*x[0]*(5*sqrt(3)*(1/12)-1/4+t)*sqrt(3)-(1/2)*x[1]*(-(1/4)*sqrt(3)-1/4+t)*sqrt(3))+(1/4)*((1/12)*sqrt(3)-3/4)*((1/2)*x[0]*((1/4)*sqrt(3)-1/4+t)*sqrt(3)-(1/2)*x[1]*(-5*sqrt(3)*(1/12)-1/4+t)*sqrt(3)))+15*t^3*(1/8)-(1/4)*t^2+3*t*(1/8)-1;
eq3:=(1/2)*x[0]+(1/2)*x[1] = 1;
eq4:=(1/2)*y[0]+(1/2)*y[1] = 0;

## How I find college students to create problem work...

I teach high school IB Math.

I want to find someone who can take problems I have created and enter them into Maple (problem and solution) so I can use those in my classroom.

I can keep up with the new stuff I create, but I have almost 20 years of accumulated material I'd like to move into Maple.

Does anyone know where I can find someone to enter the problem and solution so that it is proved out in Maple? Maybe an existing college student using Maple at their school for math, engineering, or education? I am willing to pay them, it is just locating them that is a problem.

Even if you know a site for maple contractor types, that would be helpful.

Thanks a ton!

Robert

## Finding a Derivative with Maple...

I have a function e^(-\lambda z \sqrt(x^2 + y^2)), is it possible to use Maple to find some sequence of derivatives wrt to x and y which could be applied to this function to get

(z/(1+2*sqrt(x^2 + y^2)*lambda))*e^(-\lambda z \sqrt(x^2 + y^2))