Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I am trying to solve system of coupled equations in maple, but when I execute it, maple gives a trivial answer. Here is the code:

de1:=diff(u1(x,t),x)=(i/lambda)*(p*u1(x,t)+q*u2(x,t));
                  d             i (p u1(x, t) + q u2(x, t))
           de1 := -- u1(x, t) = ---------------------------
                  dx                      lambda

> de2:=diff(u2(x,t),x)=(i/lambda)*(q*u1(x,t)-p*u2(x,t));

                  d             i (q u1(x, t) - p u2(x, t))
           de2 := -- u2(x, t) = ---------------------------
                  dx                      lambda

> de3 := diff(u1(x,t),t) = -(i*lambda/2)*u1(x,t)-q*u2(x,t);

             d
      de3 := -- u1(x, t) = - 1/2 i lambda u1(x, t) - q u2(x, t)
             dt

> de4 := diff(u2(x,t),t) = 1/2*i*lambda*u2(x,t)+q*u1(x,t);

              d
       de4 := -- u2(x, t) = 1/2 i lambda u2(x, t) + q u1(x, t)
              dt

> dsolve({de1,de2,de3,de4},{u1(x,t),u2(x,t)});
 

I have an equation

2*x + 3*x^3

would like to change to

x1 + x2 + x3*x4*x5 + x6*x7*x8 + x9*x10*x11

hey 

mathcad contains a command explicit all wich shows the equation with all the named variabels replaced with the numbers they repercent. can maple do something similar?

a:=5

B:=10

c:=a+b explicit all 5+10=15

i hope someone can point me in the right direction 

thanks 

 

I have defined a function, F, as

F:=(s)->fouriersin(f(r), r, s)

I would now like to plot that function.

plot(F(s), s=0..3)

How can I do that? Calls to plot don't work, as the "s" in the fouriersin definition of the function get replaced by the value I'm trying to plot.

 

 

 

Hi,

Is there any one can tell me why I get so many solutions there by use solve(f(x),{x,y},explicit)? There suppose to be only two solutions. Thanks in advance!

Hello,

Can anyone tell me why this Maple phaseportrait command returns the error below ? Thanks in advance !

 

with(DEtools);
phaseportrait(-2*x*y, [x, y], x = -1.5 .. 1.5, {[0, -2], [0, -1], [0, 0], [0, 1], [0, 2], [0, 3]}, y = -1 .. 3);
Error, (in DEtools/phaseportrait) system must have same number of dependent variables as DE's.
 

Hello

The calculation of the jacobian matrix is not working.

https://de.maplesoft.com/support/help/maple/view.aspx?path=VectorCalculus/Jacobian

Testes on windows, mac. worhksheet and document mode.

Maple 2017.

 

 

 

with(VectorCalculus)

[`&x`, `*`, `+`, `-`, `.`, `<,>`, `<|>`, About, AddCoordinates, ArcLength, BasisFormat, Binormal, ConvertVector, CrossProduct, Curl, Curvature, D, Del, DirectionalDiff, Divergence, DotProduct, Flux, GetCoordinateParameters, GetCoordinates, GetNames, GetPVDescription, GetRootPoint, GetSpace, Gradient, Hessian, IsPositionVector, IsRootedVector, IsVectorField, Jacobian, Laplacian, LineInt, MapToBasis, Nabla, Norm, Normalize, PathInt, PlotPositionVector, PlotVector, PositionVector, PrincipalNormal, RadiusOfCurvature, RootedVector, ScalarPotential, SetCoordinateParameters, SetCoordinates, SpaceCurve, SurfaceInt, TNBFrame, TangentLine, TangentPlane, TangentVector, Torsion, Vector, VectorField, VectorPotential, VectorSpace, Wronskian, diff, eval, evalVF, int, limit, series]

(1)

Jacobian([rcos(t), rsin(t), r2t], [r, t])

Matrix(%id = 18446744078361292662)

(2)

``


 

Download DAROTIERTJACOBIANIMGRABSCHEISSEMA.mw

There seems to be patterns for sin(10^-k) for rational k;

Here we have the "floats."

n sin(10^(-n-1/2))

1 0.03161750640

2 0.003162272390

3 0.0003162277607

4 0.00003162277660

Hi!

Is it possible to create a vector, say

