restart:
with(PDEtools);
PDE := diff(y(x,t), t)-diff(y(x,t), x,x,t)-diff(y(x,t), x$2)+ diff(y(x,t), x)+y(x,t)*diff(y(x,t),x)=exp(-t)*(cos(x)-sin(x)+1/2*exp(-t)*sin(2*x));
# Initial/boundary conditions
BCs:=y(0,t) = 0, y(Pi,t)=0;
ICs:=y(x,0) =sin(x) ;
pdsolve(PDE, {BCs,ICs});
exact_solution:=exp(-t)*sin(x);
Test1:=pdetest(exact_solution,[PDE, BCs,ICs]);
The solution of the PDE is exp(-t)*sin(x).
I want to check whether it is right or not by Maple.
I wrote the code. You can download the code.mw
But, the code doesn' t work. What is the problem?
Thanks.
- The member() function doesn't find the value in a table if that value is associated with the key (aka index) '0'
- Doesn't seem to matter if the table is created explicitly (ie by calling table()) or implicitly (ie by simple indexed assignment)
- member() doesn't seem to have the same issue with a zero-based Array()
- I'm pretty sure that this is a bug, but I'd like some opinions before I report it
- This behaviour has been around for a while: same thing happens all the way back to Maple 18. (I can't check anything earlier)
Check the ouput of member(10,t1) in the attached
Download memberProp.mw
This is a solution to a PDE. I solved this by hand and got a much simpler solution. Maple solution is also correct but very complicated. They are both the same, as when I plot them for different t values, they match. I am sure they are the same.
How would one simplify Maple solution to the simpler one? Tried number of options to simplify, but can't get Maple to simplify it to the hand solution. Also tried different assumptions on t and x (real, positive etc..) nothing helps.
Maple 2019.1 on windows 10. Physics 436
Download how_to_simplify.mw
Dear experts,
I am sorry to bother you again with different questions. I am attempting to get a solution with various methods so that I can grasp my problem as clear as possible.
I am attempting maximizing this problem, so I am looking for functional solution of c(t). However, as you can see, in the optimization problem there is one bothering expression, which is a integral of c(h) from 0 to t.
I looved optimal control theory book, but still I could not find a protocol example.
int([int(e^(-rh)*[log(c(h)) + w - p*c(h)], h = 0 .. t)]*b*[int(c(h), h = 0 .. t)]*e^(-b*int(c(h), h = 0 .. t)), t = 0 .. infinity)
How shall I approach this problem with Euler Lagrange in Maple? Thank you
Hi
I am new to parallel computing, but as my current desktop is struggling with caclulating Groebner bases (i've been locked out for most of a week), I've contacted my universities center for scientific computing in the hope that they could do the caclulations.
However, I've been told that maple doesn't run in a distributed-memory parallel sense; as parallelisation in maple is very new - and i couldn't find discussion of this in the documentation - I thought it would be best to ask here if it does.
Secondarily can commands from the GB package be implemented in a way that would benefit?
if not can other similar commands like solve or eliminate?
pdsolveComesUpWithComplexResult.mw
I'm struggling to get a simple answer out of pdsolve solving this PDE:
eqn := Mu*diff(`ξr`(r, t), t, t) = kappa*diff(`ξr`(r, t), r, r);
ic := `ξr`(r, 0) = sin(Pi/(2*r)), D[2](`ξr`)(r, 0) = 0;
bc := `ξr`(0, t) = 0, D[1](`ξr`)(1, t) = 0;
sol := (pdsolve([eqn, ic, bc], Zeta(r, t)) assuming (0 < kappa, 0 < Mu));
The outcome pdsolve comes up with is rather complex, with summation and integral. To my best knowledge, the simple solution of this PDE is:
sin(Pi*r/2)*cos(1/2*sqrt(k/m)*Pi*t)
How can I get this simple solution out of pdsolve?
Any suggestion is welcome.
Wouter
How is it possible in Maple to keep hold of pre determined results for comparison with subsequent results so that a recursive decision can be made to either modify the list of “kept” data or to continue to the next calculation, etc... ?
Example: a simple “subtract or double” sequence. If subtracting (say 1) from the current number would result in a term we already have, then double it instead, and start over again with subtraction.
Formally: a(0)=0, a(1)=1, and for n>=1,
a(n+1) = a(n)-1 if that number has not been found already, else a(n+1)=2*a(n).
0,1,2,4,3,6,5,10,9,8,7,14,13,12,11,22.....
The arithmetic operations are facile but how to organise the keeping and comparison process??
David.
ode := D(c)(t) = (ln(c(t)) + w - p*c(t))*(c(t)(t + 1/int(c(h), h = 0 .. t)) + int(c(h), h = 0 .. t))/(p - 1/c(t))
I have such differential equation derived from Euler-Lagrange condition of calculus of variation problem.
I tried to solve it, but it says there are two c(t) and c(h). c(t) is what I want to get.
Thank you
;
restart; with(plots); _local(O);
P := b*x*cos(phi)+a*y*sin(phi)-a . b = 0;
P := b x cos(phi) + a y sin(phi) - a . b = 0
Q := a*x*sin(phi)-b*y*cos(phi)-c^2*sin(phi)*cos(phi) = 0;
2
Q := a x sin(phi) - b y cos(phi) - c sin(phi) cos(phi) = 0
M := op(solve([P, Q], [x, y])); M := [subs(M, x), subs(M, y)];
X := `&-+`(P/sqrt(b^2*cos(phi)^2+a^2*sin(phi)^2)); Y := `&-+`(Q/sqrt(b^2*cos(phi)^2+a^2*sin(phi)^2));
#L'équation générale des coniques ayant pour axes MN et MT est, par rapport aux nouveaux axes de coordonnées
X^2/A+Y^2/B-1 = (0*et)*par*rapport*aux*anciens;
P^2/(A*(b^2*cos(phi)^2+a^2*sin(phi)^2))+Q^2/(B*(b^2*cos(phi)^2+a^2*sin(phi)^2))-1 = 0;
2
/b x cos(phi) + a y sin(phi) - a . b \
&-+|----------------------------------- = 0|
| (1/2) |
|/ 2 2 2 2\ |
\\a sin(phi) + cos(phi) b / /
---------------------------------------------
A
2
/ 2 \
|a x sin(phi) - b y cos(phi) - c sin(phi) cos(phi) |
&-+|-------------------------------------------------- = 0|
| (1/2) |
| / 2 2 2 2\ |
\ \a sin(phi) + cos(phi) b / /
+ ------------------------------------------------------------
B
- 1 = 0
#1.-Ecrivons que la conique (1) est tangente en O à Oy : il faut pour cela annuler le coefficient de y et le terme indépendant.
#Nous obtenons 2 équations en A et B, d'où nous tirons : A=a² et B=c²cos(phi)²
a := 10; b := 7; c := sqrt(a^2-b^2); phi := 4*Pi*(1/5);
Ell := implicitplot(x^2/a^2+y^2/b^2-1 = 0, x = -11 .. 11, y = -8 .. 8, color = grey);
O := [0, 0]; M := [a*cos(phi), b*sin(phi)];
vec := plot([O, M], color = black, thickness = 1);
P := implicitplot(P, x = -20 .. 20, y = -20 .. 20, color = aquamarine);
Q := implicitplot(Q, x = -20 .. 20, y = -20 .. 20);
F1 := [(a+b)*cos(phi), (a+b)*sin(phi)]; F2 := [2*M[1]-F1[1], 2*M[2]-F1[2]];
F1F2 := plot([F1, F2], color = green, thickness = 3);
ELL := implicitplot((b*x*cos(phi)+a*y*sin(phi)-a . b)^2/(a^2*(b^2*cos(phi)^2+a^2*sin(phi)^2))+(a*x*sin(phi)-b*y*cos(phi)-c^2*sin(phi)*cos(phi))^2/(c^2*cos(phi)^2*(b^2*cos(phi)^2+a^2*sin(phi)^2))-1 = 0, x = -20 .. 20, y = -20 .. 20, color = blue, thickness = 3);
Hyp := implicitplot((b*x*cos(phi)+a*y*sin(phi)-a . b)^2/(b^2*(b^2*cos(phi)^2+a^2*sin(phi)^2))+(a*x*sin(phi)-b*y*cos(phi)-c^2*sin(phi)*cos(phi))^2/(-c^2*sin(phi)^2*(b^2*cos(phi)^2+a^2*sin(phi)^2))-1 = 0, x = -20 .. 20, y = -20 .. 20, color = black);
dF1 := plottools[disk](F1, .3, color = red);
dF2 := plottools[disk](F2, .3, color = red);
cir1 := implicitplot(x^2+y^2 = (a+b)^2, x = -20 .. 20, y = -18 .. 18, color = pink);
cir2 := implicitplot(x^2+y^2 = (a-b)^2, x = -10 .. 10, y = -4 .. 4, color = coral);
asym1 := implicitplot((b*x*cos(phi)+a*y*sin(phi)-a . b)/b+(a*x*sin(phi)-b*y*cos(phi)-c^2*sin(phi)*cos(phi))/(c*sin(phi)) = 0, x = -20 .. 20, y = -18 .. 18, color = black, linestyle = DOT);
asym2 := implicitplot((b*x*cos(phi)+a*y*sin(phi)-a . b)/b-(a*x*sin(phi)-b*y*cos(phi)-c^2*sin(phi)*cos(phi))/(c*sin(phi)) = 0, x = -20 .. 20, y = -18 .. 18, color = black, linestyle = DOT);
tp := textplot([[M[1], M[2]+.8, "M"], [F1[1]-.8, F1[2], "F1"], [F2[1]+.8, F2[2]+.3, "F2"], [5, 15, "axe P"], [8, -10, "axe Q"]]);
display([Ell, vec, P, Q, F1F2, cir1, cir2, ELL, Hyp, dF1, dF2, asym1, asym2, tp], scaling = constrained, axes = normal, axis = [gridlines = [1, color = blue]], xtickmarks = 0, ytickmarks = 0, view = [-20 .. 20, -20 .. 20], size = [500, 500]);
#Eléments fixes : Ell, cir1, cir2, O
#Parties mobiles : ELL, Hyp, P,Q, M,F1, F2,
# FIGURE MOBILE
n := 100; dt := 2*Pi/n; Phi := 0;
P := b*x*cos(phi+dt)+a*y*sin(phi+dt)-a . b = 0;
Q := a*x*sin(phi+dt)-b*y*cos(phi+dt)-c^2*sin(phi+dt)*cos(phi+dt) = 0;
M := [cos(phi+dt)*(sin(phi+dt)^2*a*c^2+Typesetting[delayDotProduct](a . b, b, true))/(a^2*sin(phi+dt)^2+cos(phi+dt)^2*b^2), sin(phi+dt)*(-cos(phi+dt)^2*b*c^2+Typesetting[delayDotProduct](a . b, a, true))/(a^2*sin(phi+dt)^2+cos(phi+dt)^2*b^2)];
ELL := (b*x*cos(phi+dt)+a*y*sin(phi+dt)-a . b)^2/(a^2*(a^2*sin(phi+dt)^2+cos(phi+dt)^2*b^2))+(a*x*sin(phi+dt)-b*y*cos(phi+dt)-c^2*sin(phi+dt)*cos(phi+dt))^2/(c^2*cos(phi+dt)^2*(cos(phi+dt)^2*b^2+a^2))-1 = 0;
NULL;
display([Ell, cir1, cir2], scaling = constrained);
Hi,
I was attempting to solve an ODE, but it does not turn out anything. It is a bit complicated ODE. dsolve turns nothing, and I tried little different specification for an end point or initial point, but it calculates like forever giving nothing. What shall I do?
ode := 0 = diff(y(x), x) + ((r + 2*x)*(p - y(x)^(-s)))/(-(b*y(x) - x^2)*s*y(x)^(-s - 1))
parameters(0 < r, 0 < p, b < 1 and 0 < b, 0 < s)