MaplePrimes Questions

Maple can be set to calculate approximately/numerically for instance by adding af . e.g. calculate f(4.) instead of f(4), but it is possible to set Maple to default calculate, as if alle numbers were entered as "4." (even though I enter "4")?

How to slove this equation in Maple (get the optimal w), where y is a vector R(n*1), X is a matrix R(n*m), and w is a vector R(m*1),lambda is a scalar.

From a list of strings say

L:=[k$1,y$23,f$25,........]

A particular type of delimiter will their which is  common to all elements in the list the right side is always a number 

The function takes the list, and the delimiter as input

Then it outputs a list of 

Numbers which is on the right side of the delimiter 

Output will be like 

[1,23,25,...]

The delimiters could be a space 

Or 

Space on both sides of dollars

That is in understanding space should also be considered in delimiter that is anything significant 

Hello there, 

Is there any chance to ask this one question?

The attached (following) worksheet shows the result of LieDerivative operation, which is not correct. 

The correct answer is given in the image in the middle of the worksheet. Is there any particular reason regarding Maple's way of conducting the operation in that way?

restart;

with(LinearAlgebra):

with(DifferentialGeometry):

with(LieAlgebras):

DGsetup([x1, x2], M, verbose);

`The following coordinates have been protected:`

 

[x1, x2]

 

`The following vector fields have been defined and protected:`

 

[_DG([["vector", M, []], [[[1], 1]]]), _DG([["vector", M, []], [[[2], 1]]])]

 

`The following differential 1-forms have been defined and protected:`

 

[_DG([["form", M, 1], [[[1], 1]]]), _DG([["form", M, 1], [[[2], 1]]])]

 

`frame name: M`

(1)

 

M > 

f := evalDG((x2)*D_x1 + (c1 * (1 - x1^2) * x2 - c2 * x1)*D_x2);

_DG([["vector", M, []], [[[1], x2], [[2], -c1*x1^2*x2+c1*x2-c2*x1]]])

(2)
M > 

h := evalDG((x1)*D_x1 + (0)*D_x2);

_DG([["vector", M, []], [[[1], x1]]])

(3)
M > 

###### answer

M > 

M > 

LieDerivative(f, h);

_DG([["vector", M, []], [[[1], x2], [[2], x1*(2*c1*x1*x2+c2)]]])

(4)
M > 

 

Download Q20230307.mw

As2_v2.mw 

What should I fix my code in order to work?

Thanks in advance,

I am a newbie in the use of the Physics package.
As I'm interested in modeling dynamic articulated systems, I began reading the example about Mechanics (Statics).

My question is quite simple: let F some vector force of components a * _i and b * _j , what does abs(F) represent? 

I naively thought that abs(F)  was the modulus of F and expected it to be non negative. But I get some negative values (as in the tutorial example for some values of angle alpha.

Thanks in advance

I am trying to test types inside lists on the input to a procedure. Sometimes I can get this concept to work. 

This is a sample to show the problem. I need to know if the list has [ list[ $3] , Vector[column]($3) ] , or [ Vector[row]($3] , Vector [column]($3) ]

restart

 


        test:=proc(l1::[{[algebraic $ 3],'Vector[row](3, algebraic)'},'Vector[column](3, algebraic)'],l2::[{[algebraic $ 3],'Vector[row](3, algebraic)'},'Vector[column](3,algebraic)'])
        
        print("inputs recognised");

        end proc;

        

proc (l1::[{'Vector[row](3, algebraic)', [`$`(algebraic, 3)]}, 'Vector[column](3, algebraic)'], l2::[{'Vector[row](3, algebraic)', [`$`(algebraic, 3)]}, 'Vector[column](3, algebraic)']) print("inputs recognised") end proc

 

 

#  3d lines

l1:= [<1 | 5 | 7>, <3, 7, 9>]

[Vector[row](3, {(1) = 1, (2) = 5, (3) = 7}), Vector(3, {(1) = 3, (2) = 7, (3) = 9})]

l2:=[<-4 | 2 | 1>, <3, 8, -9>]

[Vector[row](3, {(1) = -4, (2) = 2, (3) = 1}), Vector(3, {(1) = 3, (2) = 8, (3) = -9})]

test(l1,l2)

Error, invalid input: test expects its 1st argument, l1, to be of type [{'Vector[row](3,algebraic)', [algebraic $ 3]}, 'Vector[column](3,algebraic)'], but received [Vector[row](3, [1,5,7]), Vector(3, [3,7,9])]

l3:= [[1 , 5 , 7], <3, 7, 9>]

[[1, 5, 7], Vector(3, {(1) = 3, (2) = 7, (3) = 9})]

l4:=[[-4 , 2 , 1], <3, 2, -9>]

[[-4, 2, 1], Vector(3, {(1) = 3, (2) = 2, (3) = -9})]

test(l3,l4)

Error, invalid input: test expects its 1st argument, l1, to be of type [{'Vector[row](3,algebraic)', [algebraic $ 3]}, 'Vector[column](3,algebraic)'], but received [[1, 5, 7], Vector(3, [3,7,9])]

type(l3[1],[algebraic $ 3])

true

type(l1[1],[algebraic $ 3])  

false

type(l1[1],'Vector[row](3, algebraic)')

true

type(l1[2],'Vector[column](3, algebraic)')

true

 

Download Q_2023-03-06_Proc_types_in_list_inputs.mw

This is second order ode solved using series method. This problem from textbook. The solution given by Maple does not match the book. I also solved this by hand and my hand solution agrees with the text book. I also solved this using Mathematica and its solution agrees with the book. 

Maple solution does not agree with the book for y2.  i.e. the general solution for this problem has the form 

    y= c_1 * y1 + c_2* (  y1 * ln(x)  +  y2 )

This is a Frobenius series method, since regular singular point and it falls into the hard case, where roots of indicial equation has difference of integer and where the second solution y2 can't be obtained using same method as y1 due to being undefined if using same method. So it require adjustment to the Frobenius series method.

This is ode

restart;
Order:=10;
ode:=x*diff(y(x),x$2)-3*diff(y(x),x)+x*y(x)=0;
dsolve(ode,y(x),'series')

Maple says that

   y2 = -144 - 36*x^2 + 1/2*x^6 - 25/1024*x^8 + ...)

