Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Probability_density_normalization.mw

In this code I'm trying to separately normalize two independent probability densities and then combine them to get the joint probability density that's normalized and then use it to calculate the probability that the two variables are equal. fD(x) is a Gaussian divided by x^2 and fA(x) is a Gaussian. The first problem occurs when I'm checking the normalization of the joint probability density by doing the double integral over all space for fD(x)*fA(y)dxdy, I get weird vanishing number when the parameter "hartree" takes a certain value, namely 27.211. If I change hartree to 27 or 1 or 2 it all worked, but 27.211 is not good. Also later when I do a single integral over all space for fD(x)*fA(x)dx to get the probability that these two are equal, I find the result is dependent on hartree. This hartree thing is a unit conversion in my physical problem and in principle should not interfere with either the normalization or the probability result at all. I suspect this is a coding bug but I can't find what it is. I'd appreciate any input.

Thank you very much!

 

Edit: I found out that the problem with the double integral normalization may have something to do with the discretization for numerical evaluation of the integral, since if I change the lower bound to 1/hartree and upper to 10/hartree then it's fine, however if I use lower bound at 1/hartree and upper at 5/hartree it doesn't work, although the distribution has no value between 5/hartree and 10/hartree. However after this is fixed I still have the problem with the single integral over all space for fD(x)*fA(x)dx changing with hartree. Well as a probability I would expect the integral to be bound between 0 and 1, but since it almost linearly depends on hartree, at hartree around 27 I would get the integral value to be about 25, which doesn't make sense. In fact, I now suspect it is not Maple, but my calculation of the probability of the two random variables taking the same value is wrong, I'd appreciate it very much if someone can confirm this.

Integral.mw

Hi all

 

Please help me to solve this Integral...

 

 

 

phi := sin((1/4)*Pi*x)*(c__1*cosh((1/4)*Pi*y)+c__3*y*cosh(Pi/(4*y))+c__4*y*sinh((1/4)*Pi*y));

sin((1/4)*Pi*x)*(c__1*cosh((1/4)*Pi*y)+c__3*y*cosh((1/4)*Pi/y)+c__4*y*sinh((1/4)*Pi*y))

(1)

phi

sin((1/4)*Pi*x)*(c__1*cosh((1/4)*Pi*y)+c__3*y*cosh((1/4)*Pi/y)+c__4*y*sinh((1/4)*Pi*y))

(2)

diff((2), y);

sin((1/4)*Pi*x)*((1/4)*c__1*sinh((1/4)*Pi*y)*Pi+c__3*cosh((1/4)*Pi/y)-(1/4)*c__3*sinh((1/4)*Pi/y)*Pi/y+c__4*sinh((1/4)*Pi*y)+(1/4)*c__4*y*cosh((1/4)*Pi*y)*Pi)

(3)

diff((3), y);

sin((1/4)*Pi*x)*((1/16)*c__1*cosh((1/4)*Pi*y)*Pi^2+(1/16)*c__3*cosh((1/4)*Pi/y)*Pi^2/y^3+(1/2)*c__4*cosh((1/4)*Pi*y)*Pi+(1/16)*c__4*y*sinh((1/4)*Pi*y)*Pi^2)

(4)

phi

sin((1/4)*Pi*x)*(c__1*cosh((1/4)*Pi*y)+c__3*y*cosh((1/4)*Pi/y)+c__4*y*sinh((1/4)*Pi*y))

(5)

diff((5), x);

(1/4)*cos((1/4)*Pi*x)*Pi*(c__1*cosh((1/4)*Pi*y)+c__3*y*cosh((1/4)*Pi/y)+c__4*y*sinh((1/4)*Pi*y))

(6)

diff((6), x);

-(1/16)*sin((1/4)*Pi*x)*Pi^2*(c__1*cosh((1/4)*Pi*y)+c__3*y*cosh((1/4)*Pi/y)+c__4*y*sinh((1/4)*Pi*y))

(7)

phi

sin((1/4)*Pi*x)*(c__1*cosh((1/4)*Pi*y)+c__3*y*cosh((1/4)*Pi/y)+c__4*y*sinh((1/4)*Pi*y))

(8)

diff((8), x);

(1/4)*cos((1/4)*Pi*x)*Pi*(c__1*cosh((1/4)*Pi*y)+c__3*y*cosh((1/4)*Pi/y)+c__4*y*sinh((1/4)*Pi*y))

(9)

diff((9), y);

