Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

How do you modify the column widths in an already created table?

I want to create the groups (Z/nZ)+ and (Z/nZ)*.

I can do this in python for n=7. I want to do this with other values of n.

(Z/7Z)+
   0 1 2 3 4 5 6
0 0 1 2 3 4 5 6
1 1 2 3 4 5 6 0
2 2 3 4 5 6 0 1
3 3 4 5 6 0 1 2
4 4 5 6 0 1 2 3
5 5 6 0 1 2 3 4
6 6 0 1 2 3 4 5
 
(Z/7Z)*
   1 2 3 4 5 6
1 1 2 3 4 5 6
2 2 4 6 1 3 5
3 3 6 2 5 1 4
4 4 1 5 2 6 3
5 5 3 1 6 4 2
6 6 5 4 3 2 1
 

I tried creating a Cayley table but can not get that right.

I started to use maple recently and I do not know why fsolve does not work in this case:

Sol-NLSE.mw

I am wondering if the conjugate(x[j]) is the reason.

Thanks in advance

In the Physics package.

How do I define arbitrary non-standard coordinates.

All that is available is the standard trivial cartesian, spherical and such coordinate systems.

Setup(Coordinatesystems = cartesian)

See e.g.

https://www.maplesoft.com/support/help/maple/view.aspx?path=Physics%2FRicci

This question was inspired by https://www.mapleprimes.com/questions/235613-Convert-A-List-With-Nested-Ordered-Sets.

I want to replace several characters of a string separately. 

s:="[ (0, 1), (1, 2), (1, 10), (2, 3), (3, 4), (4, 5), (4, 9), (5, 6), (6, 7), (7, 8),(8, 9), (10, 11), (11, 12), (11, 16), (12, 13), (13, 14), (14, 15), (15, 16)]"

Like this their will be many say n element then I need to a list as 

{{0,1},{1,2},{1,10},......}

I took the for-loop as follows, but I'm wondering if there's a more concise way to deal with it.

with(StringTools):
L:="[ (0, 1), (1, 2), (1, 10), (2, 3), (3, 4), (4, 5), (4, 9), (5, 6), (6, 7), (7, 8),(8, 9), (10, 11), (11, 12), (11, 16), (12, 13), (13, 14), (14, 15), (15, 16)]":    
L1:=["(",")","[","]"]:
L2:=["{","}","{","}"]:
X:=L:
for i from 1 to nops(L1) do
X:=SubstituteAll(X,L1[i],L2[i]);
end do:
parse(X)

{{0, 1}, {1, 2}, {1, 10}, {2, 3}, {3, 4}, {4, 5}, {4, 9}, {5, 6}, {6, 7}, {7, 8}, {8, 9}, {10, 11}, {11, 12}, {11, 16}, {12, 13}, {13, 14}, {14, 15}, {15, 16}}

I know that a function acting repeatedly can use f @@ n, for example,

(sin@@2)(x);

But if f  has some  arguments, can it still be used?

I am trying to call an optimization function for a set of operations where the object function contains integrals. i get this error when i try to do the optimization, i actually want to optimize a cost function, this is the error i get: Error, (in Optimization:-NLPSolve) integration range or variable must be specified in the second argument, got 1. = 4 .. 7

here is my work: 

a2 := 18;
b2 := 5;
a1 := 3;
b1 := 2.5;
ci := 0.05;
cr := 1;
cf := 10;
p := 0.1;
L := 0.5;
S := 3;
T := 10;
cud := 50;
co := 0.02;
tr := 0.006;
ti := 0.0014;
tf := 0.014;
K := 2;
A := 2;
M := 7;
f01 := x -> b1*(x/a1)^(b1 - 1)*exp(-(x/a1)^b1)/a1;
f02 := x -> b2*(x/a2)^(b2 - 1)*exp(-(x/a2)^b2)/a2;
fx := x -> p*f01(x) + (1 - p)*f02(x);
fh := h -> L*exp(-L*h);
Fh := h -> 1 - exp(-L*h);