First, it is missing x^4. And not able to make other coefficients match book. Book says y2 should be

   y2 = 1 + x^2/4 + x^4/64 - (11 x^6)/2304 + ....

And that is what I get and also Mathematica:

I do not have screen shot now of the page from the book to show. It is from an old textbook. Will try to make screen shot if needed.  This is problem 5, page 212 from SCHAUM's "differential equations" by Frank Ayers. 1952 edition. There is free PDF files on the net. Here is screen shot

My question is, why is Maple's series soluiton for the second basis solution y2 different? Could someone verify this? It also failes to verify it

restart;
ode:=x*diff(y(x),x$2)-3*diff(y(x),x)+x*y(x)=0;
Order:=10;
sol:=dsolve(ode,y(x),'series');
odetest(sol,ode,'series','point'=0)

 

Update

I've testsed few more problems, solved by hand and verified using Mathematica. All these problems give wrong solution by Maple for y_2. At least the solutions do not match the book and do not match my hand solution and do not match Mathematica. In all cases Mathematica's solution and my hand solution match the book. 

All these problem fall into the same difficult case of Frobenius series, where roots of indicial equation differ by integer and where y_2 can not be obtained directly using similar method used to obtain y_1. Other cases of Frobenius roots, Maple give complete correct general solutions. It is only this case where there seems to be something wrong.

In all of these problems below, y_1 solution is correct. It is the last series in y_2 shown which does not agree with book and it is this part which require using modifed method to obtain as explained on the book where these problems are solved from the above links. All the books used can be found online.

Please see attached worksheet.
 

interface(version);

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

#problem  problem 5, page 212 from SCHAUM's "differential equations" by Frank Ayers. 1952 edition.
ode:=x*diff(y(x),x$2)-3*diff(y(x),x)+x*y(x)=0:
sol:=dsolve(ode,y(x),'series');
odetest(sol,ode,'series','point'=0)

y(x) = c__1*x^4*(series(1-(1/12)*x^2+(1/384)*x^4-(1/23040)*x^6+(1/2211840)*x^8+O(x^10),x,10))+c__2*(ln(x)*(series(9*x^4-(3/4)*x^6+(3/128)*x^8+O(x^10),x,10))+(series(-144-36*x^2+(1/2)*x^6-(25/1024)*x^8+O(x^10),x,10)))

Warning, unable to compute series necessary to test the given solution

FAIL

#page 19, example 5. NASA report TR R-390. By Gabriel Allen (PDF online)
ode:=x^2*diff(y(x),x$2)+x*diff(y(x),x)+(x^2-4)*y(x)=0:
sol:=dsolve(ode,y(x),'series');
odetest(sol,ode,'series','point'=0)

y(x) = c__1*x^2*(series(1-(1/12)*x^2+(1/384)*x^4-(1/23040)*x^6+(1/2211840)*x^8+O(x^10),x,10))+c__2*(ln(x)*(series(9*x^4-(3/4)*x^6+(3/128)*x^8+O(x^10),x,10))/x^2+(series(-144-36*x^2+(1/2)*x^6-(25/1024)*x^8+O(x^10),x,10))/x^2)

