Maple 2023 Questions and Posts

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

Hi,

is there fix for the following quirk in the Maple 2023 editor:

randomly (hours, days) some characters change their appearance like p.e. the = sign becomes d-bold or sigma becomes s-bold. I have never experienced this in previous versions.

Thanks in advance.

is it possible to find why Maple fails to solve these two equations in two unknowns? Has this always been the case? I do not have older versions of Maple to check. The trace shows that it found solution but then itg says no solution was found. This is very strange.

17020

interface(version)

`Standard Worksheet Interface, Maple 2023.2, Windows 10, November 24 2023 Build ID 1762575`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1622. The version installed in this computer is 1618 created 2023, November 29, 17:28 hours Pacific Time, found in the directory C:\Users\Owner\maple\toolbox\2023\Physics Updates\lib\`

restart;

17020

sol:=1/4*exp(-t) * (c2*(-1+exp(4*t)) + c1*(3+exp(4*t))):
expand(simplify(sol));

-(1/4)*c2/exp(t)+(1/4)*(exp(t))^3*c2+(3/4)*c1/exp(t)+(1/4)*(exp(t))^3*c1

eq1:=-3=eval(sol,t=4):
expand(simplify(eq1));

-3 = (1/4)*c1*exp(12)+(1/4)*c2*exp(12)+(3/4)*exp(-4)*c1-(1/4)*exp(-4)*c2

eq1:=-17=eval(diff(sol,t),t=4);
expand(simplify(eq1));

-17 = -(1/4)*exp(-4)*(c2*(-1+exp(16))+c1*(3+exp(16)))+(1/4)*exp(-4)*(4*c2*exp(16)+4*c1*exp(16))

-17 = (1/4)*exp(-4)*c2+(3/4)*c2*exp(12)-(3/4)*exp(-4)*c1+(3/4)*c1*exp(12)

infolevel[solve]:=5;
solve([eq1,eq2],[c1,c2])

5

Main: Entering solver with 2 equations in 2 variables

Main: attempting to solve as a linear system

Linear: solving 2 linear equations

Algebraic: # equations is: 2

Main: Linear solver successful. Exiting solver returning 1 solution

solve: Warning: no solutions found

[]

Download unable_to_solve_2_equations_dec_26_2023.mw

For reference this is the solution given by Mathematica

 

I thought I was improving my code by adding ::type to all the _self in my OOP code. As this is one main advantage in programming in Maple, which is being able to attach types to all name and variables. Make code more robust.

But it turned out Maple is not very happy now and gives that drearded error

    Error, static procedure ... refers to non-static local or export ... in surrounding scope

Only place I found that adding ::type_name is to _self is allowed, is on the constructor signature.

But in no other method of the object module. local or export method, it does not matter. 

My question is, why is that?

So I went and removed all those _self::type_name and made it just _self to make Maple happy.

I also noticed this happes regardless of having kernelopts('assertlevel'=2): there or not.  Attached  is the worksheet.

Just tryting to understand the logic, that is all. 

This is using Maple 2023.2.1

interface(version)

`Standard Worksheet Interface, Maple 2023.2, Windows 10, November 24 2023 Build ID 1762575`

restart;

24100

interface(warnlevel=4);
kernelopts('assertlevel'=2):

3

A:=module()

  export module person()
   option object;
   local m_name::string;
   local m_age::integer;
   export ModuleCopy::static:=proc(_self::A:-person,proto::A:-person,name::string,age::integer,$)
          _self:-m_age := age;
          _self:-m_name:=name;
          NULL;
   end proc;
   export name::static:=proc(_self,$) m_name; end proc;
   export age::static:=proc(_self,$) m_age; end proc;
 end module;

export  module young_person()
   option object;
   local m_person::A:-person;
   export ModuleCopy::static:=proc(_self::A:-young_person,proto::A:-young_person,p::A:-person,$)
          _self:-m_person := p;     
          _self:-process_it();    
   end proc;
   local process_it::static:=proc(_self,$)
         print(m_person:-name());
         print(m_person:-age());
   end proc;

   #to fix the problem, check _self::A... to just _self,  then no error!
   export process_it_from_outside::static:=proc(_self::A:-young_person,$)
         print(m_person:-name());
         print(m_person:-age());
   end proc;

end module;

end module;

_m2782933017664

o:=Object(A:-person,"me",99);

module person () local m_name::string, m_age::integer; option object; end module

p:=Object(A:-young_person,o);

 

Error, static procedure `young_person:-process_it_from_outside` refers to non-static local or export `young_person:-m_person::A:-person` in surrounding scope

 


Download why_adding_type_on_self_gives_error.mw

I am an ophthalmologist and a novice in programing. I am having a problem obtaining the x-y coordinate equations for each of the fitted Splines.  I can send the raw data and MapleSoft work sheet for which I need the individual spline equations, in x-y coodinates not parametric format and also need to be able to plot the splines on the raw data. I will pay for the service. Can you please obtain the x-y Cartesian equations for each of the fitted Splines and give me a step-wise method for obtaining them?  I am unable to attach the raw data and the worksheet to this email.  Please send me your personal email so that I can send them.

Your assistance is most appreciated. 

With my best,
Ron
Ronald A Schachar MD , PhD
7241 Encelia Drive
La Jolla, CA 92037
Cell: (858) 784-1705
Email: ron@2ras.com

WHen using _self in object, help says

"As of Maple 2021, if the method has a formal parameter named _self, references
to its object's local or exported variables may be written without prefixing them.
That is, _self:-variable may be written as just variable. Maple will
add the self:- prefix internally when the method is simplified."

And the above is true for all static methods inside an object module, except for ModuleCopy which is also static.

It seems ModuleCopy is special. But why?  I am thinking it is because at time this is called, the object itself does not yet exist, but for all other methods, the object by then is fully constructed. But wanted to be sure.

Here is an example

restart;

person := module()
option object;
local  m_name::string;
local  m_age::integer;
export ModuleCopy :: static := proc(_self :: person
                                   , proto :: person, name::string, age::integer,$
                                )
         m_age := age;
         m_name := name;
    end proc;

export name::static:= proc(_self, $);
    RETURN(m_name); #no need to write _self:-m_name;
    end proc;

export age::static:= proc(_self, $);
    RETURN(m_age); #no need to write _self:-m_age;
    end proc;

export set_name::static:= proc(_self, name, $);
    m_name := name;   #no need to write _self:-m_name := name
    NULL;
    end proc;

export process::static:=proc(_self,$)
   print("name is ",m_name," age is ",m_age);
end proc;

end module:

And now


o:=Object(person,"me",10);

Error, static procedure `ModuleCopy` refers to non-static local or export `m_age::integer` in surrounding scope

Changing ModuleCopy to

export ModuleCopy :: static := proc(_self :: person
                                   , proto :: person, name::string, age::integer,$
                                )
         _self:-m_age := age;
         _self:-m_name := name;
    end proc;

Now there is no error. But notice that in all other static methods, I can write  m_name directly without using _self:-m_name;

I looked at help page for ModuleCopy but see no mention of this.

Why ModuleCopy is different?

Maple 2023.2 on windows 10

How would I solve for the product of two terms ( s*V or s^2*V). This is a simple example but I would be applying this on much higher order equations.

     V = Vx/(a*s^2 + b*s + c)

As a part of my learning curve, I am trying to play with extending Maple's BernsteinBasis, which has only a limited support right now (BernsteinBasis - Maple Help (maplesoft.com)).

My goal is to implement basis operation on polynomials in Bernstein basis, so that derivatives, integrals and products of polynomials in  BernsteinBasis would be again expressed in BernsteinBasis.

While it looks like it is relatively easy to extend diff procedure, by using `diff/BernsteinBasis`, I didn't find anything similar for the int. Is there something like `int/BernsteinBasis`?

The problem is that when I am trying to implement my own int procedure in a module that  would extend standard int, it seems I need to manually implement logic for (at very least) linearity, so that int(p(x) + q(x), x) would decay into int(p(x), x) + int(q(x), x ) (I probably don't need more complex rewriting rules). So before trying this approach, is there any easy way such as with diff?
 

restart;

read("C:\\Users\\Igor\\Maple\\BernsteinPolynomials.mpl");

_m2141342686560

(1)

# General formula
diff(BernsteinBasis(k, n, a, b, x), x);

n*BernsteinBasis(k-1, n-1, a, b, x)/(b-a)-n*BernsteinBasis(k, n-1, a, b, x)/(b-a)

(2)

# In expressions
diff(2*x*BernsteinBasis(1, 2, 0, 1, x) + BernsteinBasis(2, 2, 0, 1, x), x);

2*BernsteinBasis(1, 2, 0, 1, x)+2*x*(2*BernsteinBasis(0, 1, 0, 1, x)-2*BernsteinBasis(1, 1, 0, 1, x))+2*BernsteinBasis(1, 1, 0, 1, x)

(3)

# Convertion to MatrixPolynomialObject works
p := diff(BernsteinBasis(1, 2, 0, 1, x) + BernsteinBasis(2, 2, 0, 1, x), x);
P := convert(p, MatrixPolynomialObject, x);
P:-Value(a);

p := 2*BernsteinBasis(0, 1, 0, 1, x)

 

P := Record(Value = Default[value], Variable = x, Degree = 1, Coefficient = coe, Dimension = [1, 1], Basis = BernsteinBasis, BasisParameters = [1, 0, 1], IsMonic = mon, OutputOptions = [shape = [], storage = rectangular, order = Fortran_order, fill = 0, attributes = []])

 

Matrix(%id = 36893490288797933188)

(4)

# Now, integrataion
with(BernsteinPolynomials);

[int]

(5)

# Still works
int(x^2, x);

(1/3)*x^3

(6)

# Not implemented but will be added later...
int(BernsteinBasis(1, 2, 0, 1, x), x);

"Will be implemented here..."

 

int(BernsteinBasis(1, 2, 0, 1, x), x)

(7)

# This is the problem: how to implement basis properties such as linearity?
int(2 * BernsteinBasis(1, 2, 0, 1, x), x);

int(2*BernsteinBasis(1, 2, 0, 1, x), x)

(8)

 

 

BernsteinPolynomials := module()
    description "Basic operations in Bernstein basis";
	option package;
	global BernsteinBasis, `diff/BernsteinBasis`;
	export int;

	BernsteinBasis := proc(k, n, a, b, x)
		description "Bernstein basis polynomial";
		if k::numeric then
			if k < 0 then 
				return 0;
			end if
		end if;
		if n::numeric then
			if n < 0 then 
				return 0; 
			end if;
			if k::numeric then
				if k > n then
					return 0;
				end if;
			end if;
		end if;
		'procname'(_passed)
	end proc;

	`diff/BernsteinBasis` := proc()
		description "Derivative of the Bernstein basis polynomial in the Bernstein basis";
		if _npassed = 6 then
			if _passed[-1] = _passed[-2] then
				_passed[2] * BernsteinBasis(_passed[1] - 1, _passed[2] - 1, _passed[3], _passed[4], _passed[5]) / (_passed[4] - _passed[3]) -
				_passed[2] * BernsteinBasis(_passed[1], _passed[2] - 1, _passed[3], _passed[4], _passed[5]) / (_passed[4] - _passed[3]);
			end if;
		end if;
	end proc;
	
	int := proc()
		description "Integral of the Bernstein basis polynomial in the Bernstein basis";
		if type(_passed[1], 'specfunc'(anything, BernsteinBasis)) then
		    print("Will be implemented here...");
		end if;
		:-int(_passed)
	end proc;

end module;

Download bernstein.mw

In my code, without knowing what the expression is, other than it has RootOf, the code called allvalues and got internal error 

Error, (in SolveTools:-Basis) invalid input: igcd received 5/7, which is not valid for its 2nd argument

Is this to be expected depending on the input, or is this some internal problem I need to report?

restart;
expr:=RootOf(R^4*b+R^2*a*_Z+2*_Z^2-exp(RootOf(tanh(1/2*(a^2-8*b)^(1/2)*(4*S-_Z)/a)^2*R^4*a^2-8*tanh(1/2*(a^2-8*b)^(1/2)*(4*S-_Z)/a)^2*R^4*b-R^4*a^2+8*R^4*b-8*exp(_Z))))

allvalues(expr)

Error, (in SolveTools:-Basis) invalid input: igcd received 5/7, which is not valid for its 2nd argument

Maple 2023.2 on windows 10

ps.  Reported to Maplesoft

In an old question, @mbras asked for a "partial" `convert/elsymfun`. However, SymPy's sympy.polys.rings.PolyElement.symmetrize seems to provide more examples that cannot be handled by the program that appeared in that question.
For instance, 

>>> from sympy import var
>>> var('x:z,p:r')
(x, y, z, p, q, r)
>>> from sympy.polys.polyfuncs import symmetrize
>>> symmetrize(x**2-(y**2+2**z),[y,x],formal=True,symbols=[p+p,q*q])[0]
-2**z - 4*p**2 + 2*q**2
>>> symmetrize(x*x*y+y*y*z+z*z*x,[y,x,z],formal=True,symbols=[p,q,r])
(0, x**2*y + x*z**2 + y**2*z, [(p, x + y + z), (q, x*y + x*z + y*z), (r, x*y*z)])

Though I can , can't the built-in  be generalized to such expressions (in other words, write the polynomial part of input as a symmetric part and a remainder with (named, if need be) elementary symmetric polynomials)?

Besides, since any symmetric polynomial can also be expressed in terms of the complete symmetric polynomials, is there a similar  command in Maple?

Why does _EnvLinalg95 only affect  (and ) and not and ? 
 

restart;

m := <3 , 4 | 4 , 3>;

m := Matrix(2, 2, {(1, 1) = 3, (1, 2) = 4, (2, 1) = 4, (2, 2) = 3})

(1)

LinearAlgebra:-Eigenvalues(m);

Vector(2, {(1) = 7, (2) = -1})

(2)

LinearAlgebra:-Eigenvectors(m);

Vector(2, {(1) = -1, (2) = 7}), Matrix(2, 2, {(1, 1) = -1, (1, 2) = 1, (2, 1) = 1, (2, 2) = 1})

(3)

LinearAlgebra:-EigenConditionNumbers(m);

Vector(2, {(1) = 1.00000000000000, (2) = 1.00000000000000}), Vector(2, {(1) = 8., (2) = 8.})

(4)

_EnvLinalg95 := true:

whattype(m);

Matrix

(5)

LinearAlgebra:-Eigenvalues(m);

Vector(2, {(1) = 7, (2) = -1})

(6)

LinearAlgebra:-Eigenvectors(m):

Error, (in Matrix) invalid input: `Matrix/MakeInit` expects its 1st argument, initializer, to be of type list(list), but received [proc (i, j) options operator, arrow; `if`(j = 1 and i <= 2, (Vector(2, {(1) = 1, (2) = 1}))[i], rhs(fill_opt)) end proc]

 

LinearAlgebra:-EigenConditionNumbers(m);

Vector(2, {(1) = 1.00000000000000, (2) = 1.00000000000000}), Vector(2, {(1) = 8., (2) = 8.})

(7)

_EnvLinalg95 := false:

LinearAlgebra:-Eigenvectors(m);

Vector(2, {(1) = -1, (2) = 7}), Matrix(2, 2, {(1, 1) = -1, (1, 2) = 1, (2, 1) = 1, (2, 2) = 1})

(8)


 

Download _EnvLinalg95.mw

I have read the help page of Eigenvectors but couldn't find anything related.

This looks like a bug I have not seen before. Any one seen this before?

Error, (in Handlers:-TrigExpOnly) cannot determine if this expression is true or false: tr_is_cos

Can others reproduce it? I am using Maple 2023.2 on windows 10

btw, I found that by doing int(evala(integrand),t) instead of int(integrand,t) then the error goes away but not all the time. Below are two examples. The first where evala() fixes it, but the second it does not fix it. 

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1585 and is the same as the version installed in this computer, created 2023, October 29, 6:31 hours Pacific Time.`