(1/4)*cos((1/4)*Pi*x)*Pi*((1/4)*c__1*sinh((1/4)*Pi*y)*Pi+c__3*cosh((1/4)*Pi/y)-(1/4)*c__3*sinh((1/4)*Pi/y)*Pi/y+c__4*sinh((1/4)*Pi*y)+(1/4)*c__4*y*cosh((1/4)*Pi*y)*Pi)

(10)

``

(11)

-(1/16)*Pi^2*sin((1/4)*Pi*x)*(c__1*cosh((1/4)*Pi*y)+c__3*y*cosh((1/4)*Pi/y)+c__4*y*sinh((1/4)*Pi*y))=0;

-(1/16)*Pi^2*sin((1/4)*Pi*x)*(c__1*cosh((1/4)*Pi*y)+c__3*y*cosh((1/4)*Pi/y)+c__4*y*sinh((1/4)*Pi*y)) = 0

(12)

eval( (12), [x = 0]);

0 = 0

(13)

-(1/16)*Pi^2*sin((1/4)*Pi*x)*(c__1*cosh((1/4)*Pi*y)+c__3*y*cosh((1/4)*Pi/y)+c__4*y*sinh((1/4)*Pi*y)) = 0

-(1/16)*Pi^2*sin((1/4)*Pi*x)*(c__1*cosh((1/4)*Pi*y)+c__3*y*cosh((1/4)*Pi/y)+c__4*y*sinh((1/4)*Pi*y)) = 0

(14)

eval( (14), [x = 20]);

0 = 0

(15)

sin((1/4)*Pi*x)*((1/16)*c__1*Pi^2*cosh((1/4)*Pi*y)+(1/16)*c__3*Pi^2*cosh((1/4)*Pi/y)/y^3+(1/2)*c__4*Pi*cosh((1/4)*Pi*y)+(1/16)*c__4*y*Pi^2*sinh((1/4)*Pi*y)) = 0

sin((1/4)*Pi*x)*((1/16)*c__1*Pi^2*cosh((1/4)*Pi*y)+(1/16)*c__3*Pi^2*cosh((1/4)*Pi/y)/y^3+(1/2)*c__4*Pi*cosh((1/4)*Pi*y)+(1/16)*c__4*y*Pi^2*sinh((1/4)*Pi*y)) = 0

(16)

eval( (16), [y = 9]);

sin((1/4)*Pi*x)*((1/16)*c__1*Pi^2*cosh((9/4)*Pi)+(1/11664)*c__3*Pi^2*cosh((1/36)*Pi)+(1/2)*c__4*Pi*cosh((9/4)*Pi)+(9/16)*c__4*Pi^2*sinh((9/4)*Pi)) = 0

(17)

evalf[5]( (17) );

sin(.78540*x)*(362.25*c__1+0.84938e-3*c__3+4182.6*c__4) = 0.

(18)

sin((1/4)*Pi*x)*((1/16)*c__1*Pi^2*cosh((1/4)*Pi*y)+(1/16)*c__3*Pi^2*cosh((1/4)*Pi/y)/y^3+(1/2)*c__4*Pi*cosh((1/4)*Pi*y)+(1/16)*c__4*y*Pi^2*sinh((1/4)*Pi*y)) = -sin((1/4)*pi*x);

sin((1/4)*Pi*x)*((1/16)*c__1*Pi^2*cosh((1/4)*Pi*y)+(1/16)*c__3*Pi^2*cosh((1/4)*Pi/y)/y^3+(1/2)*c__4*Pi*cosh((1/4)*Pi*y)+(1/16)*c__4*y*Pi^2*sinh((1/4)*Pi*y)) = -sin((1/4)*pi*x)

(19)

eval( (19), [y = -9]);

sin((1/4)*Pi*x)*((1/16)*c__1*Pi^2*cosh((9/4)*Pi)-(1/11664)*c__3*Pi^2*cosh((1/36)*Pi)+(1/2)*c__4*Pi*cosh((9/4)*Pi)+(9/16)*c__4*Pi^2*sinh((9/4)*Pi)) = -sin((1/4)*pi*x)

(20)

evalf[5]( (20) );

sin(.78540*x)*(362.25*c__1-0.84938e-3*c__3+4182.6*c__4) = -1.*sin(.25000*pi*x)

(21)