phi := Vector(2);
phi[1] := x[1]+2*x[2];
phi[2] := x[2]**2+x[1];

and then save it in a file that you can use in Matlab as a function handle?

I want to be able to create the phi vector in Maple but use it in Matlab.

Thanks for help!

 

You might recall this image being shared on social media some time ago.

Source: http://cvcl.mit.edu/hybrid_gallery/monroe_einstein.html

Look closely and you see Albert Einstein. However, if you move further away (or make the image smaller), you see Marilyn Monroe.

To create the image, the high spatial frequency data from an image of Albert Einstein was added to the low spatial frequency data from an image of Marilyn Monroe. This approach was pioneered by Oliva et al. (2006) and is influenced by the multiscale processing of human vision.

  • When we view objects near us, we see fine detail (that is, higher spatial frequencies dominate).

  • However, when we view objects at a distance, the broad outline has greater influence (that is, lower spatial frequencies dominate).

I thought I'd try to create a similar image in Maple (get the complete application here).

Here's an overview of the approach (as outlined in Oliva et al., 2006). I used different source images of Einstein and Monroe.

Let's start by loading some packages and defining a few procedures.

restart:
with(ImageTools):
with(SignalProcessing):

fft_shift := proc(M)
   local nRows, nCols, quad_1, quad_2, quad_3, quad_4, cRows, cCols;
   nRows, nCols := LinearAlgebra:-Dimensions(M):
   cRows, cCols := ceil(nRows/2), ceil(nCols/2):
   quad_1 := M[1..cRows,      1..cCols]:
   quad_2 := M[1..cRows,      cCols + 1..-1]:  
   quad_3 := M[cRows + 1..-1, cCols + 1..-1]:
   quad_4 := M[cRows + 1..-1, 1..cCols]:
   return <<quad_3, quad_2 |quad_4, quad_1>>:
end proc:

PowerSpectrum2D := proc(M)
   return sqrt~(abs~(M))
end proc:

gaussian_filter := (a, b, sigma) -> Matrix(2 * a, 2 * b, (i, j) -> evalf(exp(-((i - a)^2 + (j - b)^2) / (2 * sigma^2))), datatype = float[8]):

fft_shift() swaps quadrants of a 2D Fourier transform around so that the zero frequency components are in the center.

PowerSpectrum2D() returns the spectra of a 2D Fourier transform