interface(version);

`Standard Worksheet Interface, Maple 2023.2, Windows 10, October 25 2023 Build ID 1753458`

restart;

15332

integrand:=-(((sqrt(3)*sqrt(27983)*I + 276)*(-594 + 6*I*sqrt(3)*sqrt(27983))^(1/3) + 15*I*sqrt(3)*sqrt(27983) + (25*(-594 + 6*I*sqrt(3)*sqrt(27983))^(2/3))/2 + 2265)*(-150 + (-150 + (-594 + 6*I*sqrt(3)*sqrt(27983))^(2/3))*sqrt(3)*I - (-594 + 6*I*sqrt(3)*sqrt(27983))^(2/3) + 24*(-594 + 6*I*sqrt(3)*sqrt(27983))^(1/3))*(150 + (-150 + (-594 + 6*I*sqrt(3)*sqrt(27983))^(2/3))*sqrt(3)*I + (-594 + 6*I*sqrt(3)*sqrt(27983))^(2/3) - 24*(-594 + 6*I*sqrt(3)*sqrt(27983))^(1/3))*((sqrt(3)*sqrt(27983)*I + 276)*(-594 + 6*I*sqrt(3)*sqrt(27983))^(1/3) - 15*I*sqrt(3)*sqrt(27983) - 2265)*exp(-t*((-594 + 6*I*sqrt(83949))^(2/3)/3 + (-594 + 6*I*sqrt(83949))^(1/3) + 50)/(-594 + 6*I*sqrt(83949))^(1/3))*(-594 + 6*I*sqrt(3)*sqrt(27983))^(2/3)*((-594 + 6*I*sqrt(3)*sqrt(27983))^(2/3) + 12*(-594 + 6*I*sqrt(3)*sqrt(27983))^(1/3) + 150)*sin(t)*cos(t))/(10101630528*(sqrt(3)*sqrt(27983)*I - 99)^2*(sqrt(3)*sqrt(27983)*I + 27983/33)*exp(t)) - ((-594 + 6*I*sqrt(83949))^(2/3) + 12*(-594 + 6*I*sqrt(83949))^(1/3) + 150)*(2*I*sqrt(83949)*(-594 + 6*I*sqrt(83949))^(1/3) + 30*I*sqrt(83949) + 25*(-594 + 6*I*sqrt(83949))^(2/3) + 552*(-594 + 6*I*sqrt(83949))^(1/3) + 4530)*(-594 + 6*I*sqrt(83949))^(1/3)*(sqrt(83949)*(-594 + 6*I*sqrt(83949))^(1/3)*I - 15*I*sqrt(83949) + 276*(-594 + 6*I*sqrt(83949))^(1/3) - 2265)*exp(-t*((-594 + 6*I*sqrt(83949))^(2/3)/3 + (-594 + 6*I*sqrt(83949))^(1/3) + 50)/(-594 + 6*I*sqrt(83949))^(1/3))*(8*cos(t)^2/exp(t) - 4/exp(t))/(5196312*(sqrt(83949)*I + 27983/33)*(sqrt(83949)*I - 99)) + ((-594 + 6*I*sqrt(83949))^(2/3) + 12*(-594 + 6*I*sqrt(83949))^(1/3) + 150)*(2*I*sqrt(83949)*(-594 + 6*I*sqrt(83949))^(1/3) + 30*I*sqrt(83949) + 25*(-594 + 6*I*sqrt(83949))^(2/3) + 552*(-594 + 6*I*sqrt(83949))^(1/3) + 4530)*(-150 + (-594 + 6*I*sqrt(83949))^(2/3))*(-594 + 6*I*sqrt(83949))^(2/3)*exp(-t*((-594 + 6*I*sqrt(83949))^(2/3)/3 + (-594 + 6*I*sqrt(83949))^(1/3) + 50)/(-594 + 6*I*sqrt(83949))^(1/3))/(1154736*(sqrt(83949)*I + 27983/33)*(sqrt(83949)*I - 99)*exp(t)):

