## Read a portion of an image into maple...

Is it possible to read in specific parts of a bmp image?

## Hoùology matrice...

what is the homology matrix that plates the ABCE square on the NPCM square
I think it may bi find out with the rotation angle, the vector of translation and the homothety ratio.
restart;
with(geometry):
with(plots):
_EnvHorizontalName = 'x':  _EnvVerticalName = 'y':

point(A, 0, 1):
point(B, 1, 1):
point(C, 1, 0):
point(E, 0, 0):
square(Sq, [A, B, C, E]):
Phi := (1 + sqrt(5))/2:
point(N, (2 - Phi)/(Phi - 1), 1):
line(BE, [B, E]):
MakeSquare(s1, [N, C, 'diagonal']):
point(M, (3 - sqrt(5))/(2*sqrt(5) - 2), (3 - sqrt(5))/(2*sqrt(5) - 2)):
point(P, (1 + sqrt(5))/(2*sqrt(5) - 2), (3*sqrt(5) - 5)/(2*sqrt(5) - 2)):
T:=<simplify(coordinates(midpoint(O1,E,B))-coordinates(midpoint(O2,M,P)))>:
simplify(distance(O1,O2)):
line(MN,[M,N]):eq:=Equation(%,[x,y]):sol:=solve(eq,y):
Ang:=Pi/2-arctan(diff(sol,x)):
r:=simplify(distance(N,M)):
line(MP,[M,P]):eq:=Equation(%,[x,y]):subs(y=0,%):point(Q,solve(%,x),0):
line(PQ,[P,Q]):
homology(Sq1, Sq, C, Ang, 'clockwise', r):

display(draw([A(color = black, symbol = solidcircle, symbolsize = 12),
B(color = black, symbol = solidcircle, symbolsize = 12),
C(color = black, symbol = solidcircle, symbolsize = 12),
E(color = black, symbol = solidcircle, symbolsize = 12),
N(color = black, symbol = solidcircle, symbolsize = 12),
Sq(color = red, filled = true, transparency = 0.9),
BE(color = green),
PQ(color = black),
Sq1(color = black),
s1(color = red, filled = true, transparency = 0.8)]),
textplot([[coordinates(A)[], "A"],
[coordinates(B)[], "B"],
[coordinates(E)[], "E"],
[coordinates(N)[], "N"],
[coordinates(P)[], "P"],
[coordinates(M)[], "M"],
[coordinates(Q)[], "Q"],
[coordinates(C)[], "C"]],
align = [above, right]), view = [-0.6 .. 1.5, 0 .. 1], axes = none);

## How to compute the conditional variance of a linea...

Given a constant gamma, gaussian random variables S[1] and S[2], and a linear combination of gaussian random variables Omega, I need to compute Exp[ Omega | S[1], S[2] ] - (gamma/2)*Var[ Omega | S[1], S[2] ]. I am not experienced in Maple. In the attached script I include many step-by-step details on what I need to do, as well as some notes where I get stuck:

150423_OptimizationProblem.mw

It would be convenient if you could directly fix this and share the working version. Thanks!

The conditional means and variance terms are calculated according to the 2D version of the script 3_gaussian_mmcdara.mw provided by @mmcdara.

## Extract all consecutive numbers appearing in a str...

Here is a string, and I want to treat consecutive single digits as a single number and extract them. I can process it using regular expressions in Python. I'm not sure if Maple can handle it in a similar way.

```import re
sstr1 = "124e34e243e45e56e76f34e45e23ea12e98e34e43"
num=re.findall(r'\d+', sstr1)
s=list(map(int, num))
print(s)```

[124, 34, 243, 45, 56, 76, 34, 45, 23, 12, 98, 34, 43]

Is there an equivalent regular expression method in Maple?

## Discrepancy between numerical and analytical resul...

As usual, I have a tricky question. There is an integral that Maple can take numerically

R0 := 1/(a-sqrt(b+c*cos(x)));

Now let's put the coefficients, e.g.

a := 0.9; b := 4.5; c :=0.1

and take the integral from 0 to 2*Pi

R1 := evalf(int(R0, x = 0 .. 2*Pi));

