Maple 2022 Questions and Posts

These are Posts and Questions associated with the product, Maple 2022

I am new to Maple. I'm having trouble with simple caluclations such as the one in the image. The answer (after simplificatoin and cancellations) should be (|a|^2+|b|^2)(x^2 + y^2 + z^2)  but it's not happening! The result shown is correct; only the simplification is missing. What step am I missing?

The calculation is so simple, a look at the picture should suffice for the expert,

(sorry! I still don't know how to pick-off a single tab out from the whole workbook).

Question-2: judging from the missing overbar (complex conj) on z, the "assuming" seems to only apply to z and not x and y.

if that is correct, then why?

Question-3: How can I implement the constraint (|a|^2+|b|^2)=1 (preferably)before or after this  multiplication? I tried assume((|a|^2+|b|^2)=1), and though it compiled it did not help with the simplification.

TYVM

i have on ode with some parameters. it is ok and it is solved. but when i substitute the parameter itself, it is not solved, can i use any assumption to solve this? tnx for the help.

restart

ode := diff(T(x), x, x)+q/k = 0

diff(diff(T(x), x), x)+q/k = 0

(1)

dsolve(ode)

T(x) = -(1/2)*q*x^2/k+_C1*x+_C2

(2)

ics1 := -k*(D(T))(0) = h[1]*(T[inf1]-T(0)), -k*(D(T))(0.5e-1) = h[2]*(T(0.5e-1)-T[inf2])

-k*(D(T))(0) = h[1]*(T[inf1]-T(0)), -k*(D(T))(0.5e-1) = h[2]*(T(0.5e-1)-T[inf2])

(3)

dsolve({ics1, ode})

T(x) = -(1/2)*q*x^2/k-(1/40)*h[1]*(800*k*T[inf1]*h[2]-800*k*T[inf2]*h[2]-40*k*q-q*h[2])*x/((20*k*h[1]+20*k*h[2]+h[1]*h[2])*k)+(1/40)*(800*k*T[inf1]*h[1]+800*k*T[inf2]*h[2]+40*T[inf1]*h[1]*h[2]+40*k*q+q*h[2])/(20*k*h[1]+20*k*h[2]+h[1]*h[2])

(4)

ics2 := -k*(D(T))(0) = h[1]*(T[inf1]-T(0)), -k*(D(T))(L) = h[2]*(T(L)-T[inf2])

-k*(D(T))(0) = h[1]*(T[inf1]-T(0)), -k*(D(T))(L) = h[2]*(T(L)-T[inf2])

(5)

dsolve({ics2, ode})

Error, (in dsolve) found differentiated functions with same name but depending on different arguments in the given DE system: {T(L), T(x)}

 

``

Download ExactSol.mw

My question is can the last step be equal to 1/6.

I want to output to 1/6. it outputs to sqrt(9)/18 - (See Below).

NULL"5)Square root: undefined - DNE (Limit does not exist):"

NULL

NULL

NULL

limit((sqrt(x+1)-3)/(x-8), x = 8)"(=)"1/6 

 

 

limit((sqrt(x+1)-3)/(x-8), x = 8)Limit(((x+1)^(1/2)-3)/(x-8), x = 8) = (1/18)*9^(1/2)"(=)"Limit(((x+1)^(1/2)-3)/(x-8), x = 8) = 1/6

NULL

Download limit-sqrt-5.mw

What is the logic behind this?

expr:=(c[2]+x)^3;
simplify(expr)

Which is what expected. But 

expr:=(c[2]+x)^3+a;
simplify(expr)

gives

Which does not look simpler to me. I expected it to be the same as before but with "a" added.  This is what Mathematica gives for comparison

I know I can use simplify with size option. But my question is, how did Maple decide that x^3 + 3*x^2*c[2] + 3*x*c[2]^2 + c[2]^3 + a is "simpler" than (c[2] + x)^3 + a ? It must use some logic which I am trying to understand.

Maple 2022.2 on windows 10

 The following code:

for i to np do
    pl_pp[i] := point([h_p[i], m_p[i]], color = red);
    pl_np[i] := point([h_n[i], m_n[i]], color = blue);
    pl_pn[i] := point([-h_n[i], -m_n[i]], color = red);
    pl_nn[i] := point([-h_p[i], -m_p[i]], color = blue);
end do

Gives following error:

Error, (in plottools:-point) incorrect arguments for creating points structure, try providing the dimension option
 

Dear Maple community,

I am trying to define an operator in Maple that multiplies to an expression and substitutes the indices.

The issue is that I don't want to add the expression as input of the operator/function, sth like:

p := proc(i, j, z) option operator; subs({i = j, j = i}, z); end proc

I want it to act on expression, like:

P(i,j)*X(i,j,k)=X(j,i,k)

and X can be any tensor or matrix.

Thanks in advance.

The shortcut key Ctrl+Delete is used to clear a math region or delete a cell within a group, so I can delete some output manually. However, I find that there exists some long-standing functions like PrintTemporary and Monitor in Mathematica, which can be used to print intermediate values of variables temporarily (and dynamically, if possible). The term "temporarily" means that the printed output disappears at the end of a computation / when a computation is complete / when the evaluation finishes / before returning the result of an evaluation. For instance: 

(Note that certain operations require a front end.)

Is it possible to implement such functionalities in Maple? 

IndependencePolynomial returns the independence polynomial for the graph G in the variable x.

For the following example, its calculation took over 20 minutes and still hasn't produced a result, and what's fatal is that it  has consumed 4G  memory.

with(GraphTheory):
G:=ConvertGraph("W|tNHEpCKoh`@@Po_WHB@CKC?WGO{G?KKCB`?OMG?_y_?Sn");
G1:=LineGraph(G);
IndependencePolynomial(G1, x) # be careful

I use  codes in  the link https://github.com/pernici/hobj.

It produced results quickly (It takes approximately 5 seconds.). So I think the built-in function " IndependencePolynomial " should be able to be improved. (Of course we are usually very concerned about their coefficients) 

Their coefficients of the independent polynomial of G1 are as follows.

[340649, 12329124, 68797662, 140606548, 139481127, 77027880, 25546428, 5303544, 700911, 58580, 2982, 84, 1]

It tells me the total number of independence sets with size 12 is 340649. 

I have been unable to add a directed light source to my plot3d drawings.  Perhaps I am misreading the documentation.  In the following experiment, I attempt to shine a red light from the direction (phi,theta) but changing the values of phi and theta don't seem to change the scene's lighting.  Can you change the lighting in your Maple?

restart;
with(plottools):
with(plots):
Explore(display(sphere(), style=surface, color=yellow, light=[phi,theta,1,0,0]),
	phi=0..Pi, theta=0..Pi);

Why there is an error? Is any part missing in the if statement?

restart

rel := w+(1/2)*sqrt(960*c^6*gamma^2*k^2-336*c^4*gamma^2*k^4+64*c^2*gamma^2*k^6-4*gamma^2*k^8+576*alpha*c^6*gamma*k-288*alpha*c^4*gamma*k^3-16*alpha*c^2*gamma*k^5+8*alpha*gamma*k^7-144*alpha^2*c^4*k^2-48*alpha^2*c^2*k^4-4*alpha^2*k^6+128*c^4*gamma*k^2-40*c^2*gamma*k^4+4*gamma*k^6+48*alpha*c^4*k-16*alpha*c^2*k^3-4*alpha*k^5+4*c^2*k^2-k^4)

w+(1/2)*(960*c^6*gamma^2*k^2-336*c^4*gamma^2*k^4+64*c^2*gamma^2*k^6-4*gamma^2*k^8+576*alpha*c^6*gamma*k-288*alpha*c^4*gamma*k^3-16*alpha*c^2*gamma*k^5+8*alpha*gamma*k^7-144*alpha^2*c^4*k^2-48*alpha^2*c^2*k^4-4*alpha^2*k^6+128*c^4*gamma*k^2-40*c^2*gamma*k^4+4*gamma*k^6+48*alpha*c^4*k-16*alpha*c^2*k^3-4*alpha*k^5+4*c^2*k^2-k^4)^(1/2)

(1)

crit_points := solve(diff(rel, k) = 0, k); rel_at_crit := subs(k = crit_points, rel)

"#` determine the maxima and minima by checking the sign of the second derivative at the critical points`  for i from 1 to nops(crit_points) do    if (eval(diff(diff(rel, k), k), k = crit_points[i]) > 0) then      print("Minimum at k = ", crit_points[i], " with value ", rel_at_crit[i]);    else if (eval(diff(diff(rel, k), k), k = crit_points[i]) < 0) then      print("Maximum at k = ", crit_points[i], " with value ", rel_at_crit[i]);    else      print("Saddle point at k = ", crit_points[i], " with value ", rel_at_crit[i]);    end if;  end do; "

Error, invalid if statement termination

"#` determine the maxima and minima by checking the sign of the second derivative at the critical points`  for i from 1 to nops(crit_points) do    if (eval(diff(diff(rel, k), k), k = crit_points[i]) > 0) then   print("Minimum at k = ", crit_points[i], " with value ", rel_at_crit[i]);    else if (eval(diff(diff(rel, k), k), k = crit_points[i]) < 0) then   print("Maximum at k = ", crit_points[i], " with value ", rel_at_crit[i]);    else   print("Saddle point at k = ", crit_points[i], " with value ", rel_at_crit[i]);    end if;  end do; "

 

NULL

Download maxnmin.mw

I input this codes:

latex((4*n-1)/9-7/16*n)

\frac{n}{144}-\frac{1}{9}

This is not the output I expected.  I would like to obtain an expression similar to the one below.

\frac{4 n-1}{9}-\frac{7}{16}n

How can I achieve this, as Maple seems to have processed it internally.

Does maple over-understand the expression.

Hi, I would appreciate some help in solving the following system of partial differential equations. The particularity of the system is that only the individual variables (i.e. a, c, and l) depend on two arguments (t: current time period and v: date of birth). The other variables are either rates or aggregates. The aggregate variables (i.e. K, L, and Y) depend only on time, t, because they are the integrals of the individual variables over v. Thanks for your help.

NULL

NULL

restart; with(PDEtools)

alpha := .3306341; delta := solve(1+0.4877489e-1 = exp(delta_a)); T := 1

l0 := 42.375*(33.16667/(52*(24-9.95)*7)); L0 := l0*T

x0 := 0

IOR := .2093723865

KOR := IOR/delta

r0 := alpha/KOR-delta; rho := r0; fsolve({K0 = Y0*KOR, w0 = (1-alpha)*Y0/L0, alpha*exp(x0)*K0^(alpha-1)*L0^(1-alpha) = r0+delta}); assign(%)

0.2758153402e-1

 

{K0 = 2.510740299, Y0 = .5710794198, w0 = 1.390997088}

(1)

C0 := -K0*delta+Y0; c0 := C0/T

.4515111588

 

.4515111588

(2)

sigma := w0*(1-l0)/c0

2.234133040

(3)

eq1 := diff(c(t, v), t) = (r(t)-rho)*c(t, v)

eq2 := sigma*c(t, v) = w(t)*(1-l(t, v))

eq3 := r(t)*a(t, v)+w(t)*l(t, v) = c(t, v)+diff(a(t, v), t)

eq4 := Y(t) = exp(x(t))*K(t)^alpha*L(t)^(1-alpha)

eq5 := r(t)-delta = alpha*Y(t)/K(t)

eq6 := w(t) = (1-alpha)*Y(t)/L(t)

eq7 := K(t) = int(a(t, v), v = t-T .. t)

eq8 := L(t) = int(l(t, v), v = t-T .. t)

eq9 := x(t) = piecewise(t = 0, 0, t > 0, 0.1e-1)

eq := {eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9}

SV := {K(0) = K0, L(0) = L0, Y(0) = Y0, a(t, 0) = 0, c(0, 0) = c0, l(0, 0) = l0, r(0) = r0, w(0) = w0}

pdsolve(eq, SV, numeric, 'time' = t, 'range' = 0 .. T)

Error, (in pdsolve/numeric/process_PDEs) variable(s) {v} are in the PDE system but are not dependent or independent variables

 

sol := pdsolve(eq, SV, 'time' = t, 'range' = 0 .. T)

(4)

NULL

Download OLG.mw

Hi,

I have been bothered lately by the number format for axis labels in Maple. My problem existed before, but it apparently didn't bother me before. I have spent many hours trying to find an answer in the program help, in MaplePrimes, and in general online searches. I am not having any luck at all (good luck, that is).

I want to change the format of the axis numbering. Maple seems to default to 2 decimal places in my graph, and I really need more. Oddly, when I export the graph to PDF, I get another decimal place (even though I didn't explicitly ask for one). 

How do I change the axis-label format? Any idea what I might get when I export the graph?

Thanks for your help,

Jno.

 

How can I change the order of variables in a polynomial as I want? For example, I want to assign a polynomial G of 3 variables a,b,c. Then I want to compute G(a,b,c) (exchange the variable a to b, exchange variable b to a)?

First 11 12 13 14 15 16 17 Last Page 13 of 35