Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I am attempting to make the transition from Mathematica to Maple. I that regard, I would like to know how I would implement something like Mathematica's "Conditioned" in Maple. For example, how would I implement the example given in the diagram shown below involving the Poisson Distribution?

I am trying to solve a diffusion equation with a potential term that has an integral in it. The equation has the following form: 

PDE := diff(g(x, t), t) = diff((beta(x, t)+diff(g(x, t), x)), x), 

with the function beta: 

beta := proc (x, t) options operator, arrow; int(exp(-abs(x-y))*g(y, t), y = -infinity .. +infinity) end proc

The boundary conditions for the function g(x,t) are simply assumed to be a zero-centered Gaussian in space (i.e. in x). So it is unity for x=0 and zero for the outer boundary that we can set as x=L. 

The problem is easily solved if the function beta is not an integral, but in the current form I get the following error: 
*******
Error, (in pdsolve/numeric/process_PDEs) inconsistent dependencies in PDEs: g(x, t) v.s. g(y, t)

*******

So it does not like the dummy variable in the function g.  

I can not write an additional PDE for beta because my Kernel is an exponential so the integral never goes away. Anyone with a way to solve this?

ADDENDUM: I have now copied the scriptPDE_DIFFUSION_INTEGRAL.mw
 

restart

L := 20; betaz := proc (x, t) options operator, arrow; int(exp(-abs(x-y))*g(y, t), y = 0 .. L) end proc

proc (x, t) options operator, arrow; int(exp(-abs(x-y))*g(y, t), y = 0 .. L) end proc

(1)

PDE := diff(g(x, t), t) = diff(-betaz(x, t)+diff(g(x, t), x), x)

diff(g(x, t), t) = -(int(-abs(1, x-y)*exp(-abs(x-y))*g(y, t), y = 0 .. 20))+diff(diff(g(x, t), x), x)

(2)

v__t := 1; v__d := 0; IBC := {g(0, t) = exp(-(0.-v__d)^2/v__t), g(L, t) = 0*exp(-(L-v__d)^2/v__t), g(x, 0) = exp(-(x-v__d)^2/v__t)}

{g(0, t) = 1., g(20, t) = 0, g(x, 0) = exp(-x^2)}

(3)

pds := pdsolve(PDE, IBC, numeric, time = 100, range = 0 .. L, spacestep = .1)

Error, (in pdsolve/numeric/process_PDEs) inconsistent dependencies in PDEs: g(x, t) v.s. g(y, t)

 

p0 := pds:-plot(t = 0, numpoints = 100, color = red); p1 := pds:-plot(t = 10, numpoints = 100, color = red); p2 := pds:-plot(t = 20, numpoints = 100, color = blue); p6 := pds:-plot(t = 60, numpoints = 100, color = blue); p5 := pds:-plot(t = 50, numpoints = 100, color = blue); p3 := pds:-plot(t = 30, numpoints = 100, color = blue); p4 := pds:-plot(t = 40, numpoints = 100, color = green); p7 := pds:-plot(t = 70, numpoints = 100, color = blue); p8 := pds:-plot(t = 80, numpoints = 100, color = black); p9 := pds:-plot(t = 90, numpoints = 100, color = blue); plots[display]({p0, p2, p4, p8})

NULL


 

Download PDE_DIFFUSION_INTEGRAL.mw

below. 

 

Hi everybody,

Maybe it's more a warning than a true question ?

I have written a rather heavy-duty code in Maple 2015. A few years ago I faced strong problems of increases in memory. After some investigations I found there came from a procedure P in which a loop realizes a few tenth of calls to  fsolve.
This same procedure  P was itself called a large number of times.

To try to  fix them I inserted a forget(fsolve, initialize=true) command after the fsolve command.
At the end this didn't prove to be very efficient and I decided to rewrite some part of the code in a more efficient way. Basically the  procedure  P is now called only a few times but its inner loop is executed about 200 hundred times.
This new version of the code no longer presents memory size problems, while being more efficient from a computational time point of view.

Today procedure  P still contains the forget(fsolve, initialize=true) command (I had forgotten to remove it)