Also, there is an exact analytical result that Maple gives (I give it after simplifying it to avoid division by zero for the limit x=0 and x=2*Pi)

R2:=-4*((a^2-b+c)*EllipticK(sqrt(-2*c/(b-c)))-a^2*EllipticPi(2*c/(a^2-b+c), sqrt(-2*c/(b-c))))/((a^2-b+c)*sqrt(b-c));

As it turns out, the results are completely different. In the first case -5.145818656, while for the second case -3.612771378+0.I

Moreover, If we change the coefficients to a := 0.9; b := 4.5; c := -4 then I obtain Float(undefined)+3.662506136*I and -2.362349457+3.662506117*I , respectively.

My question: how to avoid this descepancy?

A := Matrix([[1, 3, 9, 2, 3, 7, 1, 1, 5, 4, 7], [7, 5, 5, 4, 9, 3, 4, 5, 3, 5, 3], [5, 2, 1, 6, 5, 4, 2, 9, 6, 6, 6], [2, 4, 1, 9, 5, 1, 1, 2, 1, 1, 7], [1, 9, 2, 3, 2, 9, 8, 2, 2, 7, 3], [5, 5, 3, 7, 2, 1, 5, 2, 7, 8, 3], [2, 2, 1, 7, 8, 7, 8, 2, 1, 4, 5], [8, 9, 6, 4, 9, 4, 1, 5, 4, 2, 5], [5, 7, 4, 5, 3, 2, 8, 3, 6, 2, 6], [6, 7, 8, 9, 9, 9, 8, 4, 8, 9, 3]]);

