Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Let be given tetrahedron ABCD, where AB = BC = AC = a, AD = d, AD = e, CD = f. I know that, If the measure of angle of AB and CD equal to Pi/3, then we have d^2 - e^2 - a*f = 0. I tried:
ListTools[Categorize];
L := []; 
for a to 30 do for d to 30 do
for e to 30 do for f to 30 do
if abs(d-e) < a and a < d+e and abs(a-e) < d and d < a+e and abs(d-a) < e and e < d+a and abs(d-f) < a and a < d+f and abs(a-f) < d and d < a+f and abs(d-a) < f and f < d+a and abs(e-f) < a and a < e+f and abs(a-f) < e and e < a+f and abs(a-e) < a and a < a+e and -a*f+d^2-e^2 = 0 and igcd(a, d, e, f) = 1 and nops({a, d, e, f}) = 4
then L := [op(L), [a, d, e, f]] end if end do end do end do end do; 
nops(L); 
L;


Another way to find the length of edges of a tetrahedron knowing that the mesure angle of two opposite?


 

For Maple 2018.1, there are improvements in pdsolve's ability to solve PDE with boundary and initial conditions. This is work done together with E.S. Cheb-Terrab. The improvements include an extended ability to solve problems involving non-homogeneous PDE and/or non-homogeneous boundary and initial conditions, as well as improved simplification of solutions and better handling of functions such as piecewise in the arguments and in the processing of solutions. This is also an ongoing project, with updates being distributed regularly within the Physics Updates.

Solving more problems involving non-homogeneous PDE and/or non-homogeneous boundary and initial conditions

 

 

Example 1: Pinchover and Rubinstein's exercise 6.17: we have a non-homogenous PDE and boundary and initial conditions that are also non-homogeneous:

pde__1 := diff(u(x, t), t)-(diff(u(x, t), x, x)) = 1+x*cos(t)
iv__1 := (D[1](u))(0, t) = sin(t), (D[1](u))(1, t) = sin(t), u(x, 0) = 1+cos(2*Pi*x)

pdsolve([pde__1, iv__1])

u(x, t) = 1+cos(2*Pi*x)*exp(-4*Pi^2*t)+t+x*sin(t)

(1)

How we solve the problem, step by step:

   

 

Example 2: the PDE is homogeneous but the boundary conditions are not. We solve the problem through the same process, which means we end up solving a nonhomogeneous pde with homogeneous BC as an intermediate step:

pde__2 := diff(u(x, t), t) = 13*(diff(u(x, t), x, x))
iv__2 := (D[1](u))(0, t) = 0, (D[1](u))(1, t) = 1, u(x, 0) = (1/2)*x^2+x

pdsolve([pde__2, iv__2])

u(x, t) = 1/2+Sum(2*(-1+(-1)^n)*cos(n*Pi*x)*exp(-13*Pi^2*n^2*t)/(Pi^2*n^2), n = 1 .. infinity)+13*t+(1/2)*x^2

(12)

How we solve the problem, step by step:

   

 

Example 3: a wave PDE with a source that does not depend on time:

pde__3 := (diff(u(x, t), x, x))*a^2+1 = diff(u(x, t), t, t)
iv__3 := u(0, t) = 0, u(L, t) = 0, u(x, 0) = f(x), (D[2](u))(x, 0) = g(x)

`assuming`([pdsolve([pde__3, iv__3])], [L > 0])

u(x, t) = (1/2)*(2*(Sum(sin(n*Pi*x/L)*(2*L*(Int(sin(n*Pi*x/L)*g(x), x = 0 .. L))*sin(a*Pi*t*n/L)*a-Pi*(Int(sin(n*Pi*x/L)*(-2*f(x)*a^2+L*x-x^2), x = 0 .. L))*cos(a*Pi*t*n/L)*n)/(Pi*n*a^2*L), n = 1 .. infinity))*a^2+L*x-x^2)/a^2