Warning, unable to compute series necessary to test the given solution

FAIL

# problem 20.6, page 114 from SCHAUM's "differential equations" by Richard Bronson. 1978 edition.
ode:=x^2*diff(y(x),x$2)+(x^2-2*x)*diff(y(x),x)+2*y(x)=0:
sol:=dsolve(ode,y(x),'series');
odetest(sol,ode,'series','point'=0)

y(x) = c__1*x^2*(series(1-x+(1/2)*x^2-(1/6)*x^3+(1/24)*x^4-(1/120)*x^5+(1/720)*x^6-(1/5040)*x^7+(1/40320)*x^8-(1/362880)*x^9+O(x^10),x,10))+c__2*(x*ln(x)*(series(-x+x^2-(1/2)*x^3+(1/6)*x^4-(1/24)*x^5+(1/120)*x^6-(1/720)*x^7+(1/5040)*x^8-(1/40320)*x^9+O(x^10),x,10))+x*(series(1-x+(1/4)*x^3-(5/36)*x^4+(13/288)*x^5-(77/7200)*x^6+(29/14400)*x^7-(223/705600)*x^8+(481/11289600)*x^9+O(x^10),x,10)))

Warning, unable to compute series necessary to test the given solution

FAIL

# problem 20.7, page 115 from SCHAUM's "differential equations" by Richard Bronson. 1978 edition.
ode:=x^2*diff(y(x),x$2)+x*diff(y(x),x)+(x^2-1)*y(x)=0:
sol:=dsolve(ode,y(x),'series');
odetest(sol,ode,'series','point'=0)

y(x) = c__1*x*(series(1-(1/8)*x^2+(1/192)*x^4-(1/9216)*x^6+(1/737280)*x^8+O(x^10),x,10))+c__2*(ln(x)*(series(x^2-(1/8)*x^4+(1/192)*x^6-(1/9216)*x^8+O(x^10),x,10))/x+(series(-2+(3/32)*x^4-(7/1152)*x^6+(35/221184)*x^8+O(x^10),x,10))/x)

Warning, unable to compute series necessary to test the given solution

FAIL

 


 

Download series_solutions_Frob_difference_integer.mw

 

restart

with(plottools)

with(plots)

with(CurveFitting)

Digits := 100

"g(t):=10*(e)^((-(t-4000)^(2))/(1300000))+6*(e)^((-(t-6900)^(2))/(1400000))"

proc (t) options operator, arrow, function_assign; 10*exp(-(1/1300000)*(t-4000)^2)+6*exp(-(1/1400000)*(t-6900)^2) end proc

(1)

p0 := plot(g(t), t = 0 .. 20000, color = green); plots[display]({p0})

 

````

v := .7

disp := 15

PDE := diff(C(x, t), t) = -v*(diff(C(x, t), x))+disp*(diff(C(x, t), x, x))

IBC := C(x, 0) = 0, C(0, t) = g(t), (D[1](C))(10000, t) = 0

pds := pdsolve(PDE, [IBC], time = t, range = 0 .. 10000, timestep = 10, numeric, spacestep = 10)

_m2712135358688

(2)

k := pds:-plot(x = 6500, t = 0 .. 20000, numpoints = 600); plots[display]({k})

 

NULL

"f(t):= unapply(Spline( getdata(k)[3][..,1],getdata(k)[3][..,2],'t',degree=2),t): "

D1 := 15

E := 20000

L := 6500

n := 200

lambda = `&Sqrt;`(n*Pi/L, (1/2)*D1+`&Sqrt;`((1/4)*D1^2+E(`n&pi;`/L)^2))

"p(t):=(&int;)[0]^(L)f(t)  (e(-lambda^2 t) )^dt :"

Error, Got internal error in Typesetting:-Parse : "invalid subscript selector"

"p(t):=(&int;)[0]^Lf(t)  e(-lambda^2 t) dt :"

 

C(x, t) = sum((2*sin(`n&pi;x`/L)*exp(1)/L*sin(`n&pi;x`/L))*p(t), n = 1 .. 500)

Error, (in sum) summation variable previously assigned, second argument evaluates to 200 = 1 .. 500

 

uu20000 := [seq(evalf(C(20000-i, 5000)), i = 0 .. 20000, 100)]

``

xx := [seq(i, i = 0 .. 20000, 100)]

p1 := pds:-plot(t = 33000, numpoints = 150, color = red)

plots[display]({p1})

Download 1.mw

HI, I attach  a document (Pade_Approximants_for_alpha.mw) extract showing the errors (Error, (in Engine:-Dispatch) badly formed input to solve: not fully algebraic
).

