MaplePrimes Questions

Search Questions:

A colleage asked me for the solution of an elementary boundary value problem for an ODE that models the steady-state temperature distribution in a nonhomogeneous rod.  I solved it in Maple and passed the solution on to her without checking the result.  She struggled for a day or two, attempting to "debug" her finite element code whose result was not agreeing with Maple's.

Upon closer inspection, it turned out that her code was correct and the solution returned by Maple was not.  Here are the details.  I can't tell whether Maple's dsolve can be improved to provide correct solutions to this and similar problems.

Problem with dsolve()

restart;

kernelopts(version);

`Maple 2025.0, X86 64 LINUX, Mar 24 2025, Build ID 1909157`

A boundary value problem for an ODE

 

Let's solve the following boundary value problem:

de := Diff(a(x)*Diff(u(x),x),x) = -1;

Diff(a(x)*(Diff(u(x), x)), x) = -1

bc := u(-1)=0, u(1)=0;

u(-1) = 0, u(1) = 0

Maple's dsolve() fails to find a solution:

dsolve({de,bc});

 

Solution obtained by hand

 

The solution may be obtained by hand, as follows.

 

Integrate the DE once

a(x)*(diff(u(x), x)) = c-x.

where c is the integration constant.  Therefore

diff(u(x), x) = (c-x)/a(x) and (c-x)/a(x) = c/a(x)-x/a(x).

To determine the value of the constant c, integrate the above over [-1, 1]

and apply the boundary conditions:

c*(int(1/a(x), x = -1 .. 1))+int(x/a(x), x = -1 .. 1) = u(1)-u(-1) and u(1)-u(-1) = 0

whence
c = (int(x/a(x), x = -1 .. 1))/(int(1/a(x), x = -1 .. 1)).

Having thus determined c, we integrate the expression for diff(u(x), x) obtained above, and arrive at the solution
u(x) = int((c-xi)/a(xi), xi = -1 .. x).

Remark: The solution obtained here is valid for any a(x) as long as

the integrals encountered above make sense.  Note that there is
no requirement on the differentiability or even continuity of a(x).

Technically, a(x) can be any function such that 1/a(x) is integrable.

 

 

Wrong solution returned by dsolve()

 

Let us consider a special choice of the coefficient a(x):

a := x -> 1 + 2*Heaviside(x);

proc (x) options operator, arrow; 1+2*Heaviside(x) end proc

According the the calculations above, we have:

c := int(x/a(x),x=-1..1) / int(1/a(x),x=-1..1) ;

-1/4

and therefore the correct solution is

int((c-xi)/a(xi), xi=-1..x):
sol := u(x) = collect(%, Heaviside);

u(x) = ((1/6)*x+(1/3)*x^2)*Heaviside(x)-(1/4)*x-(1/2)*x^2+1/4

Here is what the solution looks like:

plot(rhs(sol), x=-1..1, color=blue, thickness=3);

Let's attempt to solve the same boundary value problem with Maple's dsolve().

dsolve({de,bc}):
bad_sol := collect(%, Heaviside);

u(x) = ((1/3)*x^2+x/(3*exp(-2)+3)-exp(-2)*x/(3*exp(-2)+3))*Heaviside(x)-(1/2)*x^2-x/(3*exp(-2)+3)+(3*exp(-2)+1)/(6*exp(-2)+6)

That's very different from the correct solution obtained above.   To see the problem with it, let's recall that according to the DE, the expression a(x)*(diff(u(x), x))NULLshould evaluate to  c-x for some constant c,  but what we get through bad_sol is nothing like c-x;  in fact, it's not even continuous:

a(x)*diff(rhs(bad_sol), x):
collect(%, Heaviside, simplify);
plot(%, x = -0.5 .. 0.5);

((4*x-2)*exp(-2)+4*x+2)*Heaviside(x)^2/(3*exp(-2)+3)+(-(4/3)*x-1/3)*Heaviside(x)-x-1/(3*exp(-2)+3)

It appears that dsolve goes astray by attempting to expand the expression diff(a(x)*(diff(u(x), x)), x).   It shouldn't.

 

 

Download dsolve-bug.mw

 

Hi.

So I get this ->

int(x^2, x = 0 .. a)

(1/3)*a^3

(1)

NULL


But i would like this ->

Download 5.3-Definite-Integral.mw

 