gaussian_filter() will be used to apply a high or low-pass filter in the frequency domain (a and b are the number of rows and columns in the 2D Fourier transform, and sigma is the cut-off frequency.

Now let's import and display the original Einstein and Monroe images (both are the same size).

einstein_img := Read("einstein.png")[..,..,1]:
Embed(einstein_img)

marilyn_img  := Read("monroe.png")[..,..,1]:
Embed(monroe_img)

Let's convert both images to the spatial frequency domain (not many people know that SignalProcessing:-FFT can calculate the Fourier transform of matrices).

einstein_fourier := fft_shift(FFT(einstein_img)):
monroe_fourier   := fft_shift(FFT(monroe_img)):

Visualizing the power spectra of the unfiltered and filtered images isn't necessary, but helps illustrate what we're doing in the frequency domain.

First the spectra of the Einstein image. Lower frequency data is near the center, while higher frequency data is further away from the center.

Embed(Create(PowerSpectrum2D(einstein_fourier)))

Now the spectra of the Monroe image.

Embed(Create(PowerSpectrum2D(monroe_fourier)))

Now we need to filter the frequency content of both images.

First, define the cutoff frequencies for the high and low pass Gaussian filters.

sigma_einstein := 25:
sigma_monroe   := 10:

In the frequency domain, apply a high pass filter to the Einstein image, and a low pass filter to the Monroe image.

nRows, nCols := LinearAlgebra:-Dimension(einstein_img):

einstein_fourier_high_pass := einstein_fourier *~ (1 -~ gaussian_filter(nRows/2, nCols/2, sigma_einstein)):
monroe_fourier_low_pass    := monroe_fourier   *~ gaussian_filter(nRows/2, nCols/2, sigma_monroe):

Here's the spectra of the Einstein and Monroe images after the filtering (compare these to the pre-filtered spectra above).

Embed(Create(PowerSpectrum2D(einstein_fourier_high_pass)))

Embed(Create(PowerSpectrum2D(monroe_fourier_low_pass)))

Before combining both images in the Fourier domain, let's look the individual filtered images.

einstein_high_pass_img := Re~(InverseFFT(fft_shift(einstein_fourier_high_pass))):
monroe_low_pass_img    := Re~(InverseFFT(fft_shift(monroe_fourier_low_pass))):

We're left with sharp detail in the Einstein image.

Embed(FitIntensity(Create(einstein_high_pass_img)))

But the Monroe image is blurry, with only lower spatial frequency data.

Embed(FitIntensity(Create(monroe_low_pass_img)))

For the final image, we're simply going to add the Fourier transforms of both filtered images, and invert to the spatial domain.

hybrid_image := Create(Re~(InverseFFT(fft_shift(monroe_fourier_low_pass + einstein_fourier_high_pass)))):
Embed(hybrid_image)

So that's our final image, and has a similar property to the hybrid image at the top of this post.

  • Move close to the computer monitor and you see Albert Einstein.
  • Move to the other side of the room, and Marilyn Monroe swims into vision (if you're myopic, just take off your glasses and don't move back as much).

To simulate this, here, I've successively reduced the size of the hybrid image

And just because I can, here's a hybrid image of a cat and a dog, generated by the same worksheet.

Hi, 

Could the Maplesoft staff change the definition of the GammaDistribution in package Statistics?

In the all the papers or courses in the fiels of Probability or Statistics, the shape parameter is the first parameter of this distribution, while the scale (or "rate") parameter is the second.

From versions to versions the Maple definition of this distribution switches these parameters.
It's really a pain in the ass when you want to implement algorithms that use this distribution*

Thanks for your understanding


* for specialists, the Clayton copula uses as an ingredient a sample from Gamma(1/theta, 1) where theta is an adhoc parameter.
In Maple you must code s:=Sample(GammaDistribution(1, 1/theta)).

OK, you could reply me that once I know the trick it is the simplest thing at world to do the switch myself: nevertheless it's really boring, to say the least

1) start cmaple.exe;

2) type "proc(x, x);", and watch Maple die;

3) Request a refund from Maplesoft.

I am using command-line Maple cmaple.exe, I have been trying several hours to type the correct several characters to create a lambda function (anonymous function), but Maple's documentation is only for people using the GUI and gives no hint how to translate the right-arrow symbol into ASCII.

What is the secret, undocumented sequence of ASCII characters for defining an anonymous function via the command-line interface? (Why not document it in the user-manual, for those of who can't stand Maple's bad GUI?)

I have a maple code that has two output blocks giving a large number of numerical values for my experiment. I need these values to compare the output in both the code blocks and also to draw several figures using the data. On a single run of the program, a large number of values are obtained and then I manually copy them to excel sheet for further analysis. It takes a lot of my time to copy and paste the results on each run. I want to export the outputs of both the code blocks to a excel sheet. Any suggestion on this problem will be helpful to me. Thanks.

The link to my code is  maple-excel.mw.

I want the output in this format Book1.xlsx

Dear All,

I am having trouble with doing integration of a complex integrand with Maple 2016. The code is shown below. For simplicity, I have used a real function Psi00, but in general, it should be a complex function. Although I have assumed r to be real, in the final output, there is still an overhead bar on r^1/4. It is not recognized as real and is not multiplied on the r^5/4 factor to give r^3/2. May I ask you for help in solving this problem? Any of your help is highly appreciated!

Best,

Toby

assume(r, real); assume(phi, real);
Psi00 := exp(-(1/2)*r^2)/sqrt(Pi);
                             /  1  2\
                          exp|- - r |
                             \  2   /
                          -----------
                              (1/2)  
                            Pi       

int(int(conjugate(Psi00*r^(1/4))*Psi00*r^(1/4)*r, r = 0 .. infinity), phi = 0 .. 2*Pi);
    /   /             2 ______                          \\   
    |   |/   /  1  2\\   (1/4)  (5/4)                   ||   
    |   ||exp|- - r ||  r      r                        ||   
    |   |\   \  2   //                                  ||   
  2 |int|----------------------------, r = 0 .. infinity|| Pi
    \   \             Pi                                //   

First 764 765 766 767 768 769 770 Last Page 766 of 2219