int(integrand,t)

Error, (in Handlers:-TrigExpOnly) cannot determine if this expression is true or false: tr_is_cos

 

Download handler_trig_exp_only_nov_18_2023.mw

But the trick of using evala() to avoid this error does not always work. Here is an example below. So need to find another workaround for this.

restart;

18704

interface(version);

`Standard Worksheet Interface, Maple 2023.2, Windows 10, October 25 2023 Build ID 1753458`

integrand2:=1/40406522112*I*(-594+6*I*3^(1/2)*27983^(1/2))^(2/3)*exp(t*(5/3*3^(1/2)*2^(1/2)
*sin(1/3*arctan(1/99*83949^(1/2))+1/6*Pi)-5*cos(1/3*arctan(1/99*83949^(1/2))+1/
6*Pi)*2^(1/2)-1))*(150+I*(-150+(-594+6*I*3^(1/2)*27983^(1/2))^(2/3))*3^(1/2)+(-\
594+6*I*3^(1/2)*27983^(1/2))^(2/3)-24*(-594+6*I*3^(1/2)*27983^(1/2))^(1/3))*(
2265+(276+I*(27983^(1/2)+92)*3^(1/2)-27983^(1/2))*(-594+6*I*3^(1/2)*27983^(1/2)
)^(1/3)+5*I*(-151+3*27983^(1/2))*3^(1/2)+15*27983^(1/2))*(2265-25*(-594+6*I*3^(
1/2)*27983^(1/2))^(2/3)+(276+I*(-276+27983^(1/2))*3^(1/2)+3*27983^(1/2))*(-594+
6*I*3^(1/2)*27983^(1/2))^(1/3)+15*I*(151+27983^(1/2))*3^(1/2)-45*27983^(1/2))*(
(-594+6*I*3^(1/2)*27983^(1/2))^(2/3)+12*(-594+6*I*3^(1/2)*27983^(1/2))^(1/3)+
150)*3^(1/2)*(-150+I*(-150+(-594+6*I*3^(1/2)*27983^(1/2))^(2/3))*3^(1/2)-(-594+
6*I*3^(1/2)*27983^(1/2))^(2/3)+24*(-594+6*I*3^(1/2)*27983^(1/2))^(1/3))/(I*3^(1
/2)*27983^(1/2)+27983/33)/(I*3^(1/2)*27983^(1/2)-99)^2/exp(t)*sin(t)*cos(t)-1/
20785248*I*(I*(-594+6*I*3^(1/2)*27983^(1/2))^(2/3)*3^(1/2)+(-594+6*I*3^(1/2)*
27983^(1/2))^(2/3)-150*I*3^(1/2)-24*(-594+6*I*3^(1/2)*27983^(1/2))^(1/3)+150)*
exp(5/3*3^(1/2)*sin(1/3*arctan(1/99*83949^(1/2))+1/6*Pi)*2^(1/2)*t-5*cos(1/3*
arctan(1/99*83949^(1/2))+1/6*Pi)*2^(1/2)*t-t)*(2265-25*(-594+6*I*3^(1/2)*27983^
(1/2))^(2/3)+(276+I*(-276+27983^(1/2))*3^(1/2)+3*27983^(1/2))*(-594+6*I*3^(1/2)
*27983^(1/2))^(1/3)+15*I*(151+27983^(1/2))*3^(1/2)-45*27983^(1/2))*(2265+(276+I
*(27983^(1/2)+92)*3^(1/2)-27983^(1/2))*(-594+6*I*3^(1/2)*27983^(1/2))^(1/3)+5*I
*(-151+3*27983^(1/2))*3^(1/2)+15*27983^(1/2))*(-594+6*I*3^(1/2)*27983^(1/2))^(1
/3)*3^(1/2)/(I*3^(1/2)*27983^(1/2)+27983/33)/(I*3^(1/2)*27983^(1/2)-99)*(8/exp(
t)*cos(t)^2-4/exp(t))+1/13856832*I*(-594+6*I*3^(1/2)*27983^(1/2))^(2/3)*(-450+I
*(-150+(-594+6*I*3^(1/2)*27983^(1/2))^(2/3))*3^(1/2)-3*(-594+6*I*3^(1/2)*27983^
(1/2))^(2/3))*exp(t*(5/3*3^(1/2)*2^(1/2)*sin(1/3*arctan(1/99*83949^(1/2))+1/6*
Pi)-5*cos(1/3*arctan(1/99*83949^(1/2))+1/6*Pi)*2^(1/2)-1))*(150+I*(-150+(-594+6
*I*3^(1/2)*27983^(1/2))^(2/3))*3^(1/2)+(-594+6*I*3^(1/2)*27983^(1/2))^(2/3)-24*
(-594+6*I*3^(1/2)*27983^(1/2))^(1/3))*(2265-25*(-594+6*I*3^(1/2)*27983^(1/2))^(
2/3)+(276+I*(-276+27983^(1/2))*3^(1/2)+3*27983^(1/2))*(-594+6*I*3^(1/2)*27983^(
1/2))^(1/3)+15*I*(151+27983^(1/2))*3^(1/2)-45*27983^(1/2))*3^(1/2)/(I*3^(1/2)*
27983^(1/2)+27983/33)/(I*3^(1/2)*27983^(1/2)-99)/exp(t):

