MaplePrimes Questions

The equal sign ":=" in my document sign has changed to a "d".  The equal sign "=" has not changed.  Is there a setting I need to change?

Thank you in advance.

Hello

I need to share some results with a colleague who is not a user of Maple, and a way to do this is by using the Tabulate (plain command and not from DocumentTools) function to format them. In the worksheet, the output looks good, but when I try to print it or save it as a PDF, only a few lines are printed. It appears that Maple is not able to break the tables into multiple pages for printing.

The output is a table with 77 rows and 30 columns.   

I welcome alternative solutions to the problem of displaying the results. 

Many thanks

I am trying to find the value of y4 at t=infinity and t=-infinity when lambda1>lambda2 or lambda1<lambda2. But every time I got the same answer. For example, if we do it by hand then the terms which are responsible for making the indeterminate form can be extracted and canceled (see Fig.). 

But in limit.mw y4 is too lengthy-expression and very difficult to do it manually.

Hi,

 I'm looking for a simpler code to generate random proportional tables, like k*x type? Thanks for your suggestions.

TabPropQ.mw

Hey!

I am working on a 2-dimensional real curve gamma, that is being deformed by a real 2x2 matrix A and translated by some shift vector s. Both the matrix A and the vector s depend on two real parameters alpha and beta, which vary between 0 and 1. My goal is to create an animated plot that shows the curve depending on the parameters alpha and beta (ideally with some sort of slider, so I can play with different values of alpha and beta). I am having a hard time animating this, also because I am unsure if this is actually possible in Maple. The code I am working with is so far:

with(plots);
with(LinearAlgebra);
f := x -> exp(2*I*Pi*x);
CDFT := Matrix(3, 3, [[1, 1, 1], [1, f(1/3), f(2/3)], [1, f(2/3), f(1/3)]]);

al := 10/100;
be := 10/100;
lam1 := f(al);
lam2 := f(be);
lam3 := f(-al - be);
coef := (1/3*HermitianTranspose(CDFT)) . (Vector[column](3, [lam3, lam2, lam1]));
a := coef[1];
b := coef[2];
c := coef[3];

gam := t -> MatrixVectorMultiply(Matrix(2, 2, [[Re(a^2 + b*c), -Im(a^2 - b*c)], [Im(a^2 + b*c), Re(a^2 - b*c)]]), Vector[column](2, [cos(2*t) - 2*cos(t), sin(2*t) + 2*sin(t)])) + 3*Vector[column](2, [Re(b*c), Im(b*c)]);
P1 := plot([cos(2*t) - 2*cos(t), sin(2*t) + 2*sin(t), t = 0 .. 2*Pi], color = [blue]);
P2 := plot([gam(t)[1], gam(t)[2], t = 0 .. 2*Pi], color = [purple]);
plots:-display([P1, P2]);

Note that you can basically ignore everything up to the definition of the curve gam (short for gamma), apart from the definition of the parameters al and be (alpha and beta). The plot P1 corresponds to the "unperturbed curve", i.e. when we multiply the curve by the identity, which happens for alpha=beta=0. The plot P2 is now the deformed curve. The output is then:

My goal is now to animate this plot such that I can play with different values of alpha and beta, without having to manually insert them. How do I do this?

Here is an example where evalf[n] doesn't operate on the argument of the undefined function f.

x := rand(0. .. 1.)()
                          0.2342493224
y := x+f(x):
evalf[4](y)
                    0.2342 + f(0.2342493224)

# but, as soon as f is a known function:
evalf[4](cos(x))
                             0.9727


Here is a way to force evalf[4](f(x)) to return f(0.2342)?

I found only two ways to do this:
First: declare interface(displayprecision=4) 

interface(displayprecision=4):
y;
                 0.2342 + f(0.2342)

Or: do this (which is relatively cumbersome)

Evalf := proc(expr, n)
  local i := [indets(evalf[n](expr), numeric)[]]:
  eval(expr, i =~ evalf[4](i))
end proc:

Evalf(y, 4)
                 0.2342 + f(0.2342)

Thanks in advance.

PS:  I do not like setting displayprecision to some value because its effect is remnant: if you execute again the same worksheet (begining with a restart), the value of displayprecision is not reset to 10 but keeps the value you gave it previously, somewhere in the worksheet.

This worksheet animates the motion of an object (say, a cube which slides frictionlessly) on a rotating carousel. The cube is not self-propelled.

How can the worksheet be modified to handle the combination of the carousel motivated motion and the cube's own generated motion, caused by, say, by a few strategically placed thrusters?

The cube's own generated path could be a straight line, or a curve such as an ellipse. The cube's own motion could have a constant velocity or be accelerating.

Carousel_dynamics.mw

Hi,

How can two specular equations generate two nonspecular (i.e., very different in length and form) solutions? I attach my script with two questions at the bottom: 