And maybe something similar for indefinite integrals.

This would really help me with education in calculus so thanks everybody.

It would appear being able to run Mapleflow worksheets in Maple is only useful to those who have Mapleflow.

Just wondering without being able to see what variables are in the mapleflow worksheet how would I know what values to pass to it?

Hi.

I have been learning Integration for calculus. I came about on output that i not know what it means.

See for yourself. ->
If anyone can help make this mess.

Thanks in advance.

sum((-2)^j/(j-2)^2, j = 3 .. n)

4*polylog(2, -2)+2^(n+1)*(1+(-2*n^2+4*n-2)*LerchPhi(-2, 2, n))*(-1)^n/(-1+n)^2

(1)

NULL

Download ex5sigma.mw

i want to do export  the table to latex there is command to do?

table.mw

In the screen shot below taken from a 3D animation I want to vastly shrink the area I have stippled with spots (it's actually white on the worksheet).  It's outside the cube defining the 3D animation and inside the square that defines the part of the worksheet used for an image.

in my iteration when i got answer the error is so big and the method is powerfull i don't know i did mistake or my exact function i have to change it, becuase error is so big , how i can make error be smaller i did any mistake ?
and how i can plot them together exact and approximate in one graph also 3D and 2D

Num-e1.mw

I am working with a symbolic expression in Maple that combines exponential terms. How can exponential terms be fully converted into hyperbolic functions? 

restart

with(Student[Precalculus])

interface(showassumed = 0)

assume(x::real); assume(t::real); assume(lambda1::complex); assume(lambda2::complex); assume(a::real); assume(A__c::real); assume(B1::real); assume(B2::real); assume(delta1::real); assume(delta2::real); assume(`ω__0`::real); assume(g::real); assume(l__0::real)

expr := A__c*exp(-(2*I)*(A__c^2*g*l__0^2-1/2)*`ω__0`*t)+(2*I)*exp(-I*(A__c^2*g*l__0^2-1/2)*`ω__0`*t)*(sqrt(delta1+I*delta2-sqrt(-A__c^2*g+(delta1+I*delta2)^2))*exp(-2*sqrt(-A__c^2*g+(delta1+I*delta2)^2)*(l__0^2*(I*delta1-delta2)*t*`ω__0`+(1/2)*x))-sqrt(delta1+I*delta2+sqrt(-A__c^2*g+(delta1+I*delta2)^2))*exp(sqrt(-A__c^2*g+(delta1+I*delta2)^2)*(x+(2*I)*`ω__0`*l__0^2*(delta1+I*delta2)*t)))*(sqrt(-delta1+I*delta2-sqrt(-A__c^2*g+(delta1-I*delta2)^2))*exp((2*(l__0^2*(I*delta1+delta2)*t*`ω__0`-(1/2)*x))*sqrt(-A__c^2*g+(delta1-I*delta2)^2))-sqrt(-delta1+I*delta2+sqrt(-A__c^2*g+(delta1-I*delta2)^2))*exp(-(2*(l__0^2*(I*delta1+delta2)*t*`ω__0`-(1/2)*x))*sqrt(-A__c^2*g+(delta1-I*delta2)^2)))*delta2/(exp(I*(A__c^2*g*l__0^2-1/2)*`ω__0`*t)*(((-sqrt(delta1+I*delta2-sqrt(-A__c^2*g+(delta1+I*delta2)^2))*sqrt(-delta1+I*delta2+sqrt(-A__c^2*g+(delta1-I*delta2)^2))-sqrt(delta1+I*delta2+sqrt(-A__c^2*g+(delta1+I*delta2)^2))*sqrt(-delta1+I*delta2-sqrt(-A__c^2*g+(delta1-I*delta2)^2)))*exp((2*(l__0^2*(I*delta1+delta2)*t*`ω__0`-(1/2)*x))*sqrt(-A__c^2*g+(delta1-I*delta2)^2))+exp(-(2*(l__0^2*(I*delta1+delta2)*t*`ω__0`-(1/2)*x))*sqrt(-A__c^2*g+(delta1-I*delta2)^2))*(sqrt(delta1+I*delta2-sqrt(-A__c^2*g+(delta1+I*delta2)^2))*sqrt(-delta1+I*delta2-sqrt(-A__c^2*g+(delta1-I*delta2)^2))+sqrt(-delta1+I*delta2+sqrt(-A__c^2*g+(delta1-I*delta2)^2))*sqrt(delta1+I*delta2+sqrt(-A__c^2*g+(delta1+I*delta2)^2))))*exp(-2*sqrt(-A__c^2*g+(delta1+I*delta2)^2)*(l__0^2*(I*delta1-delta2)*t*`ω__0`+(1/2)*x))+exp(sqrt(-A__c^2*g+(delta1+I*delta2)^2)*(x+(2*I)*`ω__0`*l__0^2*(delta1+I*delta2)*t))*((sqrt(delta1+I*delta2-sqrt(-A__c^2*g+(delta1+I*delta2)^2))*sqrt(-delta1+I*delta2-sqrt(-A__c^2*g+(delta1-I*delta2)^2))+sqrt(-delta1+I*delta2+sqrt(-A__c^2*g+(delta1-I*delta2)^2))*sqrt(delta1+I*delta2+sqrt(-A__c^2*g+(delta1+I*delta2)^2)))*exp((2*(l__0^2*(I*delta1+delta2)*t*`ω__0`-(1/2)*x))*sqrt(-A__c^2*g+(delta1-I*delta2)^2))-exp(-(2*(l__0^2*(I*delta1+delta2)*t*`ω__0`-(1/2)*x))*sqrt(-A__c^2*g+(delta1-I*delta2)^2))*(sqrt(delta1+I*delta2-sqrt(-A__c^2*g+(delta1+I*delta2)^2))*sqrt(-delta1+I*delta2+sqrt(-A__c^2*g+(delta1-I*delta2)^2))+sqrt(delta1+I*delta2+sqrt(-A__c^2*g+(delta1+I*delta2)^2))*sqrt(-delta1+I*delta2-sqrt(-A__c^2*g+(delta1-I*delta2)^2)))))*(-delta1+I*delta2)*(delta1+I*delta2))

A__c*exp(-(2*I)*(A__c^2*g*l__0^2-1/2)*omega__0*t)+(2*I)*exp(-I*(A__c^2*g*l__0^2-1/2)*omega__0*t)*((delta1+I*delta2-(-A__c^2*g+(delta1+I*delta2)^2)^(1/2))^(1/2)*exp(-2*(-A__c^2*g+(delta1+I*delta2)^2)^(1/2)*(l__0^2*(I*delta1-delta2)*t*omega__0+(1/2)*x))-(delta1+I*delta2+(-A__c^2*g+(delta1+I*delta2)^2)^(1/2))^(1/2)*exp((-A__c^2*g+(delta1+I*delta2)^2)^(1/2)*(x+(2*I)*omega__0*l__0^2*(delta1+I*delta2)*t)))*((-delta1+I*delta2-(-A__c^2*g+(delta1-I*delta2)^2)^(1/2))^(1/2)*exp(2*(l__0^2*(I*delta1+delta2)*t*omega__0-(1/2)*x)*(-A__c^2*g+(delta1-I*delta2)^2)^(1/2))-(-delta1+I*delta2+(-A__c^2*g+(delta1-I*delta2)^2)^(1/2))^(1/2)*exp(-2*(l__0^2*(I*delta1+delta2)*t*omega__0-(1/2)*x)*(-A__c^2*g+(delta1-I*delta2)^2)^(1/2)))*delta2/(exp(I*(A__c^2*g*l__0^2-1/2)*omega__0*t)*(((-(delta1+I*delta2-(-A__c^2*g+(delta1+I*delta2)^2)^(1/2))^(1/2)*(-delta1+I*delta2+(-A__c^2*g+(delta1-I*delta2)^2)^(1/2))^(1/2)-(delta1+I*delta2+(-A__c^2*g+(delta1+I*delta2)^2)^(1/2))^(1/2)*(-delta1+I*delta2-(-A__c^2*g+(delta1-I*delta2)^2)^(1/2))^(1/2))*exp(2*(l__0^2*(I*delta1+delta2)*t*omega__0-(1/2)*x)*(-A__c^2*g+(delta1-I*delta2)^2)^(1/2))+exp(-2*(l__0^2*(I*delta1+delta2)*t*omega__0-(1/2)*x)*(-A__c^2*g+(delta1-I*delta2)^2)^(1/2))*((delta1+I*delta2-(-A__c^2*g+(delta1+I*delta2)^2)^(1/2))^(1/2)*(-delta1+I*delta2-(-A__c^2*g+(delta1-I*delta2)^2)^(1/2))^(1/2)+(-delta1+I*delta2+(-A__c^2*g+(delta1-I*delta2)^2)^(1/2))^(1/2)*(delta1+I*delta2+(-A__c^2*g+(delta1+I*delta2)^2)^(1/2))^(1/2)))*exp(-2*(-A__c^2*g+(delta1+I*delta2)^2)^(1/2)*(l__0^2*(I*delta1-delta2)*t*omega__0+(1/2)*x))+exp((-A__c^2*g+(delta1+I*delta2)^2)^(1/2)*(x+(2*I)*omega__0*l__0^2*(delta1+I*delta2)*t))*(((delta1+I*delta2-(-A__c^2*g+(delta1+I*delta2)^2)^(1/2))^(1/2)*(-delta1+I*delta2-(-A__c^2*g+(delta1-I*delta2)^2)^(1/2))^(1/2)+(-delta1+I*delta2+(-A__c^2*g+(delta1-I*delta2)^2)^(1/2))^(1/2)*(delta1+I*delta2+(-A__c^2*g+(delta1+I*delta2)^2)^(1/2))^(1/2))*exp(2*(l__0^2*(I*delta1+delta2)*t*omega__0-(1/2)*x)*(-A__c^2*g+(delta1-I*delta2)^2)^(1/2))-exp(-2*(l__0^2*(I*delta1+delta2)*t*omega__0-(1/2)*x)*(-A__c^2*g+(delta1-I*delta2)^2)^(1/2))*((delta1+I*delta2-(-A__c^2*g+(delta1+I*delta2)^2)^(1/2))^(1/2)*(-delta1+I*delta2+(-A__c^2*g+(delta1-I*delta2)^2)^(1/2))^(1/2)+(delta1+I*delta2+(-A__c^2*g+(delta1+I*delta2)^2)^(1/2))^(1/2)*(-delta1+I*delta2-(-A__c^2*g+(delta1-I*delta2)^2)^(1/2))^(1/2))))*(-delta1+I*delta2)*(delta1+I*delta2))

(1)

NULL

Download simplify.mw

  1. Further simplify the expression under three physical scenarios, assuming delta__1 > 0:

    • Case (i): When A__c = 0

    • Case (ii): When delta__1 > g * A__c

    • Case (iii): When delta__1 < g * A__c

i got some issue regarding to solving numerical example, he got combine function of infinite term i don't know how when he give alpha a number ? and when didn't give number  to order of fractional laplace and stay alpha letter he got outcome i want apply laplace while is for general alpha betwen n-1<alpha<n when n is number of initial condition, i want to get same result as he did steps are not wrong but outcome have problem .

i have same problem in three example in one paper, is related to update maple to 2025, i saw talking about calculating inverse laplace at new version  any one  know how fix this?

Ex1.mw

EX2.mw

Ex3.mw

When I load LinearAlgebra and give the command

{Matrix([1])} union {Matrix([1])};

I receive a set with two elements, each equal to the matrix [1]. Why does this happen? How can I eliminate this duplicate element?

I get this ->

sum(i^2, i = 1 .. 5)

55``

(1)

 

But would like this ->

Where have all the tools options display / interface / Precision tabs all gone?  That is typsetting (extended or Maple standard) options
plot or font anti-aliasing (Enabled Disabled) options
plot dislpay (inline window) options
Precision (limit expression length to etc...)

What is the installation time for Maple 2025?

I looked up the installation times for Matlab and Mathematica.  The AI assistant in google says Matlab takes several minutes to an hour, for Mathematica 20 minutes to an hour, for Maple it said around 15 minutes -  Is that about right? 

in thus example all of them are write in shape of matrix but all of them are linear differential equation which have critical point zero ,i want to plot thus example and decided the kind of critical point by eagenvalue and by eagenvector i can find the trajectory how i can plot by matrix of each example and show that that critical point is which type as mention in picture?

system-phase-examples.mw

in my iteration is appear Error, (in assuming) when calling 'evala/preproc4'. Received: 'floats not handled' which i know is  becuase assuming but how fix it?

and how i can get that table ?

error-problem.mw

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