int(integrand2,t);

Error, (in Handlers:-TrigExpOnly) cannot determine if this expression is true or false: tr_is_cos

int(evala(integrand2),t);

Error, (in Handlers:-TrigExpOnly) cannot determine if this expression is true or false: tr_is_cos

 

Download handler_trig_exp_version_2.mw

ps. send to Maplesoft support.

There seems to be a consensus about using ListTools:-SearchAll to locate an item in a list. However, this subroutine does not work on other expressions; A simple instance is that “ListTools:-SearchAll(1, [[1], 1]);” only outputs  while what I need is  (because both “op([1, 1], [[1], 1])” and “op([2], [[1], 1])” are ). And actually, I hope that there is a more general version in Maple.
For example, I intend to do something like 

restart;
expr, elem := ToInert(eval(`print/Diff`)), '_Inert_NAME'("_syslib"):
SearchAll(elem, expr);

and 

List:=[[[[cS,[[[cS,cS],cS],[[[cS,cS],[[cK,cK],cS]],cS]]],cS],cS],[[[cS,[[cK,cS],cK]],cK],cS]]: 
items:=Or([[[identical(cS),anything],anything],anything],[[identical(cK),anything],anything]): 
SearchAll(items,List); 

In other words, I need all positions of an operand of an expression (cf. op).

