## simple factorization format...

This is the sort of thing that drives me nuts with Maple.

in the example below, how do I factor (L-Lm) so that the answer is in the form L1 :=L(1-k) instead of -L(k-1)?

Lm := (simplify(k*sqrt(L*L)) assuming (0 < L));
Lm := k L

L1 := (factor(L - Lm) assuming (0 < L and 0 < Lm and 0 <= k));
L1 := -L (k - 1)

in this simple case, it is easy to understand the result.  However, these kind of  representations in more complex solutions may obfuscate the result making it difficult to interpret its meaning, where as the meaning may be more obvious if the simplification or factorization led to a result formatted more similarly to the way a human would do it.  How do I get Maple to simplify things the more "traditional" way?

## Expressions randomly shuffling...

Hi,I am looking to create an exercise involving the pairing of 'expressions-figures,' and I want to keep the names f(x), g(x), h(x), and i(x) fixed, with the expressions randomly shuffling. Thank you for your guidance

S6QCMFonctions.mw

## Parameters with values in the Maple textplot...

Dear Maple experts, I want to write text in a specific location within a Maple plot like p<c. To do that, I use 'plots:-textplot' as follows:

plots:-textplot([[0.1, 0.80, p < c, color = black]], font = [times, 11], rotation = 'horizontal');

The issue is that in my code, 'p' and 'c' are parameters with specific values. Therefore,  in my plot, their values appear instead of p<c. Even if I use 'p<c' or "p<c" it does not work.

Would you please guide me on how to solve the issue?

## One Step in Simon Plouffes Pi-Calc (BBP)...

I am reading (and enjoying) this:

"On the computation of the nth decimal digit of various transcendental numbers" by

Simon Plouffe, 1996 (2009)

On the third page Simon calculates this:


a := 1/binomial(100, 50);
1
a := ------------------------------
100891344545564193334812497256

ifactor(denom(a));

(8)  (81)  (11) (13) (17) (19) (29) (31) (53) (59) (61) (67) (71) (73) (79) (83) (89) (97)



and builds a sum of fractions where the above primefactors are the denominators in this sum.

5/8 + 20/81 + 10/11 + 2/13 + 13/17 + 10/19 + 4/29 + 5/31 + 23/53 + 41/59 + 29/61 + 37/67 + 33/71 +19/73 + 36/79 + 7/83 + 13/89 + 88/97

Solving a diophantine equation and using continued fractions are the steps to get that fractions (see link above).

May someone explain these steps to me ?

Thanks

## simple example for: combo-box with embedded compo...

I am creating an user interface with embedded components (Labels, Buttons, plotwindow ...).

All works well.

Now I need to include a combobox selection in that code. I can't get any further with that.

The specific question is what to type here (this is "edit selected code", in the combobox options)

use DocumentTools in

end use;


to get the choosen value as a variable in the rest of the code (startup code and other code in buttons with edit click code).

A simple example explaining that would be very helpfull:)

## Determinant: The system hangs...

When I try to solve the determinant the system hangs and Maple doesn't give any result. Here $\lambda_1,2$ is not a function of 'x' and 't'.

 >
 >
 >
 >
 >
 >
 (1)
 >
 >
 (2)
 >
 >
 >
 >
 >
 >
 >
 >

## Extract data form any figure using Maple...

Hi everyone, Is it possible to extract data by using Maple from any figure published by any author in different papers and then ussed that to reprouced same graph in Maple?

## Find the signature of a metric...

Given a metric tensor, is there a quick way to find the signature of the metric?

## Command Extrempoints...

Question about using the command „ExtremPoints“

I am using Maple 2019.

Using the command ExtremPoints I got different list when defining the function over a closed intervall piecewise or with f(x), x=a..b.

Maple desciption states:
ExtremePoints(f(x), x = a..b) command returns all extreme points of f(x) in the interval [a,b] as a list of values.

An extreme point is defined as any point which is a local minimum or maximum, which includes any finite end points.