(23)

How we solve the problem, step by step:

   

 

Example 4: Pinchover and Rubinstein's exercise 6.23 - we have a non-homogenous PDE and initial condition:

pde__4 := diff(u(x, t), t)-(diff(u(x, t), x, x)) = g(x, t)
iv__4 := (D[1](u))(0, t) = 0, (D[1](u))(1, t) = 0, u(x, 0) = f(x)

pdsolve([pde__4, iv__4], u(x, t))

u(x, t) = Int(f(tau1), tau1 = 0 .. 1)+Sum(2*(Int(f(tau1)*cos(n*Pi*tau1), tau1 = 0 .. 1))*cos(n*Pi*x)*exp(-Pi^2*n^2*t), n = 1 .. infinity)+Int(Int(g(x, tau1), x = 0 .. 1)+Sum(2*(Int(g(x, tau1)*cos(n1*Pi*x), x = 0 .. 1))*cos(n1*Pi*x)*exp(-Pi^2*n1^2*(t-tau1)), n1 = 1 .. infinity), tau1 = 0 .. t)

(30)

If we now make the functions f and g into specific mappings, we can compare pdsolve's solutions to the general and specific problems:

f := proc (x) options operator, arrow; 3*cos(42*x*Pi) end proc
g := proc (x, t) options operator, arrow; exp(3*t)*cos(17*x*Pi) end proc

 

Here is what pdsolve's solution to the general problem looks like when taking into account the new values of f(x) and g(x,t):

value(simplify(evalindets(u(x, t) = Int(f(tau1), tau1 = 0 .. 1)+Sum(2*(Int(f(tau1)*cos(n*Pi*tau1), tau1 = 0 .. 1))*cos(n*Pi*x)*exp(-Pi^2*n^2*t), n = 1 .. infinity)+Int(Int(g(x, tau1), x = 0 .. 1)+Sum(2*(Int(g(x, tau1)*cos(n1*Pi*x), x = 0 .. 1))*cos(n1*Pi*x)*exp(-Pi^2*n1^2*(t-tau1)), n1 = 1 .. infinity), tau1 = 0 .. t), specfunc(Int), proc (u) options operator, arrow; `PDEtools/int`(op(u), AllSolutions) end proc)))

u(x, t) = 3*cos(42*Pi*x)*exp(-1764*Pi^2*t)+cos(Pi*x)*(65536*cos(Pi*x)^16-278528*cos(Pi*x)^14+487424*cos(Pi*x)^12-452608*cos(Pi*x)^10+239360*cos(Pi*x)^8-71808*cos(Pi*x)^6+11424*cos(Pi*x)^4-816*cos(Pi*x)^2+17)*(exp(289*Pi^2*t+3*t)-1)*exp(-289*Pi^2*t)/(289*Pi^2+3)

(31)

 

Here is pdsolve's solution to the specific problem:

pdsolve([pde__4, iv__4], u(x, t))

u(x, t) = ((-65536*cos(Pi*x)^17+278528*cos(Pi*x)^15-487424*cos(Pi*x)^13+452608*cos(Pi*x)^11-239360*cos(Pi*x)^9+71808*cos(Pi*x)^7-11424*cos(Pi*x)^5+816*cos(Pi*x)^3-17*cos(Pi*x))*exp(-289*Pi^2*t)+(867*Pi^2+9)*cos(42*Pi*x)*exp(-1764*Pi^2*t)+65536*(cos(Pi*x)^16-(17/4)*cos(Pi*x)^14+(119/16)*cos(Pi*x)^12-(221/32)*cos(Pi*x)^10+(935/256)*cos(Pi*x)^8-(561/512)*cos(Pi*x)^6+(357/2048)*cos(Pi*x)^4-(51/4096)*cos(Pi*x)^2+17/65536)*exp(3*t)*cos(Pi*x))/(289*Pi^2+3)

(32)

 

And the two solutions are equal:

simplify((u(x, t) = 3*cos(42*x*Pi)*exp(-1764*Pi^2*t)+cos(x*Pi)*(65536*cos(x*Pi)^16-278528*cos(x*Pi)^14+487424*cos(x*Pi)^12-452608*cos(x*Pi)^10+239360*cos(x*Pi)^8-71808*cos(x*Pi)^6+11424*cos(x*Pi)^4-816*cos(x*Pi)^2+17)*(exp(289*Pi^2*t+3*t)-1)*exp(-289*Pi^2*t)/(289*Pi^2+3))-(u(x, t) = ((-65536*cos(x*Pi)^17+278528*cos(x*Pi)^15-487424*cos(x*Pi)^13+452608*cos(x*Pi)^11-239360*cos(x*Pi)^9+71808*cos(x*Pi)^7-11424*cos(x*Pi)^5+816*cos(x*Pi)^3-17*cos(x*Pi))*exp(-289*Pi^2*t)+(867*Pi^2+9)*cos(42*x*Pi)*exp(-1764*Pi^2*t)+65536*(cos(x*Pi)^16-(17/4)*cos(x*Pi)^14+(119/16)*cos(x*Pi)^12-(221/32)*cos(x*Pi)^10+(935/256)*cos(x*Pi)^8-(561/512)*cos(x*Pi)^6+(357/2048)*cos(x*Pi)^4-(51/4096)*cos(x*Pi)^2+17/65536)*exp(3*t)*cos(x*Pi))/(289*Pi^2+3)))

0 = 0

(33)

f := 'f'; g := 'g'

f

 

g

(34)

 

Improved simplification in integrals, piecewise functions, and sums in the solutions returned by pdsolve

 

 

Example 1: exercise 6.21 from Pinchover and Rubinstein is a non-homogeneous heat problem. Its solution used to include unevaluated integrals and sums, but is now returned in a significantly simpler format.

pde__5 := diff(u(x, t), t)-(diff(u(x, t), x, x)) = t*cos(2001*x)
iv__5 := (D[1](u))(0, t) = 0, (D[1](u))(Pi, t) = 0, u(x, 0) = Pi*cos(2*x)

pdsolve([pde__5, iv__5])

u(x, t) = (1/16032024008001)*(4004001*t+exp(-4004001*t)-1)*cos(2001*x)+Pi*cos(2*x)*exp(-4*t)

(35)

pdetest(%, [pde__5, iv__5])

[0, 0, 0, 0]

(36)

 

Example 2: example 6.46 from Pinchover and Rubinstein is a non-homogeneous heat equation with non-homogeneous boundary and initial conditions. Its solution used to involve two separate sums with unevaluated integrals, but is now returned with only one sum and unevaluated integral.

pde__6 := diff(u(x, t), t)-(diff(u(x, t), x, x)) = exp(-t)*sin(3*x)
iv__6 := u(0, t) = 0, u(Pi, t) = 1, u(x, 0) = phi(x)

pdsolve([pde__6, iv__6], u(x, t))

u(x, t) = (1/8)*(8*(Sum(2*(Int(-(-phi(x)*Pi+x)*sin(n*x), x = 0 .. Pi))*sin(n*x)*exp(-n^2*t)/Pi^2, n = 1 .. infinity))*Pi-Pi*(exp(-9*t)-exp(-t))*sin(3*x)+8*x)/Pi

(37)

pdetest(%, [pde__6, iv__6])

[0, 0, 0, (-phi(x)*Pi^2+Pi*x+2*(Sum((Int(-(-phi(x)*Pi+x)*sin(n*x), x = 0 .. Pi))*sin(n*x), n = 1 .. infinity)))/Pi^2]

(38)

 

More accuracy when returning series solutions that have exceptions for certain values of the summation index or a parameter

 

 

Example 1: the answer to this problem was previously given with n = 0 .. infinity instead of n = 1 .. infinity as it should be:

pde__7 := diff(v(x, t), t, t)-(diff(v(x, t), x, x))
iv__7 := v(0, t) = 0, v(x, 0) = -(exp(2)*x-exp(x+1)-x+exp(1-x))/(exp(2)-1), (D[2](v))(x, 0) = 1+(exp(2)*x-exp(x+1)-x+exp(1-x))/(exp(2)-1), v(1, t) = 0

pdsolve([pde__7, iv__7])

v(x, t) = Sum(-2*sin(n*Pi*x)*((Pi^2*(-1)^n*n^2-Pi^2*n^2+2*(-1)^n-1)*sin(Pi*t*n)-(-1)^n*cos(Pi*t*n)*Pi*n)/(Pi^2*n^2*(Pi^2*n^2+1)), n = 1 .. infinity)

(39)

 

Example 2: the answer to exercise 6.25 from Pinchover and Rubinstein is now given in a much simpler format, with the special limit case for w = 0 calculated separately:

pde__8 := diff(u(x, t), t) = k*(diff(u(x, t), x, x))+cos(w*t)
iv__8 := (D[1](u))(L, t) = 0, (D[1](u))(0, t) = 0, u(x, 0) = x

`assuming`([pdsolve([pde__8, iv__8], u(x, t))], [L > 0])

u(x, t) = piecewise(w = 0, (1/2)*L+Sum(2*L*(-1+(-1)^n)*cos(n*Pi*x/L)*exp(-k*Pi^2*n^2*t/L^2)/(n^2*Pi^2), n = 1 .. infinity)+t, (1/2)*(L*w+2*(Sum(2*L*(-1+(-1)^n)*cos(n*Pi*x/L)*exp(-k*Pi^2*n^2*t/L^2)/(n^2*Pi^2), n = 1 .. infinity))*w+2*sin(w*t))/w)

(40)

 

Improved handling of piecewise, eval/diff in the given problem

 

 

Example 1: this problem, which contains a piecewise function in the initial condition, can now be solved:

pde__9 := diff(f(t, x), t) = diff(f(t, x), x, x)
iv__9 := f(t, 0) = 0, f(t, 1) = 1, f(0, x) = piecewise(x = 0, 1, 0)

pdsolve([pde__9, iv__9])

f(t, x) = Sum(2*(-1)^n*sin(n*Pi*x)*exp(-Pi^2*n^2*t)/(n*Pi), n = 1 .. infinity)+x

(41)

 

Example 2: this problem, which contains a derivative written using eval/diff, can now be solved:

pde__10 := -(diff(u(x, t), t, t))-(diff(u(x, t), x, x))+u(x, t) = 2*exp(-t)*(x-(1/2)*x^2+(1/2)*t-1)

iv__10 := u(x, 0) = x^2-2*x, u(x, 1) = u(x, 1/2)+((1/2)*x^2-x)*exp(-1)-((3/4)*x^2-(3/2)*x)*exp(-1/2), u(0, t) = 0, eval(diff(u(x, t), x), {x = 1}) = 0

pdsolve([pde__10, iv__10], u(x, t))

u(x, t) = -(1/2)*exp(-t)*x*(x-2)*(t-2)

(42)

 

References:

 

Pinchover, Y. and Rubinstein, J.. An Introduction to Partial Differential Equations. Cambridge UP, 2005.


 

Download What_is_New_after_Maple_2018.mw

 

Katherina von Bülow


evalf[100](frac(exp(19*Pi)-19*Pi));

0.32853457802957784855876405976954586639886249604033514784046998713819112593


evalf[10](frac(exp(19*Pi)-19*Pi));

 

0.

Hello Friends

I have a critical problem that I wish to solve it with maple

suppose we have a list like following: y_obs=(2,4,8,7,9,52,35,478,52) and corresponding variance σy=(.2,.3,.5,.87,.1.2,.22,.78,.99,1.5)
we know y as the function of x described such as y_theoric=x+p and minimizing X is