It may be manually checked that the "indices" of  in  include [5,1,1,2,1,1,1,2,1,2,1,2], [5,1,2,2,1,1,1,1,2,1,2], and [5,2,2,1,1,3,1,2], since 

patmatch(op([5, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2], expr), elem);
 = 
                              true

patmatch(op([5, 1, 2, 2, 1, 1, 1, 1, 2, 1, 2], expr), elem);
 = 
                              true

patmatch(op([5, 2, 2, 1, 1, 3, 1, 2], expr), elem);
 = 
                              true

Similarly, after some manual searchs, 

[[1], [1, 1, 1, 2], [1, 1, 1, 2, 2], [1, 1, 1, 2, 2, 1, 2], [2], [2, 1, 1, 2]]:
convert(typematch~(map2(`?[]`, List, `%`), items), `and`);
 = 
                              true

It turns out that all "indices" in  of  are [1][1,1,1,2][1,1,1,2,2][1,1,1,2,2,1,2][2], and [2,1,1,2].
But isn't there such a  command that can eliminate the need to manually retrieve them?

In an old question, @nm asked how to . While the answer in that question was almost up to the mark, there remains a regret. 

As the instance listed below shows, Maple, by default, draws arrows on a rectangular grid (rather than on a hexagonal mesh): 

  # Example of a three-dimensional vector field: 