Now I keep developping this same code under Maple 2018.
The Maple 2015 and Maple 2018 versions both return the same results, but the procedure  P runs in about 20 times the time it runs in Maple 2015 (40 seconds instead of 2)
This comes from the 200 forget(fsolve, initialize=true) calls which consumme about  38 seconds.

With Maple 2015 these same 200 calls to forget(fsolve, initialize=true) only consumme 0.5 second:


As a cure I remove the forget(fsolve, initialize=true) command, plain and simple.

But maybe this misadventure could reveal an unseen behaviour of Maple 2018 ?

 

Hi

I'm using solve,and i want to quantify the dimensions of the solution spaces of the output. For example

solve([a+b, c+b])

produces a singular 1 dimensional object

solve([a+b, -b^2+d^2])

produces 2 objects with dimension 2

EDIT:
my intuition is that the simplest way of doing this is to create a counter for equations of the form
variable=variable
and to run it on each of the lists that solve might produce- so far this kind of thing is beyond me

 

I am trying to solve an equation with respect to the variable w. However, although there seems to be a solution (see plot indicating a root), Maple produces the wron solution (0, when P = 1/2 and d = 1/10):


 

equations := S-P*S*((ln(-2*d*w+P+d)-ln(P-d))*(P-d)/(-1+w)+(P+d)*(ln(-P-d)-ln(d*(2*w-1)-P))/w)/(2*d^2) = 0

S-(1/2)*P*S*((ln(-2*d*w+P+d)-ln(P-d))*(P-d)/(-1+w)+(P+d)*(ln(-P-d)-ln(d*(2*w-1)-P))/w)/d^2 = 0

(1)

variables := w

w

(2)

solutions := solve(equations, variables)

(1/2)*(P+d-exp(RootOf(-P^2*exp(_Z)*ln(1/(P+d))-P*d*exp(_Z)*ln(1/(P+d))+P^3*ln(1/(P+d))-P*d^2*ln(1/(P+d))-ln(P-d)*P^2*exp(_Z)+ln(P-d)*P*d*exp(_Z)-2*P*d*exp(_Z)*_Z+ln(P-d)*P^3-ln(P-d)*P*d^2+d*(exp(_Z))^2-2*P*d*exp(_Z)+P^2*d-d^3)))/d

(3)

eval({solutions}, [P = 1/2, d = 1/10])

{3-5*exp(RootOf(-25*(exp(_Z))^2+75*exp(_Z)*ln(5/3)+50*ln(2/5)*exp(_Z)+25*exp(_Z)*_Z+25*exp(_Z)-30*ln(5/3)-30*ln(2/5)-6))}

(4)

evalf({%})

{{0.}}

(5)

plot(eval(S*(-P*(-2*d*w+P+d)*ln(-2*d*w+P+d)+P*w*(P-d)*ln(P-d)-(-1+w)*(P*(P+d)*ln(P+d)-2*d^2*w))/(2*d^2*(-1+w)*w), {P = 1/2, S = 1, d = 1/10}), w = 0 .. 1)

 

``


 

Download MaplePrimes_03072018.mw

This pde used to be solved in 2018 as far as I know. Now it gives a strange new error

restart;
interface(showassumed=0);
pde :=  diff(u(x,t),t)+k*diff(u(x,t),x$2)+sin(2*Pi*x/L);
ic  :=  u(x,0)=f(x);
bc  :=  D[1](u)(0,t)=0, D[1](u)(L,t)=0;
sol :=  pdsolve({pde,ic,bc},u(x,t)) assuming L>0,t>0,k>0;

Error, (in assuming) when calling 'dsolve'. Received: 'found differentiated functions with same name but depending on different arguments in the given DE system: {F0_0(L), F0_0(x)}'

I am using  Physics:-Version();     MapleCloud version: 72

Do others get this erorr? Why does it show up now when it worked OK before?

update

Iam running on Linux. Here is screen shot

Hello, can someone help me please?

I have to find the minimum (x,y) over the domain [0;2Pi] of the following function

f(x,y):=1+8 cos(1/2 x-1/2 y) cos(1/2 x) cos(1/2 y) which i plotted to have an idea where its minimum is located.

plot3d(f(x,y),x=0..2Pi,y=0..2Pi)

 

I tried to use the command  ' minimize(f(x,y)) '

 