So I expected, Maple returns the same list, independend of how the same function is defined (see example below). Instead: with the piecewise definition Maple returns as extrempoints only the local extrempoints without the finite endpoints.
Defining the same function with f(x),x=a..b Maple returns the list with local minimum or maximum, which includes any finite end points.

Example:

f := x -> piecewise(-1 <= x and x <= 2, x^2, undefined);

Return:  ExtremePoints(f(x));

[0]

g := x -> x^2

ExtremePoints(g(x), x = -1 .. 2);

[-1, 0, 2]

## Exporting Graphs to PDF Using Maple Code?...

The following code effectively converts the image to the JPG format.
with(GraphTheory):
s:=DrawGraph(CompleteGraph(5),size=[250,250])
Export("D:\\s1.jpg",s)


But I would like to export it using PDF format. However, the modified code below seems to be quite unsuccessful. I am aware that Maple has export options in the front end, but I still prefer to use code for this purpose.

Export("D:\\s1.pdf",s)

Error, (in Export) invalid input: member received _ImportExport:-InfoTable["PDF"][4], which is not valid for its 2nd argument, s

There are two reasons for this.

with(GraphTheory):
Graphs:=[NonIsomorphicGraphs(6,8,output=graphs,outputform = graph)]:
num_g:=nops(Graphs):
num:=ceil((num_g)/5.):
Matrix (num,5,(i,j)->if((i-1)*5+j<=num_g, DrawGraph(Graphs[(i-1)*5+j],size=[250,250] ,overrideoptions ,showlabels=false,style=planar, stylesheet =  [
vertexcolor     = orange
,vertexfontcolor = black
,vertexborder    = false
,edgethickness   = 0.6
,edgecolor       = MidnightBlue
,vertexshape     =  "circle"
,vertexfont      = [Arial, 4],
vertexthickness=5], caption = cat(H__,5*(i-1)+j),captionfont=["ROMAN",7]),plot(x = 0 .. 1, axes = none))):
DocumentTools:-Tabulate (M1[1..5,.. ],widthmode=percentage ,width=80 , exterior =all):



## How to remove missing value cells in a dataframe?...

In a dataframe you can easily replace 'undefined' by another value using FillMissing. However, if you want to remove the row in which a cell contained 'undefined' this seems not to be possible. 'DropMissing' will remove the complete column in which one of the cells contains 'undefined'. Is there another command that removes the row of the dataframe as a column contains an 'undefined'? Sorry for the simplistic question but I am still in my learning curve.

## Why solution set is empty....

Hello. I am trying to solve the following polynomial system. Maple solution is empty but when I add the polynomial X4_4-2^(1/2)/10 to the list then maple gives me a set of solutions. What could I be doing wrong?

with(SolveTools):
F:=[
10*X4_4 + Y1_1,
10*X4_4*Y1_1 + 2,
20*X4_4*Y3_1,
2*Y3_1,
10*X4_4*Y1_2,
20*X4_4*Y3_2 + 2,
10*X4_4 + 2*Y3_2,
4*L2 - 7*L1 + 5*L3 - 6*L4 + 5*L5 + 9*L6 - 6*L7 - 1,
L1 + 10*L2*X4_4,
10*L5*X4_4,
2*L4 + 20*L3*X4_4,
2*L7 + 20*L6*X4_4
]:
V:=[X4_4, Y1_1, Y1_2, Y3_1, Y3_2, L1, L2, L3, L4, L5, L6, L7]:

Sols := PolynomialSystem(F, V);

## code : solve system ...

Dear all

I have a system that I want to solve it,
But I get

''too many levels of recursion''

code_solve_system_of_equations.mw

## Is StringTools['StringBuffer'] outdated now?...

Since strings are not mutable objects in Maple, the package provides two procedures, StringTools:-OldStringBuffer and StringTools:-StringBuffer, which appear heavily correlated with Java's  and .

The help page of StringBuffer claims that use of a is much more efficient than the naive approach:

(*
G and F are taken from the link above.
*)
G := proc()
description "extremely inefficient string concatenator";
local   r;
r := proc()
if nargs = 0 then
""
elif nargs = 1 then
args[ 1 ]
else
cat( args[ 1 ], procname( args[ 2 .. -1 ] ) )
end if
end proc;
r( args )
end proc:
# # This can be transformed into an O(1) algorithm by passing a string buffer to the recursive calls.
F := proc()
description "efficient version of G";
local    b, r;
b := StringTools:-StringBuffer();
r := proc()
if nargs = 1 then
b:-append( args[ 1 ] )
else
b:-append( args[ 1 ] );
procname( args[ 2 .. -1 ] )
end if
end proc;
r( args ):-value()
end proc:
s := 'StringTools:-Random(10, print)' $1e4: NULL; time(G(s)); 5.375 time(F(s)); 1.125  But why not use the built-in cat directly? time(cat(s)); 0. time(StringTools:-Join([s], "")); 0.  Clearly, this is even more efficient Here is the last example in that link. FilterFile := proc( fname::string, filter ) local b, line; b := StringTools:-StringBuffer(); do line := readline( fname ); if line = 0 then break end if; b:-append( filter( line ) ) end do; b:-value() end proc: # verbatim filename__0 := FileTools:-JoinPath(["example", "odyssey.txt"], 'base' = 'datadir'): filename__1 := URL:-Download("https://gutenberg.org/ebooks\ /2600.txt.utf-8", "War-and-Peace.txt"): fclose(filename__0): time[real]((rawRes0 := FilterFile(filename__0, StringTools:-Unique))); 0.223 fclose(filename__1): time[real]((rawRes1 := FilterFile(filename__1, StringTools:-Unique))); 1.097  Nevertheless, close(filename__0): use StringTools, FileTools:-Text in time[real]((newRes0 := String(Support~(fscanf(filename__0, Repeat("%[^\n]%*c", CountLines(filename__0))))[]))) end; 0.118 close(filename__1): use StringTools, FileTools:-Text in time[real]((newRes1 := String(Support~(fscanf(filename__1, Repeat("%[^\n]%*c", CountLines(filename__1))))[]))) end; 0.580 evalb(newRes0 = rawRes0 and newRes1 = rawRes1); true  As you can see, these experiments just tell an opposite story. Isn't the so-called "StringBuffer" obsolete today ## The procedure can be operation when MM:=evalm(Hi.E... Asked by: restart: Digits:=30; h0:=0.156; d:=0.32*h0; l:=1; h1:=h0-d; h2:=h0+d; h3:=0.5*h0; g:=9.8; d1:=1; Term:=5; Num:=150: n:=1: l1:=l/n; p:=2; for N from 1 to Num do lambda:=2*n*Pi/l:## N1 wei sha ba tiao shu k0:=evalf(0.5*Pi+2*(N-1)*Pi/(Num-1)): tau0:=evalf(k0*h0): omega:=evalf((g*k0*tanh(k0*h0))^(1/2)): E:=g/(omega)^2: k1:=abs(fsolve(omega^2=g*k*tanh(k*h1),k)): tau1:=evalf(k1*h1): k2:=abs(fsolve(omega^2=g*k*tanh(k*h2),k)): tau2:=evalf(k2*h2): k3:=abs(fsolve(omega^2=g*k*tanh(k*h3),k)): tau3:=evalf(k3*h3): F:=tau->tanh(tau1)+tau*add((eval(diff(tanh(tau),tau$s),tau=tau1))/s!*(tau-tau1)^(s-1),s=1..10);##F1(K)