vf__2d := VectorCalculus:-VectorField([sin(x)*(cos(x) + cos(y)), 
                                       sin(y)*(cos(x) - cos(y))], 'cartesian'[x, y]):
  # Example of a two-dimensional vector field: 
vf__3d := VectorCalculus:-VectorField([1 - (sin(u - v) + sin(u - w)), 
                                       1 - (sin(v - w) + sin(v - u)), 
                                       1 - (sin(w - u) + sin(w - v))], 'cartesian'[u, v, w]):
  # Phase portrait. 
Student:-VectorCalculus:-PlotVector(vf__2d, (x, y) =~ -Pi .. Pi, 
                                            'grid' = [`$`](25, 2), 
                                          'arrows' = 'THICK', 
                                   'fieldstrength' = log[63], 
                                           'color' = ColorTools:-Color("#0072BD"), 
                                            'axes' = "box"(*, …omitted…*));
= 

Note that I have changed some of the options in order to make the layout of arrows more prominent.
However, according to the help page of Mma's VectorPoints, among the following methods of location generation, Mma by default uses Hexagonal for 2D field vectors and FaceCenteredCubic for 3D field vector: 

Here is a collection of different settings available in Mma:

So if the requirement is to get the Maple's output looking like Mathematica's (see the beginning), the number and placement of vectors to plot should be thought of as well. In Maple, “the number of vectors” can be controlled by the plot (or plot3d) opinion , but how do I specify “the placement of vectors” (e.g., Mma's "Hexagonal" and "Mesh")?

Although there exists an  chapter in the documentation, randomly positioned arrows do not fit the bill. Is there any workaround?

This is linear ode, third order, Euler type and inhomogeneous ode.

If I solve the homogeneous ode only, then ask Maple to give me a particular solution, then add these, I get much much smaller solution which Maple verifies is correct.

Now when asking Maple to solve the original inhomogeneous ode as is, the solution is much more complicated and much longer with unresolved integrals.

Why does not Maple give the simpler solution? Both are verified to be correct.

This is my theory: When asking maple to find only the particular solution, it seems to have used a different and advanced method to find yp. Which is new to me and trying to learn it. It is based on paper "D'Alembertian Solutions of Inhomogeneous Equations (differential, difference, and some other).

Undetermined coefficients method can't really be used on ode's such as this because its coefficients are not constant.

Now, when asking Maple to solve the inhomogeneous ode, it seems to have used variation of parameters method, which results in integrals, which can be hard to solve.

My question is: Why does not Maple give the same much shorter answer when asked to solve the ode as is? Should it not have done so? Any thoughts on why such large difference in answer? Why it did not use the same method to find yp when asked to solve the whole ode as that leads to much smaller and more elegant solution.

ps. debugging this, it uses LinearOperators:-dAsolver:-dAlembertianSolver which is called from ODEtools/particularsol/linear to find yp when calling DETools:-particularsol(ode); but for some reason, it does not do this when asking it to solve the whole ode directly (if it did, then one will expect same answer to result, right?)

Maple 2023.2 on windows 10.
 

restart;

189900

(1)

#the ode
ode:=x^3*diff(y(x), x, x, x) + x^2*diff(y(x), x, x) + 2*x*diff(y(x), x) - y(x) = 2*x^3 - ln(x);

x^3*(diff(diff(diff(y(x), x), x), x))+x^2*(diff(diff(y(x), x), x))+2*x*(diff(y(x), x))-y(x) = 2*x^3-ln(x)

(2)

# find y_h
yh:=dsolve(lhs(ode)=0);

y(x) = c__1*x^(-(1/6)*((44+12*69^(1/2))^(2/3)-4*(44+12*69^(1/2))^(1/3)-20)/(44+12*69^(1/2))^(1/3))+c__2*x^((1/12)*(-20+(44+12*69^(1/2))^(2/3)+8*(44+12*69^(1/2))^(1/3))/(44+12*69^(1/2))^(1/3))*sin((1/12)*(3^(1/2)*(44+12*69^(1/2))^(2/3)+20*3^(1/2))*ln(x)/(44+12*69^(1/2))^(1/3))+c__3*x^((1/12)*(-20+(44+12*69^(1/2))^(2/3)+8*(44+12*69^(1/2))^(1/3))/(44+12*69^(1/2))^(1/3))*cos((1/12)*(3^(1/2)*(44+12*69^(1/2))^(2/3)+20*3^(1/2))*ln(x)/(44+12*69^(1/2))^(1/3))

(3)

#find particular solution
yp:=DETools:-particularsol(ode);

y(x) = (2/17)*x^3+ln(x)+3

(4)

#test particular solution is correct
odetest(yp,ode);

0

(5)

#find general solution = yh+ yp
y_general:=y(x)=rhs(yh)+rhs(yp);

y(x) = c__1*x^(-(1/6)*((44+12*69^(1/2))^(2/3)-4*(44+12*69^(1/2))^(1/3)-20)/(44+12*69^(1/2))^(1/3))+c__2*x^((1/12)*(-20+(44+12*69^(1/2))^(2/3)+8*(44+12*69^(1/2))^(1/3))/(44+12*69^(1/2))^(1/3))*sin((1/12)*(3^(1/2)*(44+12*69^(1/2))^(2/3)+20*3^(1/2))*ln(x)/(44+12*69^(1/2))^(1/3))+c__3*x^((1/12)*(-20+(44+12*69^(1/2))^(2/3)+8*(44+12*69^(1/2))^(1/3))/(44+12*69^(1/2))^(1/3))*cos((1/12)*(3^(1/2)*(44+12*69^(1/2))^(2/3)+20*3^(1/2))*ln(x)/(44+12*69^(1/2))^(1/3))+(2/17)*x^3+ln(x)+3

(6)

#test general solution is correct
odetest(y_general,ode);

0

(7)

#now solve the ode directly using Maple. Why this solution is much more complicated?
y_general_direct_method:=dsolve(ode);

y(x) = -(Int(-(5/2)*(x^(-(1/400)*69^(1/2)*(44+12*69^(1/2))^(2/3)+(11/1200)*(44+12*69^(1/2))^(2/3)+(1/12)*(44+12*69^(1/2))^(1/3)+2/3))^2*(44+12*69^(1/2))^(1/3)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)*cos((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))^2+3*(44+12*69^(1/2))^(1/3)*69^(1/2)*sin((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))^2-11*(44+12*69^(1/2))^(1/3)*cos((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))^2-11*(44+12*69^(1/2))^(1/3)*sin((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))^2+100*cos((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))^2+100*sin((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))^2)*(-2*x^3+ln(x))/(x^3*(3*3^(1/2)*23^(1/2)+11)*(11*3^(1/2)*23^(1/2)-207)), x))*x^((1/200)*69^(1/2)*(44+12*69^(1/2))^(2/3)-(11/600)*(44+12*69^(1/2))^(2/3)-(1/6)*(44+12*69^(1/2))^(1/3)+2/3)+(Int(-(5/6)*x^((1/200)*69^(1/2)*(44+12*69^(1/2))^(2/3)-(11/600)*(44+12*69^(1/2))^(2/3)-(1/6)*(44+12*69^(1/2))^(1/3)+2/3)*x^(-(1/400)*69^(1/2)*(44+12*69^(1/2))^(2/3)+(11/1200)*(44+12*69^(1/2))^(2/3)+(1/12)*(44+12*69^(1/2))^(1/3)+2/3)*(44+12*69^(1/2))^(1/3)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)*3^(1/2)*cos((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))-9*(44+12*69^(1/2))^(1/3)*69^(1/2)*sin((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))-11*(44+12*69^(1/2))^(1/3)*3^(1/2)*cos((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))+33*(44+12*69^(1/2))^(1/3)*sin((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))+100*3^(1/2)*cos((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))+300*sin((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x)))*(-2*x^3+ln(x))*3^(1/2)/(x^3*(3*3^(1/2)*23^(1/2)+11)*(11*3^(1/2)*23^(1/2)-207)), x))*x^(-(1/400)*69^(1/2)*(44+12*69^(1/2))^(2/3)+(11/1200)*(44+12*69^(1/2))^(2/3)+(1/12)*(44+12*69^(1/2))^(1/3)+2/3)*cos((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))+(Int(-(5/6)*x^((1/200)*69^(1/2)*(44+12*69^(1/2))^(2/3)-(11/600)*(44+12*69^(1/2))^(2/3)-(1/6)*(44+12*69^(1/2))^(1/3)+2/3)*x^(-(1/400)*69^(1/2)*(44+12*69^(1/2))^(2/3)+(11/1200)*(44+12*69^(1/2))^(2/3)+(1/12)*(44+12*69^(1/2))^(1/3)+2/3)*(44+12*69^(1/2))^(1/3)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)*3^(1/2)*sin((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))+9*(44+12*69^(1/2))^(1/3)*69^(1/2)*cos((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))-11*(44+12*69^(1/2))^(1/3)*3^(1/2)*sin((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))-33*(44+12*69^(1/2))^(1/3)*cos((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))+100*3^(1/2)*sin((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))-300*cos((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x)))*(-2*x^3+ln(x))*3^(1/2)/(x^3*(3*3^(1/2)*23^(1/2)+11)*(11*3^(1/2)*23^(1/2)-207)), x))*x^(-(1/400)*69^(1/2)*(44+12*69^(1/2))^(2/3)+(11/1200)*(44+12*69^(1/2))^(2/3)+(1/12)*(44+12*69^(1/2))^(1/3)+2/3)*sin((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))+c__1*x^((1/200)*69^(1/2)*(44+12*69^(1/2))^(2/3)-(11/600)*(44+12*69^(1/2))^(2/3)-(1/6)*(44+12*69^(1/2))^(1/3)+2/3)+c__2*x^(-(1/400)*69^(1/2)*(44+12*69^(1/2))^(2/3)+(11/1200)*(44+12*69^(1/2))^(2/3)+(1/12)*(44+12*69^(1/2))^(1/3)+2/3)*cos((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))+c__3*x^(-(1/400)*69^(1/2)*(44+12*69^(1/2))^(2/3)+(11/1200)*(44+12*69^(1/2))^(2/3)+(1/12)*(44+12*69^(1/2))^(1/3)+2/3)*sin((1/1200)*(44+12*69^(1/2))^(1/3)*3^(1/2)*(3*(44+12*69^(1/2))^(1/3)*69^(1/2)-11*(44+12*69^(1/2))^(1/3)+100)*ln(x))

(8)

#test the above
odetest(y_general_direct_method,ode);

0

(9)

 


 

Download why_such_difference_in_dsolve_answer.mw

Hi,

I would like to calculate Laplacian(1/r) in spherical coordinates

Considering that 1/r in spherical coordinates defines a distribution function (understood in Laurent Schwartz meaning) , the result has to be -4πDirac(r)

I tried to establish this result on Maple but that doesn't work. The result given is -Dirac(r)/r²  (see below)

What is the mistake I made?

Thanks

with(Physics[Vectors]);

SetCoordinates(spherical[r, phi, theta]);

F := Laplacian(1/r);
                               Dirac(r)
                        F := - --------
                                    r²  

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