MaplePrimes Questions

Search Questions:

Hello guys
I'm having trouble solving a PDE using pdsolve-numerical. Here's a notebook attached.

I'm grateful if anyone can help.

Regards,

Oliveira

                   PDE1.mw

x := 19.073*Unit('m'^4*'kg'^2/('s'^6*'A'^2)); simplify(x); Units:-Simple:-simplify(x); Units:-Standard:-simplify(x); Units:-Natural:-simplify(x); convert(x, units, V^2); # None of the simplify commands do anything. Is there a way to get the last result?

This figure refuses to turn
Fig := proc(t) local a, b, P, Q, N, R, TG, x0, y0, p1, p2, p3, po, tp, sol; a := 11; b := 7; R := sqrt(a^2 + b^2); P := [R*sin(t), R*cos(t)]; x0 := P[1]; y0 := P[2]; TG := (a^2 - x0^2)*(y - y0)^2 + (b^2 - y0^2)*(x - x0)^2 + 2*y0*x0*(x - x0)*(y - y0) = 0; p1 := implicitplot(x^2/a^2 + y^2/b^2 - 1, x = -11 .. 11, y = -7 .. 7, color = blue); p2 := implicitplot(x^2 + y^2 - a^2 - b^2, x = -15 .. 15, y = -15 .. 15, color = blue); p3 := implicitplot(TG, x = -15 .. 15, y = -15 .. 15, color = red); sol := solve({x^2/a^2 + y^2/b^2 - 1 = 0, TG}, {x, y}, explicit); Q := [subs(sol[1], x), subs(sol[1], y)]; N := [subs(sol[2], x), subs(sol[2], y)]; po := plot([P, Q, N], style = point, symbolsize = 15, symbol = solidcircle, color = red); tp := textplot([[P[], "P"], [Q[], "Q"], [N[], "N"]], 'align' = {'above', 'left'}); display([p1, p2, p3, po, tp], scaling = constrained); end procnFig := 60;
Figs := seq(Fig(2*Pi*i/nFig), i = 0 .. nFig);
Error, (in Fig) invalid subscript selector
display(Figs, insequence = true);
NULL; Why this error message. Thank you.

Given matrix A, Please help me calculate A^100 by steps, without using Maple or calculators. Thank you so much!

I'm terribly sorry to ask such elementary questions.

I am getting started on Maple and the most trivial calculations are taking hours.

For example the expression:

b := exp(-i*varphi)*sin(theta/2)*cos(theta/2) + cos(theta/2)*exp(i*varphi)*sin(theta/2)

can be simplifed to           sin(theta)*Cos(Phi)

but no amount of commands such as simplify(b,trig) or combine(b, exp) will do it.

Any hits will be appreciated.

interface(version);

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

restart;
ode := diff(y(x),x)/y(x)-(3*(4*x^2+y(x)^2+1))/(2*x*(4*x^2+y(x)^2-2-2*x))=0;
DEtools:-odeadvisor(ode);
sol:=dsolve(ode,y(x));

(diff(y(x), x))/y(x)-(3/2)*(4*x^2+y(x)^2+1)/(x*(4*x^2+y(x)^2-2-2*x)) = 0

[_rational]

Error, (in dsolve) invalid subscript selector

 

Download error_jan_27_2023.mw

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?

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