X=Sigma [(y_theoric-y_obs)^2]/σy which includes the sum of nine numbers...

the question is:

How we can find p from likelihood function and plot general behavior of y versus of x through two above series?

for example this solution used in article under the names Hubble parameter data constraints on dark energy by Yun Chen and Bhatra Ratra (Physics Letters B)

Thank you

 

In an attempt to explore the field of image processing, Samir and I created an application (download here) that demonstrates the removal of twot types of noises from an image through frequency and spatial filtering.

Periodic noises and salt & pepper noises are two common types of image noises, usually caused by errors during the image capturing or data transmission process. Periodic noises result in repetitive patterns being added onto the original image, while salt & pepper noises are the irregular appearance of dark pixels in the bright area and bright pixels in the dark area of the image. In this application, we artificially generate these noises and pollute a clean picture in order to demonstrate the removal techniques.

(Fig 1: Picture of Waterloo Office taken by Sophie Tan            Fig 2: Converted to greyscale for processing, added two noises)

In order to remove periodic noises from the image, we apply a 2D Fourier Transform to convert the image from spatial domain to frequency domain, where periodic noises can be visually detected as separate, discrete spikes and therefore easily removed.

(Fig 3 Frequency domain of the magnitude of the image)

One way to remove salt and pepper noises is to apply a median filter to the image. In this application, we run a 3 by 3 kernel across the image matrix that sorts and places the median among the 9 elements as the new matrix entry, thus resulting in the whole image being median-filtered.

Comparison of the image before and after noise removal:

Please refer to the application for more details on the implementation of the two removal techniques.

 

Hello everyone! I am currently solving on a basic coordinates points for my final year project. This is a part of my coding in maple.


ans := solve({eq5, eq6}, {P2, Q2});
             {P2 = 3.222860033, Q2 = 3.170614592}, 

               {P2 = 1.572224939, Q2 = 5.670614592}

 

I am finding the points of P2 and Q2. From there after solving for eq5 and 6 it will gives two points for P2 and two points for Q2. So how am i going to choose the points using maple coding without copy paste the answer?

Really appreciate if any of us can help me. Thank you in advanced :)

 

Consider for instance the following equation:

Eq:=(a-4)*exp(4*x)+(b+1)*exp(2*x)+(c-2)=0

How can I list the coefficients of the exponential functions and also solve the equation for the constant parameters 

a, b, and c?

I tried 

[coeffs(collect(lhs(EQ), exp), exp)] =~ 0;

but it did not work. Thank you for your help.

I mean 

restart;
 plots:-implicitplot(sqrt(b)*sqrt(1-4*p/b)-2*arctan(sqrt((9*p/b-22201/10000)/(9/4-9*p/b))) = 0, b = 0 .. 5,
 p = 0 .. 5, gridrefine = 2, rational);

I find the above result unsatisfactory.

Hi, my problem is that I have a set of variables stored in a list, then when I try to sum with differentiation inside the sum, Maple immediately tries to differentiate before summing, thus returning zero.

 

So I define a list coords := [t, r, theta, varphi], then call sum(diff(r^2, coords[k]), k = 1 .. 4), however Maple does the differentiation first, so it becomes 0 instead of 8r.

 

I attached the maple worksheet with what I did, on the first line I define the list with variables, on the second line I show that maple evaluates diff(r^2, coords[k]) to zero before doing the sum, where k is what is being summed over, on the third line I show that it copes fine if a specific element of the list is called, on the fourth line I show that summation over elements of the list is fine, and the last two lines show an example of the kind of thing I would like to do

 

Is there a way to make this work?

Dear Maple Primes,

could you, please, help me with numeric integration? I’m new in numeric integration and can’t reach desired precision of a result.
Here is the integral f(xmax) that I try to compute for different values of xmax from the interval 0.025..0.24 :

