MaplePrimes Questions

Hi,

As in title: How can I generate random numbers sampled from, say, the logarithmic distribution (with a given value of the parameter)?

Thank you very much.

Anyone can help me to convert the following maple solution expressed by the hypergeom function to the LegendreP(n,b,x) or Q function?


 

restart

with(PDETools):

infolevel[pdsolve] := 3:

sol[1] := dsolve((1-x^2)*(diff(y(x), x, x))+n(n+1)*y(x) = 0)

y(x) = _C1*(-1+x^2)*hypergeom([3/4+(1/4)*(4*n(n+1)+1)^(1/2), 3/4-(1/4)*(4*n(n+1)+1)^(1/2)], [1/2], x^2)+_C2*(x^3-x)*hypergeom([5/4+(1/4)*(4*n(n+1)+1)^(1/2), 5/4-(1/4)*(4*n(n+1)+1)^(1/2)], [3/2], x^2)

(1)

convert(sol[1], LegendreP)

y(x) = _C1*(-1+x^2)*hypergeom([3/4+(1/4)*(4*n(n+1)+1)^(1/2), 3/4-(1/4)*(4*n(n+1)+1)^(1/2)], [1/2], x^2)+_C2*(x^3-x)*hypergeom([5/4+(1/4)*(4*n(n+1)+1)^(1/2), 5/4-(1/4)*(4*n(n+1)+1)^(1/2)], [3/2], x^2)

(2)

``


Download convert-Legendre.mw

https://math.stackexchange.com/questions/3254765/how-to-convert-a-hypergeom-function-to-the-legendre-function

I just want y(x) to be expressed in the form of LegendreP(n,b,x).

wave2.mw

 

Hellow!

 

I'm use Maple 13 (Linux)

I want save the value of u(x,t) at output file. This function is solution of PDE.

 

Can I get one file to each time value??

 

Ths

 

 

Hello!

I am truing to simplify kretchmann variable in the following worksheet:

 

 
M > 

# Obtaining Ricci and Kretchmann;
with(DifferentialGeometry):with(Tensor):

DGsetup([t, r, theta, phi], M);
g := evalDG(-(1-2*M*mu/r)^(1/mu)*dt &t dt+(1-2*M*mu/r)^(-1/mu)*`&t`(dr, dr)+r^2*(1-2*M*mu/r)^(1-1/mu)*(`&t`(dtheta, dtheta)+sin(theta)^2*`&t`(dphi, dphi)));
C := Christoffel(g):

`frame name: M`

 

_DG([["tensor", M, [["cov_bas", "cov_bas"], []]], [[[1, 1], -(-(2*M*mu-r)/r)^(1/mu)], [[2, 2], (-(2*M*mu-r)/r)^(-1/mu)], [[3, 3], r^2*(-(2*M*mu-r)/r)^((mu-1)/mu)], [[4, 4], r^2*(-(2*M*mu-r)/r)^((mu-1)/mu)*sin(theta)^2]]])

(1.1)

Rie := CurvatureTensor(C):
R := RicciScalar(g,Rie);
h := InverseMetric(g):
kretchmann := ContractIndices(RaiseLowerIndices(g, Rie, [1]), RaiseLowerIndices(h, Rie, [2, 3, 4]), [[1, 1], [2, 2], [3, 3], [4, 4]]);

2*(-(2*M*mu-r)/r)^(1/mu)*M^2*(mu^2-1)/(r^2*(2*M*mu-r)^2)

 

4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu^2+2*M*mu+M-2*r)^2/(r^6*(2*M*mu-r)^2)+4*(-(2*M*mu-r)/r)^(2/mu)*M^2*(M*mu^2+M*mu-r)^2/((2*M*mu-r)^4*r^4)+20*(-(2*M*mu-r)/r)^(2/mu)*(M*mu+M-r)^2*M^2/((2*M*mu-r)^4*r^4)+4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu^2+M*mu-r)^2/(r^6*(2*M*mu-r)^2)+4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu+M-r)^2/(r^6*(2*M*mu-r)^2)

(1.2)
M > 

# simplification

M > 

simplify(normal(R),symbolic)

2*(-1)^(1/mu)*(2*M*mu-r)^((1-2*mu)/mu)*r^((-1-2*mu)/mu)*M^2*(mu^2-1)

(1.3)
M > 

simplify(kretchmann,size,symbolic)

4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu^2+2*M*mu+M-2*r)^2/(r^6*(2*M*mu-r)^2)+4*(-(2*M*mu-r)/r)^(2/mu)*M^2*(M*mu^2+M*mu-r)^2/((2*M*mu-r)^4*r^4)+20*(-(2*M*mu-r)/r)^(2/mu)*(M*mu+M-r)^2*M^2/((2*M*mu-r)^4*r^4)+4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu^2+M*mu-r)^2/(r^6*(2*M*mu-r)^2)+4*(-(2*M*mu-r)/r)^(-2*(mu-1)/mu)*M^2*(M*mu+M-r)^2/(r^6*(2*M*mu-r)^2)

(1.4)
M > 

 


 

Download RicciScalarKretchmann.mw

The problem is that I cannot obtain a good form of it. With Mathematica FullSimplify[] function I got the following form (LaTeX code incoming): $K =& 4 M^2 \Bigl(A-B r+C r^2\Bigr)(r-2 M \mu)^{\frac{2}{\mu}-4}r^{-\frac{2}{\mu}-4},\
    A =&M^2 (\mu (3 \mu+2)+7) (\mu+1)^2,\,B = 8 M (\mu+2) (\mu+1),\, C = 12$, i.e. terms $(r-2 M \mu)$ and $r$ got fully factorized. However, I could never achieve the same form in Maple. Any help?