specular_equations_nonspecular_solutions.mw

Thank you.

Maple seems to give me very inaccurate results for this computation, I'm wondering if this is a known issue and if there's a way to fix it? Worksheet:

Exact commands I ran:
with(combinat):
B := (n, i, p) -> binomial(n, i)*(p^i)*(1-p)^(n-i)/i;

F:=(n,p)->sum(B(n,i,p),i=1..n);
F(2,1);

This outputs 0, when it should output 1/2. See image attached:

 

Is there a fix for this?

xA := 4;
yA := 10;
xB := 0;
yB := 0;
xC := 13;
yC := 0;
Mat := matrix(3, 3, [xA, xB, xC, yA, yB, yC, 1, 1, 1]);
phi := (x, y) -> 1/Mat &x [x, y, z];
phi(4, 18/2);
phi(4, 10);
phi(13, 0);
Why the results are not calculated ? Thank you.

Hello everyone,

I wrote a very simple shooting method and I don't know why it doesn't go through the for loop.
Please help, I have no idea why it doesn't work.

Simple_ODE_Met_1.mw

This is probably a dummy question. I have a matrix (3 columns, 4 rows). I would like to extract the rows in which the value in the third column matches "2". As long as one has a matrix of 2 columns, this can be easily done by using the Lookup command but it does not allow you to give the row values of multiple columns. Is there another command that allows you to do that?

Thank you in advance for your help.

FindRowInMatrix.mw

The Statistics package contains a function named Specialize (which quite strangely doesn't appear when you expand the sections of this package).
Here is what help(Specialize) says:

The Specialize function takes a random variable or distribution data structure that contains symbolic parameters, and performs a substitution to specialize the given random variable or distribution.

My goal was to work with mixtures of two random variables. There are many ways to do that depending on the what you really want to achieve, but an elegant way is to define such a mixture this way:

  • Let X and Y two random variables representing the two components to be mixed.
    For instance X = Normal(mu, sigma) and Y = Normal(nu, tau).
     
  • Let B a Bernoulli random variable with parameter P.
     
  • Then M = B*X + (1-B)*Y represents a random mixture of the two components in proportions (p, 1-p).
    Note that M is a 5-parameters random variable.

Doing the things this way enables getting a lot of formal informations about M such as its mean, variance, and so on.

In order to illustrate what the mixture is I draw the histogram of a sample of M.
To do this I Specialized the three random variables X, Y, B.

I used parameters

mu=-3, nu=3, sigma=1, tau=1, p=1/2


My first attempt was to draw a sample of the random variable Mspec defined this way

Mspec := Specialize(B, [p=1/2])*Specialize(X, [mu=-3, sigma=1]) + (1-Specialize(B, [p=1/2]))*Specialize(Y, [nu=3, tau=1]);

As you see in the attached file (first plot) the histogram is wrong (so is the variance computed formally).

I changed this into

Mspec := Specialize(B, [p=1/2])*(Specialize(X, [mu=-3, sigma=1])-Specialize(Y, [nu=3, tau=1])) + Specialize(Y, [nu=3, tau=1]);

without more significative success: while the variance is nox corrext the histogram still remains obviously wrong (plot number 2)

My last attempt, which now gives q correct result (plot 3) was:

Bspec := Specialize(B, [p=1/2]);
Mspec := Bspec*Specialize(X, [mu=-3, sigma=1]) + (1-Bspec)*Specialize(Y, [nu=3, tau=1]);

Specialize.mw

I agree that one can easily do this stuff without using  Specialize.
For instance by using the procedure given at the end ofthe attached file.
Or by truly constructing a mixture Distribution (which would be more elegant but more complex).

I also agree that Specialize is in itself of a relative low interest except for educational purposes (you present the theoritical results and next you run a numerical application while giving numeric values to the formal parameters).

But why providing such an anecdotal function if it doesn't do the job correctly?

Note that these results were obtained with Maple 2015, but I doubt they'll be any better for more recent versions, given the confidential nature of Specialize.

I am trying to calculate the line element ds^2, for a de Sitter spacetime in 2+1 dimensions with positive cosmological constant, using the following metric and energy moment tensor:
1- ds² = -A(r) c^2 dt^2 + B(r) dr^2 + r^2d{\theta}^2,
2- T^{\mu \nu} = -(\rho + p) dx^{\mu} dx^{\nu} + p g^{\mu \nu}.

I tried several ways but I can't solve it using Maple 2023, Physics package. Could someone show me step by step how to solve this problem?

Images of the line element we need to find, the metric tensor associated with the problem and the components of the Riemann tensor.
My goal is to calculate the metric tensor, line element and associated components of the Riemann tensor for De Sitter spacetime with positive cosmological constant.

Is it possible to split a table (not the datatype, but the insert - table one)?

First 110 111 112 113 114 115 116 Last Page 112 of 2401