Thank you in advance,

best regards.

 

 Ps: the function normaly attains its minimum at (2Pi/3,-2Pi/3) and (-2Pi/3,2Pi/3).

Hello dear users!

Hope you would be fine. I want to fine the roots of the following cubic equation

u^3+u*d[1]+d[0];

when the discriment is zero, positive and negative. I am waiting your positive response. Thanks

 

@acer @Carl Love @Kitonum @Preben Alsholm

I want to calculate and reproduce this question  in Maple.

with(Optimization):

f := (x, y) -> op(1, NLPSolve(sin(a*x*y), a = 1 .. 5));

int(`if`(f(x, y) > 0, 1, 0), [x = 0 .. 1, y = 0 .. 1], numeric);

# 0 

,but I FAIL.

It should give me: 0.922105

 

Thanks.

I have three columns of data (real numbers) in Excel that have about one thousand rows and I wish to plot their relationships in Maple. The source data simply comprises three columns of numbers and so, are not ordered in triples, [x,y,z]. Does anyone know of a simple routine available that allows me to import the raw data and output a 3-D wire / solid plot in Maple?

Thank you! 

I have an explicit mathematical expresssion in the form

m = f[1](x,y)*A + f[2](x,y)*B + f[3](x,y)*C

I wonder if it is possible to use the collect function on the vector z = [A,B,C]^T and write the resulting expression as the dot product

m = f^T.z 

Basically, I am interested in obtaining the vector f = [f[1](x,y),f[2](x,y),f[3](x,y)]^T as a Maple variable in closed-form.

 

Thank you in advance for your help.

 

Marco

I'm referancing the maple help page: https://www.maplesoft.com/support/help/maple/view.aspx?path=Groebner in my thesis, but I am not sure what fields to include, and what to put in them- particularly for the year.

I want to match   a*x^b only if "a" and "b" are both not the symbol "y"

Therefore 5*x^y should fail to match, but this below matches.

restart;
expr:=5*x^y;
if patmatch(expr,conditional(a::anything*x^(b::anything),(a<>y and b<>y)),'la') then
   print("it matched, why??");
   map(assign,la):
   print("a = ",a, " b=",b);
fi;

it gives

                      "it matched, why??"
                      "a = ", 5, " b=", y

What did I do wrong? is my conditional wrong above?

 

I was working through some example problems and came across this statement.  Actually comparing Sympy results to Maple. (I prefer Maple).

"Calculate the volume integral of f(...) over the sphere of radius r"

I can solve the problem, but, got hung up on the exact meaning of the problem statement.

Tom Dean

restart
with(VectorCalculus):
with(LinearAlgebra):

## http://www.acme.byu.edu/wp-content/uploads/2017/08/Sympy.pdf
## Problem 7

f := proc(x, y, z)
    (x^2 + y^2 + z^2)^2
end proc;

(M, d) := Jacobian([rho*sin(phi)*cos(theta),
                    rho*sin(phi)*sin(theta),
                    rho*cos(phi)],
                   [rho, phi, theta],
                   'determinant' );
abs(d);
simplify(%);

eqn := f(rho*sin(phi)*cos(theta), rho*sin(phi)*sin(theta), rho*cos(phi));
eqn := eqn * abs(simplify(d));

soln := int(eqn,[rho=0..r,theta=0..2*Pi,phi=0..Pi]);
subs(r=3, soln);

 

How I can convert Root Of to conventional form?

Thanks

root_of.mw
 

Q1 := x*(x-delta)*(1-x)*(x+y)-alpha*x*y; Q2 := beta*x*y-Zeta*y*(x+y); SOLL := solve({Q1, Q2}, {x, y})

{x = 0, y = 0}, {x = 1, y = 0}, {x = delta, y = 0}, {x = RootOf(beta*_Z^2+(-beta*delta-beta)*_Z-alpha*Zeta+alpha*beta+delta*beta), y = -RootOf(beta*_Z^2+(-beta*delta-beta)*_Z-alpha*Zeta+alpha*beta+delta*beta)*(Zeta-beta)/Zeta}

(1)

``


 

Download root_of.mw

 

First 788 789 790 791 792 793 794 Last Page 790 of 2217