P1_1 := (K, A, M) -> sum(int(fx(x)*(1 - Fh(i*A - x)), x = (i - 1)*A .. i*A), i = 1 .. K);
L1_1 := (K, A, M) -> sum((i*A + tr + i*ti)*P1_1(K, A, M), i = 1 .. K);
C1_1 := (K, A, M) -> sum((ci*i + cr)*P1_1(K, A, M), i = 1 .. K);
NULL;
P2_1 := (K, A, M) -> sum(int(fh(h)*fx(x), [h = 0 .. i*A - x, x = (i - 1)*A .. i*A]), i = 1 .. K);
L2_1 := (K, A, M) -> sum((tf + (i - 1)*ti)*int((x + h)*fh(h)*fx(x), [h = 0 .. i*A - x, x = (i - 1)*A .. i*A]), i = 1 .. K);
C2_1 := (K, A, M) -> sum(((i - 1)*ci + cf)*P2_1(K, A, M), i = 1 .. K);
P3_1 := (K, A, M) -> int(fh(h)*fx(x), [h = 0 .. M - x, x = A*K .. M]);
L3_1 := (K, A, M) -> (K*ti + tf)*int((x + h)*fh(h)*fx(x), [h = 0 .. M - x, x = A*K .. M]);
C3_1 := (K, A, M) -> (K*ci + cf)*P3_1(K, A, M);
P4_1 := (K, A, M) -> int(fx(x)*(1 - Fh(M - x)), x = A*K .. M);
L4_1 := (K, A, M) -> (K*ti + tr + M)*int(fx(x)*(1 - Fh(M - x)), x = A*K .. M);
C4_1 := (K, A, M) -> (K*ci + cr)*int(fx(x)*(1 - Fh(M - x)), x = A*K .. M);
P5_1 := (K, A, M) -> int(fx(x), x = M .. infinity);
L5_1 := (K, A, M) -> (K*ti + tr + M)*int(fx(x), x = M .. infinity);
C5_1 := (K, A, M) -> (K*ci + cr)*int(fx(x), x = M .. infinity);
Ptotal_1 := (K, A, M) -> P1_1(K, A, M) + P2_1(K, A, M) + P3_1(K, A, M) + P4_1(K, A, M) + P5_1(K, A, M);
Ptotal_1(K, A, M);
evalf(Ptotal_1(K, A, M));
Ltotal_1 := (K, A, M) -> L1_1(K, A, M) + L2_1(K, A, M) + L3_1(K, A, M) + L4_1(K, A, M) + L5_1(K, A, M);
evalf(Ltotal_1(K, A, M));
Ctotal_1 := (K, A, M) -> C1_1(K, A, M) + C2_1(K, A, M) + C3_1(K, A, M) + C4_1(K, A, M) + C5_1(K, A, M);
Cost_rate_1 := (K, A, M) -> Ctotal_1(K, A, M)/Ltotal_1(K, A, M);
integralOF := int(Cost_rate_1(K, A, M), x = 1 .. 2);
evalf(integralOF);
                          0.2759938793

MTBOF := Ltotal_1(K, A, M)/(P2_1(K, A, M) + P3_1(K, A, M));
evalf(MTBOF);
                          159.4642167

rd := 1/MTBOF;
ro := 1/M + rd;
const1 := 0 <= K;
const2 := K*A <= M;
const3 := M <= 20;
const4 := 0 <= A;
const5 := 0 <= M;
totalconstr := {const1, const2, const3, const4, const5};

optimized_cost := Optimization:-Minimize(integralOF, totalconstr);
Error, (in Optimization:-NLPSolve) integration range or variable must be specified in the second argument, got 1. = 4 .. 7
NULL;
 

please, i need assitance urgently.. thanks

  In my current worksheet mine.mw how do I automatically print/show the filename " mine.mw"

I have list say like this

[(0, 1), (1, 2), (1, 10), (2, 3), (3, 4), (4, 5), (4, 9), (5, 6), (6, 7), (7, 8), (8, 9), (10, 11), (11, 12), (11, 16), (12, 13), (13, 14), (14, 15), (15, 16)]

 

I want to convert it to

{{0,1},{1,2},{1,10},{2,3},.........}

And print the ouput to a file 

This I want the output as 

 

Graph({{0,1},{1,2},{1,10},{2,3},.........})

 

So that i can save the graph

like that all the order pairs in the above list 

 

I have given one list above here 

But if I have a list of lists like this below

[[(0, 1), (1, 2), (1, 10), (2, 3), (3, 4), (4, 5), (4, 9), (5, 6), (6, 7), (7, 8), (8, 9), (10, 11), (11, 12), (11, 16), (12, 13), (13, 14), (14, 15), (15, 16)], [(0, 10), (1, 2), (1, 9), (2, 3), (3, 4), (4, 5), (4, 9), (5, 6), (6, 7), (7, 8), (8, 9), (10, 11), (11, 12), (11, 16), (12, 13), (13, 14), (14, 15), (15, 16)],.......]