I am sorry if this is a silly and many-times-answered question, but I tried consulting with Maple help and googling solutions without any success.

Regards,
Nick

Is there anyway, i can using maple software command to create a symbol for either math or nursing.Math sumbol or nursing symbol..if there is a way, can u please let me kw the way, i need it urgently.Thanks

Hi Maple experts and others,

We want to make a graph with 6 vertical lines.  One end of every vertical line will be on the x axis.  The other end of the vertical lines will be on integers of data points.

 


 

3+2

5

(1)

ab := Vector[row](6); cd := Vector[row](6)

ab := Vector[row](6, {(1) = 5, (2) = 8, (3) = 11, (4) = 14, (5) = 17, (6) = 20})

 

cd := Vector[row](6, {(1) = 1, (2) = 2, (3) = 3, (4) = 4, (5) = 5, (6) = 6})

(2)

for count to 6 do ab[count] := 3*count+2; cd[count] := count end do;

5

 

1

 

8

 

2

 

11

 

3

 

14

 

4

 

17

 

5

 

20

 

6

(3)

ab

Vector[row]([5, 8, 11, 14, 17, 20])

(4)

cd

Vector[row]([1, 2, 3, 4, 5, 6])

(5)

``


 

Download a_try.mw

Please assist us.

Regards,

Matt

 

I'm trying to do something very simple, but I can not do it. I would like to fill the chart with colors of my choice.

restart: with (plots):
plots [animate] (plot, [[sqrt (x), sqrt (x) -1], x = 0..t, filled = true, view = [0..20, 0..5]], t = 0..20);

The filled = true option fills the graph with random colors.
I tried to use filled = ["Blue", "Red"], but that does not work.

Any tips?

Thank you

 

I got this solution from a PDE. I normally use unapply on the RHS of the solution to make it a function.

But in this, the PDE solution contain some extra stuff at the end. Which  "Where { .....}"

So the only way for me, was to manually copy the initial part of the solution shown on the screen in order to use it later.

I could not find a way to program this part.

Here is an example

restart;

f:=(r,z)->(r-a)*sin(z/H*Pi);
lap:=VectorCalculus:-Laplacian(u(r, z, t), cylindrical[r, theta,z]);
bc:=u(r,0,t)=0,u(r,H,t)=0, u(a,z,t)=0;
ic:=u(r,z,0) = f(r,z);
sol:=pdsolve([diff(u(r,z,t),t) = k*lap,bc,ic],u(r,z,t)) assuming a>0,k>0;

THis gives

Which I verified to be correct.

In case you are not able to get this solution (it needs Maple 2019.1 and Physics 368), here is the lprint

 

lprint(sol)

u(r,z,t) = `casesplit/ans`(Sum(-BesselJ(0,lambda[n]/a*r)*sin(z/H*Pi)*exp(-k*t*(
H^2*lambda[n]^2+Pi^2*a^2)/a^2/H^2)*a/lambda[n]^2*Pi*BesselJ(1,lambda[n])*
StruveH(0,lambda[n])/hypergeom([1/2],[1, 2],-lambda[n]^2),n = 1 .. infinity),{
And(lambda[n] = BesselJZeros(0,n),0 < lambda[n])})

Next to use it (plot., evaluate, etc...) changed the sum go to 15 terms (more than enough) and also replaced a->1,H->3,k->1/100 and  also replaced lambda[n] with BesselJ zeros as follows

sol:=subs({infinity=15,a=1,H=3,k=1/100,lambda[n]=BesselJZeros(0, n)},sol);

Before I use unapply, I had to extract the part of the solution up to where it says "where..." since I do not need the rest any more, since I allready replaced lambda[n] with BesselJZeros calls.

This I did by hand using copy/paste from the screen. Now I am able to finish the task:

solFiltered:=Sum(-BesselJ(0, BesselJZeros(0, n)*r)*sin(z*Pi/3)*
     exp(-t*(9*BesselJZeros(0, n)^2 + Pi^2)/900)*Pi*
     BesselJ(1, BesselJZeros(0, n))*
     StruveH(0, BesselJZeros(0, n))/(BesselJZeros(0, n)^2*
     hypergeom([1/2], [1, 2], -BesselJZeros(0, n)^2)), n = 1 .. 15):

mapleSol:=unapply(solFiltered,r,z,t);

value(mapleSol(.5,2,1));

Which prints -0.4107565091 which is the correct value. It matches my hand solution and also match numerical solution.

What would a better way to do the above than what I did? i.e. to obtain the solFitered above using code only? 

Consider a wave y=f(x,t) with amplitude modulation such that it becomes

 y_new=(1+A)*f(x,t), where A=A(t) is a small perturbation.

How can I do the simulation to test the robustness of the system to see if the wave is stable / unstable under perturbation? As the time t goes to infinity, I want to see if the original wave is distorted or not under either random or prescribed perturbation.

P.S. For example,  f(x,t) = (sech(0.5*x-0.1*t))^2.

Thank you for your help.

Hi,

Can someone please help me plot a bunch of tangent lines to approximate the given space curve? I know how to do it in another CAS system however I am trying to make the switch over to maple.  Question.mw.