Use Maple to create the vector b that is column 2 from A and the matrix C that is made from columns 1 to 1 and 3 to 11 of A (in the same order as the columns of A.

Now solve the matrix equation

Cx=b

and enter the 4th component of the unique vector solution for x in the box below.

## A question about the order used in coeffs....

Let P(x) a polynomial with a single indeterminate.
In Maple 2015 (please, do not consider this question if Maple >=2021 doesn't present this problemcoeffs returns the coefficients P(x) in a different in some circumstances:

```m := [\$1..3]:

c:= coeffs(%, R, 't'): [c], [t];

[ 2      ]
[3, 2, 1], [R , R, 1]
c:= coeffs(%, R, 't'): [c], [t];
[1, 2], [1, R]
```

The order in the first case is R^2, R^1, R^0 while it is R^1, R^0 in the second one.

It's quite easy to check if P(x) is of the form a+b*R and to reverse the output of coeffs. But does it exist an option of coeffs which monitors the output order.

TIA

## how to find the answer of this problem in maple?...

guys..i need help ...how to find the answer for this equation..for all value of in and b in (a and b)...for all combination of a and b

problem.mw

## why my ruled surface is not displayed with this co...

Hi,

I don't understand why my ruled surface is not displayed with this code in my animation. Maybe there is an issue with an option? All my previous animations were displayed normally. Any ideas? Thank you

G2ExamenJuin.mw

## Is there any bugs in GraphTheory['TransitiveReduct...

According to this help page

the transitive reduction of graph `G`, is the graph with the fewest edges that still shares the same reachability as `G` (but might contain new edges not present in `G`).

However, in Maple 2023, things become strange; different branches return distinct numbers of edges:
(33 arcs or 40 arcs?)

 > restart;
 > with(GraphTheory):
 >
 GraphTheory:-TransitiveReduction := proc(G::GRAPHLN, \$) local D, V, T, i, j, k, A, M, n, flags, B;        ...    4   if _EnvDisableExt <> true then            ...        elif D <> (':-directed') then            ...        else            ...        end if;        ... end proc
 >
 (1)
 >
 (2)
 >
 (3)
 >
 (4)
 >

Any bugs?

```G__0 := GraphTheory:-Digraph({[3, 1], [9, 3], [4, 9], [14, 9], [10, 4], [5, 10], [15, 10], [11, 5], [19, 11], [12, 6], [7, 12], [17, 12], [13, 7], [8, 13], [2, 8], [10, 14], [18, 14], [11, 15], [6, 19], [16, 19], [23, 19], [13, 17], [15, 18], [21, 18], [12, 16], [22, 16], [22, 23], [20, 22], [19, 21], [17, 20]}):
```

## Similisât matrix of 2 squares...

How to find the similarity matrix that applies A in N, B in P, C in C and B in M;

restart;
with(geometry):
with(plots):
_EnvHorizontalName = 'x':  _EnvVerticalName = 'y':
#Vdot := proc(U, V) local i; add(U[i]*V[i], i = 1 .. 2); end proc
;

with(LinearAlgebra):
point(A, 0, 1);
point(B, 1, 1);
point(C, 1, 0);
point(E, 0, 0);
square(Sq, [A, B, C, E]);
Phi := (1 + sqrt(5))/2;
point(N, (2 - Phi)/(Phi - 1), 1);
line(BE, [B, E]);
MakeSquare(s1, [N, C, 'diagonal']);
point(M, (3 - sqrt(5))/(2*sqrt(5) - 2), (3 - sqrt(5))/(2*sqrt(5) - 2));
point(P, (1 + sqrt(5))/(2*sqrt(5) - 2), (3*sqrt(5) - 5)/(2*sqrt(5) - 2));
A

B

C

E

Sq

1   1  (1/2)
Phi := - + - 5
2   2

N

BE

s1

M

P

display(draw([
A(color = black, symbol = solidcircle, symbolsize = 12),
B(color = black, symbol = solidcircle, symbolsize = 12),
C(color = black, symbol = solidcircle, symbolsize = 12),
E(color = black, symbol = solidcircle, symbolsize = 12),
N(color = black, symbol = solidcircle, symbolsize = 12 ),
Sq(color=red),BE(color=green),
s1(color = blue)]),
textplot([[coordinates(A)[], "A"],
[coordinates(B)[], "B"],
[coordinates(E)[], "E"],
[coordinates(N)[], "N"],
[coordinates(P)[], "P"],
[coordinates(M)[], "M"],
[coordinates(C)[], "C"]], align = [above, right]), axes = none); Thank you.

## How to use any number of expressions or multiple g...

For example, I'd like to do something like this (and then plot the graph):

``` # display LaTeX markup
# display non-executable notation
label__2 := '(Product(Int(i, j), Sum(k, l)) %assuming convert(log2(1 - 'x'), confrac, subdiagonal))':
# display graphical object
label__3 := 'plots:-display(plottools:-stellate(plottools:-icosahedron()))':
# note that the desired one is  instead of
GraphTheory:-RelabelVertices(`some graph with 3 nodes`, [label__1, label__2, label__3]):```

But unfortunately, the second argument of `GraphTheory:-RelabelVertices` must be of type list({indexed, integer, string, symbol}), and the `GraphTheory:-SetVertexAttribute` command doesn't work here. Is it possible to do so in Maple® (rather than in other mathematical softwares)?

## Eval time of vertical drop of a function ...

min_problem.mw

Hi everyone

I am trying to solve the following problem. I want to evaluate the time when the function Sx(t) drops (the last vertical drop at about 0.45 sec)

The minimize command doesnt work because the function slightly deacreases afterwards but I am interested in the drop. For a miniization (evaluate the relevant time). I do it as follows:

Does anyone have an idea how to evaluete the time of drop? Is there an other command than minimize to solve this?

## How to find a symbolic solution for this piecewise...

I can derive a symbolic solution by hand for the following ODE, but cannot get Maple to do it for me.  Any tricks?

 > restart;

Velocity field, ,  .

 > v := (x,t) -> piecewise(x <= -t, 0, x < t, 1 - 1/2*(1 - x/t));

Position :

 > de := diff(x(t),t) = v(x(t),t);

Initial condition, assuming

 > ic := x(0) = -a;

Symbolic solution, calculated by hand:

 > x__exact := t -> piecewise(t < a, -a, t - 2*sqrt(t)*sqrt(a));

Verify exact solution by comparing it against the numeric solution for some :

 > a := 3;  # any a>0 should do dsol := dsolve({de,ic}, numeric): plots:-odeplot(dsol, t=0..5);   # dsolve solution plot(x__exact(t), t=0..5);      # symbolic solution (calculated by hand) a := 'a';

Can Maple's dsolve find the exact solution?  This one returns empty in Maple 2022:

 > dsolve({de, ic}) assuming a > 0, t > 0;