f:=(xmax)->Int(K*F*Int(G*F,x=x..xmax,method=integrationmethod),x=x0..xmax,method=integrationmethod)

where x0 is lower limit of outer integral, x0 := 0.025

and K, F and G are functions of x

K:=x-x0

F:=(a1+a2*x+a3*x2+a4*x5)/(b1*x+b2*x2+b3*x6)

G:=exp(c1+c2*x+c3*x7)

with

a1:=8e3; a2:=6e4; a3:=3e4; a4:=1.8e8;
b1:=9.2e17; b2:=1.1e18; b3:=4.6e21;
c1:=8.202046; c2:=-12.31377; c3:=-818043.42;

Please, notice, that G (as well as G*F) is a steeply decreasing function on the interval x = 0.025..0.24.

I get "a seemingly correct" result (that means that f increases as xmax intreases), when I try to plot f(xmax) for the following "guessed" options

Digits:=15
integrationmethod:=_d01akc
plot(f,0.21..0.24,color=black)

What is puzzling me is that I get a different "seemingly correct" result, when I modify the integral f by,
at fist, multiplying G by a constant (for example Const:=1e20; G:=Const*exp(c1+c2*x+c3*x7) )
and, second, plotting the f divided by this constant:

plot(f/Const,0.21..0.24,color=red)

The following Figure presents the values of f plotted versus xmax with (red curve) and without (black curve) using of the constant Const:

Dear Primes, could you, please, comment on this difference? Because the only indicator that I have (from the analysis of G, F and K) is that f must be a monotonically (and stricktly) increasing function of xmax.

Please, find the maple worksheet in attachment.

Thank you in advance!
Maks

for_primes_numeric_integration_v02.mw

I want to find the maximize and minimize of the function
f:=x->(cos(x)+sqrt(3)*sin(x))/(cos(x)+sin(x)+2);
I tried 
minimize(f(x), x, location = 'true');
and
maximize(f(x), x, location = 'true');
But I didn't get the results.  How do I find the maximize and minimize of above funciton?

Hello,

     I have a very large expression I'm tring to average (by doing limit(1/L*int(<expr>,t=-L..L),L=infinty) ). However, given that this expression is so large (sum of 11k terms), I'm was looking for ways to speed up the calculation and use less RAM.

     I found that applying the lim@int seperately to each term of the sum helps. Also, since my integrand has various functions of other variables (eg. f(x), g(y), etc), Maple seems to go faster if I freeze those functions using frontend.

     However, the problem I'm running into is that, as I'm running through my for-loop to apply lim@int to each term, Maple starts running slower and slower, as well as taking more and more RAM. Additionally, it doesn't go to completion because it runs out of stack space.

     Is there an optimization trick to avoid this problem? I've tried garbage collecting after each iteration; that helps the RAM problem (at a cost of speed), but it still slows down over time.

      I've attached my code: MWE.maple. Fair warning: on a non-server computer, it is liable to run very slow.

Is it possible to convert E1(x) to Ei(x) explicitly?

In particular I have this expression which is real, but imaginary numbers appear due to the definition of Ei1 for negative arguments.

(-exp(j*z)*Ei(1, j*z)+I*Pi*exp(-j*z)+exp(-j*z)*Ei(1, -j*z))/(2*j)

 

j>0,z>0

 

Thank you

In the application whose link is below, an error message results when I right click the fsolve command and select explore.

https://www.maplesoft.com/applications/view.aspx?SID=119851

I would like to explore changes to several of the parameters in the equations named "sys", especially the value of Qoutflow. Can this be done and, If so, how can the solved values, Q1, Q2, Q3, and H be graphed as the slider values of individual parameters values are modified?

1) How can i get the event time. This example 0.69313.

2) I don't want to see the Warning.How can i do it? 

 

Warning, cannot evaluate the solution further right of .69314729, event #1 triggered a halt
1 2 3 4 5 6 7 Last Page 1 of 1424