-(1/4)*cos((1/4)*Pi*x)*Pi*((1/4)*c__1*sinh((1/4)*Pi*y)*Pi+c__3*cosh((1/4)*Pi/y)-(1/4)*c__3*sinh((1/4)*Pi/y)*Pi/y+c__4*sinh((1/4)*Pi*y)+(1/4)*c__4*y*cosh((1/4)*Pi*y)*Pi) = 0

-(1/4)*cos((1/4)*Pi*x)*Pi*((1/4)*c__1*sinh((1/4)*Pi*y)*Pi+c__3*cosh((1/4)*Pi/y)-(1/4)*c__3*sinh((1/4)*Pi/y)*Pi/y+c__4*sinh((1/4)*Pi*y)+(1/4)*c__4*y*cosh((1/4)*Pi*y)*Pi) = 0

(22)

eval( (22), [y = 9]);

-(1/4)*cos((1/4)*Pi*x)*Pi*((1/4)*c__1*sinh((9/4)*Pi)*Pi+c__3*cosh((1/36)*Pi)-(1/36)*c__3*sinh((1/36)*Pi)*Pi+c__4*sinh((9/4)*Pi)+(9/4)*c__4*Pi*cosh((9/4)*Pi)) = 0

(23)

evalf[5]( (23) );

-.78540*cos(.78540*x)*(461.22*c__1+.99617*c__3+4738.2*c__4) = 0.

(24)

-(1/4)*cos((1/4)*Pi*x)*Pi*((1/4)*c__1*sinh((1/4)*Pi*y)*Pi+c__3*cosh((1/4)*Pi/y)-(1/4)*c__3*sinh((1/4)*Pi/y)*Pi/y+c__4*sinh((1/4)*Pi*y)+(1/4)*c__4*y*cosh((1/4)*Pi*y)*Pi) = 0;

-(1/4)*cos((1/4)*Pi*x)*Pi*((1/4)*c__1*sinh((1/4)*Pi*y)*Pi+c__3*cosh((1/4)*Pi/y)-(1/4)*c__3*sinh((1/4)*Pi/y)*Pi/y+c__4*sinh((1/4)*Pi*y)+(1/4)*c__4*y*cosh((1/4)*Pi*y)*Pi) = 0

(25)

eval( (25), [y = -9]);

-(1/4)*cos((1/4)*Pi*x)*Pi*(-(1/4)*c__1*sinh((9/4)*Pi)*Pi+c__3*cosh((1/36)*Pi)-(1/36)*c__3*sinh((1/36)*Pi)*Pi-c__4*sinh((9/4)*Pi)-(9/4)*c__4*Pi*cosh((9/4)*Pi)) = 0

(26)

evalf[5]( (26) );

-.78540*cos(.78540*x)*(-461.22*c__1+.99617*c__3-4738.2*c__4) = 0.

(27)

s:=solve({sin(.78540*x)*(362.25*c__1+0.84938e-3*c__3+4182.6*c__4) = 0,sin(.78540*x)*(362.25*c__1-0.84938e-3*c__3+4182.6*c__4) = -1.*sin(.25000*Pi*x),-.78540*cos(.78540*x)*(461.22*c__1+.99617*c__3+4738.2*c__4) = 0,-.78540*cos(.78540*x)*(-461.22*c__1+.99617*c__3-4738.2*c__4) = 0},{c1,c2,c3,c4});

{c__1 = 0., c__3 = 0., c__4 = 0., x = 0.}, {c__1 = -10.27318850*c__4, c__3 = 0., c__4 = c__4, x = 0.}, {c__1 = -11.54616977*c__4-0.1380262250e-2, c__3 = 588.6646731, c__4 = c__4, x = -1.999995323}, {c__1 = -11.54616977*c__4-0.1380262250e-2, c__3 = 588.6646731, c__4 = c__4, x = 1.999995323}

(28)

``

 

Download analytical_case_1.mw

Dear collegues

Hope you are fine

I wrote a code to solve a system of ODEs.

The code solve the problem for higher values of parameter NBT>=5. When I decrease it to NBT=0.2, the code didnt converge. I did my best but I couldnt get the results.

I would be most grateful if you help me at this problem

The code is attached

Thank you

Final_code.mw

 

Amir

Hello all! I've just learned about Maple. My English is not very good :( I write matrix A:=L*U program. If you know it, you will understand my mind. But I received "error" from Maple. Thanks for your viewing

A=LU.mw

My_Plot.mw

Hi all,

I want to plot This attached figure in Matlab. As we know the HeunT function is not defined in Matlab. Now I want to get all the three curves Data for plotting them in Matlab. I have asked this some days ago and I got it. But now I want to get data for three curves instead of one.

 