P:=tau->(sinh(2*tau)-2*tau*cosh(2*tau))/(2*tau+sinh(2*tau))^2;##P
Q:=tau->(16*tau^4+32*tau^3*sinh(2*tau)-9*sinh(2*tau)*sinh(4*tau)+12*tau*(tau+sinh(2*tau))*((cosh(2*tau))^2-2*cosh(2*tau)+3))/3/(2*tau+sinh(2*tau))^4; ##Q
A:=unapply(taylor(2*(tau-tau1)/sinh(2*tau)-tanh(tau)*(h0-E*tau*tanh(tau))*(2*tau+sinh(2*tau))/((E*tau*tanh(tau)-h2)*F(tau)*sinh(2*tau)),tau=tau1,Term+1),tau);##A(K)
B:=unapply(taylor((1+2*tau/sinh(2*tau))^2*(-(tau-tau1)/lambda^2/E/(E*tau*tanh(tau)-h2)/F(tau)-(h0-E*tau*tanh(tau))*(tau-tau1)*tanh(tau)/(E*tau*tanh(tau)-h2)/F(tau)*P(tau)+(tau-tau1)^2*Q(tau)),tau=tau1,Term+1),tau);##B(K)

for j from 0 to Term do
a[j]:=coeff(A(tau),tau-tau1,j):
b[j]:=coeff(B(tau),tau-tau1,j):
end do;

for m from 1 to Term do
f1[0]:=1;
f2[0]:=1;
end do;

CC:=unapply(taylor(2*(tau-tau2)/sinh(2*tau)-tanh(tau)*(h0-E*tau*tanh(tau))*(2*tau+sinh(2*tau))/(E*tau*tanh(tau)-h1)/T(tau)/sinh(2*tau),tau=tau2,Term+1),tau);
DD:=unapply(taylor((1+2*tau/sinh(2*tau))^2*(-(tau-tau2)/lambda^2/E/(E*tau*tanh(tau)-h1)/T(tau)-(h0-E*tau*tanh(tau))*(tau-tau2)*tanh(tau)/(E*tau*tanh(tau)-h1)/T(tau)*P(tau)+(tau-tau2)^2*Q(tau)),tau=tau2,Term+1),tau);

j:='j':
for j from 0 to Term do
cc[j]:=coeff(CC(tau),tau-tau2,j):
dd[j]:=coeff(DD(tau),tau-tau2,j):
end do;

i:='i':
f3[0]:=1;
f4[0]:=1;
m:='m':
for m from 1 to Term do
end do:

u0:=evalf(g*tanh(tau0)*(1+2*tau0/(sinh(2*tau0)))/(2*k0));
u01:=evalf(g*tanh(tau3)*(1+2*tau3/(sinh(2*tau3)))/(2*k3));
u1:=evalf(g*(1-(tanh(tau0))^2)*(sinh(2*tau0)-2*tau0*cosh(2*tau0))/(4*(2*tau0+sinh(2*tau0))));
H:=evalf((1+2*tau0/sinh(2*tau0))/(-lambda*k0*d));
delta00:=evalf((lambda*d*u1/u0+I*k0)*H);
delta01:=evalf((lambda*d*u1/u0-I*k0)*H);
delta11:=evalf((lambda*d*u1/u0+I*k0)*H*exp(I*k0*l));
delta12:=evalf((lambda*d*u1/u0-I*k0)*H*exp(-I*k0*l));
delta21:=evalf(exp(I*k0*(l1)));
delta22:=evalf(u0*k0*exp(I*k0*(l1)));
delta31:=evalf(exp(-I*k0*(l1)));
delta32:=evalf(-u0*k0*exp(-I*k0*(l1)));
delta41:=evalf(exp(I*k3*(l1)));
delta42:=evalf(u01*k3*exp(I*k3*(l1)));
delta51:=evalf(exp(-I*k3*(l1)));
delta52:=evalf(-u01*k3*exp(-I*k3*(l1)));
delta61:=evalf(exp(I*k3*(l1+d1)));
delta62:=evalf(u01*k3*exp(I*k3*(l1+d1)));
delta71:=evalf(exp(-I*k3*(l1+d1)));
delta72:=evalf(-u01*k3*exp(-I*k3*(l1+d1)));
Y11 := evalf(exp(k0*(l1 + d1)*I));
Y12 := evalf(-exp(-k0*(l1 + d1)*I));
Y21 := evalf(u0*k0*exp(k0*(l1 + d1)*I));
Y22 := evalf(-u0*k0*exp(-k0*(l1 + d1)*I));