Can any one help us please?

Thanks. Syed Asadullah Shah

For example from

sum(a[k]*(k+r)*(k+r-1)*x^(k+r-1), k = 0 .. infinity)

sum(a[k]*(k+r)*(k+r-1)*x^(k+r-1), k = 0 .. infinity)

(1)

by substituting k by k+1 to

sum(a[k+1]*(k+1+r)*(k+r)*x^(k+r), k = -1 .. infinity)

sum(a[k+1]*(k+1+r)*(k+r)*x^(k+r), k = -1 .. infinity)

(2)

Doing

subs(k = k+1, sum(a[k]*(k+r)*(k+r-1)*x^(k+r-1), k = 0 .. infinity))

sum(a[k+1]*(k+1+r)*(k+r)*x^(k+r), k+1 = 0 .. infinity)

(3)

leads to output that can't be processed further  

subsop(2 = 'k = -1 .. infinity', sum(a[k+1]*(k+1+r)*(k+r)*x^(k+r), k+1 = 0 .. infinity))

Error, (in sum) second argument must be a name, name=a..b, name=RootOf, or name=algebraic

 

NULL

Doing it programmatically this way

shift := k = k+1; rsd := (lhs-rhs)(shift); subs(shift, [op(sum(a[k]*(k+r)*(k+r-1)*x^(k+r-1), k = 0 .. infinity))]); lhs(%[2])+rsd = map(`+`, rhs(%[2]), rsd); sum(subsop(2 = %, `%%`)[])

sum(a[k+1]*(k+1+r)*(k+r)*x^(k+r), k = -1 .. infinity)

(4)

is not realy elegant and easy to understand.

Download shifting_index_in_sums.mw

Are there better ways?

Hi there,

i am working on an inverse z-transform in MAPLE. I would like to get the Impulse Response for a transferfunction with coefficients a, b, and c.

(z-1)^2/(a*z^2+b*z+c)

In maple, however I get the impulse response with sums over _alpha=RootOf(Z^2...). Through substitution of n = 0...end I get the right result, but for long impulse responses this takes quite a lot of time. With mathematica, however, the inverse z-transform is calculated to 1/(f(b,c)*(g(b,c,))^n+...), where f and g are functions of the coefficients. The function out of mathematica are quite faster to solve. How can I get Maple to solve this equation efficiently?

Greetings

Let A:=[1,2,1,6,6,2,1,1,1,4,5,2,4,5,6,7,1] say

Then I want find the

1) number of times each of the each of the element occurs
2) To multiple the number by the number of times it occurs

3) Then to multple the all these that is in the above

(3*(2)) *(3*(6))*(3*(2))*(2*(4))*(2*(5))*(1*(7))*(5*(1)) = need this value

Here we can observe 3 is the number of times 2 occurs 

3 is the number of times 6 occurs

similiary 5 is the number of times 1 occurs so on

Kind help

From https://maplesoft.zoom.us/webinar/register/WN_qidPG4qHRWGiTyO65vnGpw?timezone_id=Europe%2FParis

Is the recording of  Sneak Peek at Maple 2023 made on march 1,  available anywhere to see on Maple website or somewhere else? 

Update

Recording is at https://www.maplesoft.com/webinars/recorded/featured.aspx?id=2100  but need to first register/login if you are memeber of maplesoft.com

"The recording will start immediately after filling out the form."

In graph theory, the lexicographic product  or graph composition G ∙ H of graphs G and H is a graph such that

 - the vertex set of G ∙ H is the cartesian product V(G) × V(H); 
 - and any two vertices (u,v) and (x,y) are adjacent in G ∙ H if and only if either u is adjacent with x in G or u = x and v is adjacent with y in H.

 

Given two graphs, it is easy to obtain their lexicographic product. However the inverse process does not look so easy. 

Recognition problem: Given a graph G, can we guess whether there exist graphs G_1,...,G_k such that G=G_1 ∙ ⋯ ∙G_k ?

 

I read the book "Handbook of product graphs" and wiki, that say that the recognition complexity of lexicographic products is polynomially equivalent to the graph isomorphism problem

 

For the lexicographic product, I know that there is some algorithm without codes to implement the decomposition of the lexicographic products of a graph.

  • Feigenbaum, J.; Schäffer, A. A. (1986), "Recognizing composite graphs is equivalent to testing graph isomorphism", SIAM Journal on Computing, 15 (2): 619–627, doi:10.1137/0215045 (https://www.cs.yale.edu/homes/jf/FS-SICOMP86.pdf)

However, I did not understand the algorithm process mentioned in the article, nor did I see the program implementation of this algorithm. About 5 months ago, I asked similar questions on multiple platforms, but did not receive any feedback.