Please help me.

There have come unwanted lines and marks . I donot know how to remove them. Using doc.block, remove block seems to be little tough to incorporate! Please enlighten me. Modified doc. is most welcome. Thanks. Ramakrishnan V 

Gaussian Elimination Method

 

 

Given*the*equations

  restartreset:

with(Student[LinearAlgebra])``

(1)
Coefficient Tanle

Equation 1

Equation 2

Equation 3

Equations

`m__1,1` := 3:
`` 

`m__2,1` := 2:
``

`m__3,1` := 1:
``

`m__1,1`*x__1+`m__1,2`*y+`m__1,3`*z = `m__1,4`; = 3*x__1+y-z = 3

`m__2,1`*x__1+`m__2,2`*y+`m__2,3`*z = `m__2,4`; = 2*x__1-8*y+z = -5

```m__3,1`*x__1+`m__3,2`*y+`m__3,3`*z = `m__3,4`; = x__1-2*y+9*z = 8

The equations in matrix form is given by

Matrix([[3, 1, -1, 3], [2, -8, 1, -5], [1, -2, 9, 8]])

(2)

The Gaussian Elimination gives the simplified natrix equation as given below:

Matrix([[3, 1, -1, 3], [0, -26/3, 5/3, -7], [0, 0, 231/26, 231/26]])

(3)

``The equations in simplified form are:

3*x+y-z = 3

(4)

-(26/3)*y+(5/3)*z = -7

(5)

(231/26)*z = 231/26

(6)

``

The aolution ia obtained by solving the above equations in reverse order

{x = 1, y = 1, z = 1}

(7)

 

``

 

Download GausianFinal15Nov2015.mwGausianFinal15Nov2015.mw

hello eveyone! sorry, my English is not very good

I writed Neville algorithm

I want to creat a table(or a matrix) Q with

example:

f:=X->2^X;

with value of X: -2,1,0,1,2

-2   1/4

-1    1/2

0    1

1    2

2     4

I want to approximate f at x=0.5 by Neville

then:   for i:=2,...,n   (that case is 5)

             for j:=2,...i

 

                  Q[i,j]=(x-X[i-j])*Q[i,j-1]-(x-X[i])*Q[i-1,j-1])/(X[i]-X[i-j])

       output(Q)

this is:

-2  1/4     0       0            0          0

-1  1/2     0.875  0           0           0

0  1         1.25   1.3475    0           0

1  2         1.5    1.4375   1.421875  0

2  4         1      1.375      1.40625  1.412109375


do you understand my mind? sorry, my English is not very good

Regards

   sunflower

hi all

i have a complex numeric like s. 

how can i calculate s

There are the complexes (C), quaternions (H or Q), octionions (O), sedenions (S) and the pathions (P). I have found the multiplication tables of them, although according to signs (+ or -) there differents at pathions. The important question is that How can I multiply two bases, i_n and i_m of higher dimensions, like in the routions or in the voudions?

Should I xor the indexes of the bases? Like this way: i_1 * i_2 = i_(1^2) = i_3

What is about the signs?

Hello,

I would like to plot an non linear oscillator.

The equations are the following:

r:=sqrt((x(t)/a)^2+(z(t)/b)^2);
eqx:=diff(x(t),t)=alpha*(1-r^2)*x+wa/b*z(t);
eqz:=diff(z(t),t)=beta*(1-r^2)*y+wb/a*x(t);
EqSys:=[eqx,eqz];

The constants are the following :

alpha:=1:
beta:=1:
a=0.4:
b=0.2:
w=1:

I didn't manage with Deplots. May you help me to plot this oscillator?

Thank a lot for your help and ideas

I'm trying to solve the differential equation.

Eq := diff(y(x), x, x) = -(x^2+1)*y(x)+K;

dsolve({Eq, y(-1) = 0, y(1) = 0}, y(x));

But this not work very well.

Best Regards,

 

I am using Maple 15, and before that Maple 8 and Maple 13. While using the versions 13 and 15, 

I come across with this problem; I cannot copy an output and use it as input. In Maple 8, I was able to do this but in 

these improved versions, it seems that it is not possible. Is there a way to solve this problem? I saw some answers about this

problem suggesting to change launch.ini file. But I could not apply this suggestion, since it is not permitted by the system. 

First 1182 1183 1184 1185 1186 1187 1188 Last Page 1184 of 2224