G11 := evalf(exp(k0*(2*l1 + d1)*I));
G12 := evalf(-exp(-k0*(2*l1 + d1)*I));
G21 := evalf(u0*k0*exp(k0*(2*l1 + d1)*I));
G22 := evalf(-u0*k0*exp(-k0*(2*l1 + d1)*I));

W11 := evalf(exp(k3*(2*l1 + d1)*I));
W12 := evalf(-exp(-k3*(2*l1 + d1)*I));
W21 := evalf(u01*k3*exp(k3*(2*l1 + d1)*I));
W22 := evalf(-u01*k3*exp(-k3*(2*l1 + d1)*I));

Z11 := evalf(exp(k3*(2*l1 + 2*d1)*I));
Z12 := evalf(-exp(-k3*(2*l1 + 2*d1)*I));
Z21 := evalf(u01*k3*exp(k3*(2*l1 + 2*d1)*I));
Z22 := evalf(-u01*k3*exp(-k3*(2*l1 + 2*d1)*I));

V11:=evalf(exp(I*k0*2*(l1+d1)))；
V21:=evalf(u0*k0*exp(I*k0*2*(l1+d1)))；

delta91:=evalf(exp(I*k0*l));
delta92:=evalf(exp(-I*k0*l));

Hi:=(Matrix([[1,1],[delta00,delta01]]))^(-1);
H0:=Matrix([[1,1],[delta00,delta01]]);
H1:=(Matrix([[delta21,delta31],[delta22,delta32]]))^(-1);
H2:=Matrix([[delta41,delta51],[delta42,delta52]]);
H3:=(Matrix([[delta61,delta71],[delta62,delta72]]))^(-1);
H4 := Matrix([[Y11, Y12], [Y21, Y22]]);
H5 :=( Matrix([[G11, G12], [G21, G22]]))^(-1);
H6 := Matrix([[W11, W12], [W21, W22]]);
H7 := (Matrix([[Z11, Z12], [Z21, Z22]]))^(-1);
H8 := Matrix([[V11], [V21]]);

Ht:=Matrix([[1],[delta11]]);

e1:=Matrix([[evalf(xi11(tau0)),evalf(-xi12(tau0))],[evalf(eval(diff(xi11(tau),tau),tau=tau0)),evalf(eval(diff(-xi12(tau),tau),tau=tau0))]]);

e2:=(Matrix([[evalf(xi11(tau0)),evalf(xi12(tau0))],[evalf(eval(diff(xi11(tau),tau),tau=tau0)),evalf(eval(diff(xi12(tau),tau),tau=tau0))]]))^(-1);

EE:=evalm(e1.e2);

ee1:=Matrix([[evalf(xi21(tau0)),evalf(xi22(tau0))],[evalf(eval(diff(xi21(tau),tau),tau=tau0)),evalf(eval(diff(xi22(tau),tau),tau=tau0))]]);

ee2:=(Matrix([[evalf(xi21(tau0)),evalf(-xi22(tau0))],[evalf(eval(diff(xi21(tau),tau),tau=tau0)),evalf(eval(diff(-xi22(tau),tau),tau=tau0))]]))^(-1);
EEE:=evalm(ee1.ee2);

MM:=evalm(Hi.EE.EEE.H0.H1.H2.H3.H4.H5):
R:=evalf(MM[2,1]/MM[1,1]):
Kr:=abs(evalf(R)):
KR[N]:=abs(Kr);

end do:

N:='N':
seq(KR[N],N=1..Num);
with(plots):
listplot([seq([0.5+2*(N2-1)/(Num-1),KR[N2]],N2=1..Num)]);

 1 2 3 4 5 6 7 Last Page 3 of 2263
﻿