Like this their will be many say n element then I need to a list as 

[{{0,1},{1,2},{1,10},......}, {{0,10},......}, ....]

I ask for a list of graphs as I want the first graph in the first place only , second in the second place only.

Kind help

I would appreciate any help to solve the following Partial Differential Equation, which is a mix of partial and regular derivatives as coefficients.

How to solve it with/without initial conditions?

What is happening at f(0)?

Look at PlotProblem.mw

Dear Users,
I hope you are doing well. The following is the code to solve a nonlinear PD equation numerically and I plotted the graphs for T(y,t) sucessfully.

restart; with(plots); PDE1 := Pr*(diff(T(y, t), t)-Ree*(diff(T(y, t), y))) = (1+Nr*(T(y, t)+1)^3)*(diff(T(y, t), y, y))+3*Nr*(T(y, t)+1)^2*(diff(T(y, t), y))^2; ICandBC := {T(1, t) = 1, T(y, 0) = 1, (D[1](T))(0, t) = T(0, t)}; Ree := .1; Pr := 6.2; HA1 := [0, 1, 10]; AA := [red, green, blue, cyan, purple, black];
printlevel := 2; for i to nops(HA1) do Nr := op(i, HA1); print("Nr = ", %); PDE[i] := {PDE1}; pds[i] := pdsolve(PDE[i], ICandBC, numeric, spacestep = 1/200, timestep = 1/100); PlotsT[i] := pds[i]:-plot[display](T(y, t), t = 1, linestyle = "solid", labels = ["y", "u"], color = op(i, AA), numpoints = 800) end do;
display([`$`(PlotsT[j], j = 1 .. nops(HA1))], size = [1000, 600], axes = boxed, labels = [x, (convert("T", symbol))(x, T)], labelfont = ["Times", 14, Bold], labeldirections = [horizontal, vertical], axesfont = ["Arial", 14, Bold], thickness = 3)

I want to plot the graphs for (1+Nr*(T(y, t)+1)^3)*(diff(T(y, t), y)), at t = 1. Also want to plot diff(T(y, t), y) at y = 0 and y = 1 against Nr. Kindly help me in this matter.

Writing an explanatory paragrah i want to use an approximately equal symbol. How can I do this? The palette has lots of symbols but not what in latex would be done with \approx

I just tried to solve a very simple system of equations using solve but depending on how I write the system the command does out give any output. 

restart

solve({I__cm = m*r^2, r*T = I__cm*a/r, g*m-T = m*a}, {T, a})

solve({r*T = m*r^2*a*(1/r), g*m-T = m*a}, {T, a})

{T = (1/2)*m*g, a = (1/2)*g}

(1)

NULL

Solution with pencil and paper

T := (1/2)*m*g = (1/2)*m*gNULL

a := (1/2)*g = (1/2)*gNULL

Check this solution

evalb(g*m-T = m*a)

true

(2)

evalb(r*T = m*r^2*a*(1/r))

true

(3)

NULL


Notice that if I define I__cm then there is no solution being shown. I can rename I__cm to something else like y, still no output. Then in the second system I simply sub I__cm into the equation that has this variable, and it works.

So what's going on here? Why doesn't the first use of solve work?

Download solveSys.mw

How to read the topological structure of chemical from a SMILES file in Maple 

As I want only the physical structure of the molecule

Like in molecular data it gives the bonds of topology {1,2} like the structure it gives

As SMILES can give 2D structure to me 

Kind help how to do 

My following code:

restart;
PDE := diff(u(x, t), t) + u(x, t)*diff(u(x, t), x) - 0.1*diff(diff(u(x, t), x), x) = 0;
IC := u(x, 0) = sin(x);
BC := [u(0, t) = u(2*Pi, t)];
pds := {BC, IC, PDE};
ds := {pds, t = 0 .. 10, x = 0 .. 2*Pi};
p := pdsolve(ds, numeric);
u := rhs(p[1]);
u(x, t);

producing following 2 errors, don't know how to handle?

Error, (in anonymous procedure called from pdsolve/numeric) invalid terms in sum: 0 .. 10
Error, invalid input: rhs received p[1], which is not valid for its 1st argument, expr

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