Maple 2017 Questions and Posts

These are Posts and Questions associated with the product, Maple 2017

Hi, I am new to Maple 2017. I would appreciate advice on how to plot the following integral over the range a = -10 to a = 10

I(a):=int(exp(-x^2)*sin(a*x),x=0..infinity)

 

Thank you.

Aidan

1. Where do we report potential bugs

 

2. My finding:

https://imgur.com/a/w688r

The image uploading on this forum is not letting me and I find it to be less user friendly. Please view the sequence of images in the given link above.

This is not a problem, just my finiding.

 

Hello everyone,

I need to expand this:

>abs(u+v)^2+abs(u-v)^2

so I have as a final expressioin

>|u|^2+|v|^2=1

This is the property that has to be true so the probability is one.

>assume(u::complex, v::complex);  does not work and the simple commande

>expand() neither.  Any idea?

I am having a problem with image tools read a file from workbook.

In one document i get

Read("this:///101-Escher.bmp");
Error, (in ImageTools:-Read) unable to open database file

In another document I cant save the file. 

Maple will multiply two matrices for me perfectly.  

However, when I change the value in one of the cells and try to re-evaluate the product, Maple starts giving me the sum of something in all of my cells.   

 

Are you simply not allowed to ever change the initial values you set for a matrix?  This doesn't seem to make sense to me.  

I have attached a screen shot to show an example with a random matrix.  

Hey, friends, I have a differential equation to confuse me too much!  The question is shown in the below:

ODEs:

y''(x)-0.00003019*y(x)^0.337=0  ,       0<x<2945

BCs:

y(0)=0,    y'(2945)=0.0116 

 

I want to have the numerical solution, I used to plot y(x) and y'(x) , but errors shows me "jacobian is singular at left endpoint, use midpoint method instead."  Thank you for you any help in advance!!!  

Can you give me the code to figure it out in Maple?  Thank you so so so so much!

I have to fit two lists of data to a function of the type A*sin(bx+c)+d, but when I do (actual data):

X := [seq(i, i = 0 .. 24)];
Y := [1154, 1156, 1156, 1155, 1152, 1143, 1105, 1069, 1051, 1077, 1117, 1154, 1154, 1156, 1158, 1157, 1155, 1152, 1128, 1089, 1058, 1059, 1092, 1130, 1163];

with(Statistics):

f:=Fit(A*sin(b*x+c)+d, X, Y, x);
plot({f(x), [seq([X[i], Y[i]], i = 1 .. 25)]}, x = 0 .. 24, style = [line, point])

They match up very poorly. I can get a better fit by using Geogebra (which produces a function 48.7 * sin(0.52x + 0.56) + 1124.95, which fits the data much better).

I can get a good fit using CurveFitting[Interactive], but the resulting function doesn't fit my target format. What can I do to get a better fit in Maple while staying within the target format?

Is the smallest unit of time that Maple can use to report the computation time millisecond? When I use time(...) the output is a floating-point number with at most three digits after the floating point and since the unit in Maple help is said to be seconds, I'm thinking the smallest time unit it will report is millisecond. Is there any possibility to have more digits in the time reports, let's say up to 10-5 seconds?

unames()   produces an error  in extended typsetting mode (the default in Maple 2017)  after any output.

#interface(typesetting=standard);

restart;

interface(typesetting=extended);

extended

(1)

unames();

Error, invalid input: Typeset:-Kernel expects an equation for keyword parameter numericformatting

 

` `

 

Error, unexpected result from Typesetting

 

 

hi

im beginner in maple, i have a parametric matrix that i want to muliply it in a vector of differential equations like below.

i have functions like thees;

u(x,y,z)=u0(x,y)+z*u1(x,y)

v(x,y,z)=v0(x,y)+z*v1(x,y)

matrix:  A=[a,b;c,d]

vector : b = [du/dx, dv/dy]

now i want to do like this:

C=A.B

but i dont know how to do this.

 

Currently working on Fourier series. Having trouble plotting the graph of the Fourier series and would love to add and use a package such as the one found here: https://www.maplesoft.com/applications/view.aspx?SID=4857 . I'm having trouble installing and using the package, though. Could anyone be so kind as to assist me in adding and using packages not already found in Maple?

Hi all,

All other programs put it functionallity into Mac's menu line in the top, so your here have the following

"Appel logo" "Program name" File Edit View Inset

but this is not happening with Maple 2017???     anyone who have a solution for this 

 

best regards

Claus

Hi

I have a long column vector containing data in Records.

A:=Vector[column](4, [J_K = `Record(mu = 724.901557888305, sigma = 96.7437910529146)`, I_W = `Record(mu = 775.098442111694, sigma = 96.7437910529198)`, K_J = `Record(mu = 785.098442111694, sigma = 96.7437910529198)`, D_B = `Record(mu = 764.901557888305, sigma = 96.7437910529146)`])

How to I sort this in descending values of mu so I get:

Vector[column](4, [K_J = `Record(mu = 785.098442111694, sigma = 96.7437910529198)`,I_W = `Record(mu = 775.098442111694, sigma = 96.7437910529198)`,D_B = `Record(mu = 764.901557888305, sigma = 96.7437910529146)`,J_K = `Record(mu = 724.901557888305, sigma = 96.7437910529146)`])

Im aware you can extract mu from Records by the rhs(A[1]):-mu

 

 

Hi

I've got this list:

L:=[[TC,DB], [], [TD,JK], [IW,CM], [], [KJ,DJ]]

What command to remove the 'null sets', leaving :=[[TC,DB],[TD,JK], [IW,CM], [KJ,DJ]]

this doesn't work:

remove(has, L, 0)

A project that I have been working on is adding some functionality for Cluster Analysis to Maple (a small part of a much bigger project to increase Maple’s toolkit for exploratory data mining and data analysis). The launch of the MapleCloud package manager gave me a way to share my code for the project as it evolves, providing others with some useful new tools and hopefully gathering feedback (and collaborators) along the way.

At this point, there aren’t a lot of commands in the ClusterAnalysis package, but I have already hit upon several interesting applications. For example, while working on a command for plotting clusters of points, one problem I encountered was how to draw the minimal volume enclosing ellipsoid around a group (or cluster) of points. After doing some research, I stumbled upon Khachiyan’s Algorithm, which related to solving linear programming problems with rational data. The math behind this is definitely interesting, but I’m not going to spend any time on it here. For further reading, you can explore the following:

Khachiyan’s Algorithm had previously been applied in some other languages, but to the best of my knowledge, did not have any Maple implementations. As such, the following code is an implementation of Khachiyan’s Algorithm in 2-D, which could be extended to N-dimensional space rather easily.

This routine accepts an Nx2 dataset and outputs either a plot of the minimum volume enclosing ellipsoid (MVEE) or a list of results as described in the details for the ‘output’ option below.

MVEE( X :: DataSet, optional arguments, additional arguments passed to the plotting command );

The optional arguments are as follows:

  • tolerance : realcons;  specifies the convergence criterion
  • maxiterations : posint; specifies the maximum number of iterations
  • output : {identical(data,plot),list(identical(data,plot))}; specifies the output. If output includes plot, then a plot of the enclosing ellipsoid is returned. If output includes data, then the return includes is a list containing the matrix A, which defines the ellipsoid, the center of the ellipse, and the eigenvalues and eigenvectors that can be used to find the semi-axis coordinates and the angle of rotation, alpha, for the ellipse.
  • filled : truefalse; specifies if the returned plot should be filled or not

Code:

#Minimum Volume Enclosing Ellipsoid
MVEE := proc(XY, 
              {tolerance::positive:= 1e-4}, #Convergence Criterion
              {maxiterations::posint := 100},
              {output::{identical(data,plot),list(identical(data,plot))} := data},
              {filled::truefalse := false} 
            )

    local alpha, evalues, evectors, i, l_error, ldata, ldataext, M, maxvalindex, n, ncols, nrows, p1, semiaxes, stepsize, U, U1, x, X, y;
    local A, center, l_output; #Output

    if hastype(output, 'list') then
        l_output := output;
    else
        l_output := [output];
    end if;

    kernelopts(opaquemodules=false):

    ldata := Statistics:-PreProcessData(XY, 2, 'copy');

    nrows, ncols := upperbound(ldata);
    ldataext := Matrix([ldata, Vector[column](nrows, ':-fill' = 1)], 'datatype = float');

    if ncols <> 2 then
        error "expected 2 columns of data, got %1", ncols;
    end if;

    l_error := 1;

    U := Vector[column](1..nrows, 'fill' = 1/nrows);

    ##Khachiyan Algorithm##
    for n to maxiterations while l_error >= tolerance do

        X := LinearAlgebra:-Transpose(ldataext) . LinearAlgebra:-DiagonalMatrix(U) . ldataext;
        M := LinearAlgebra:-Diagonal(ldataext . LinearAlgebra:-MatrixInverse(X) . LinearAlgebra:-Transpose(ldataext));
        maxvalindex := max[index](map['evalhf', 'inplace'](abs, M));
        stepsize := (M[maxvalindex] - ncols - 1)/((ncols + 1) * (M[maxvalindex] - 1));
        U1 := (1 - stepsize) * U;
        U1[maxvalindex] := U1[maxvalindex] + stepsize;
        l_error := LinearAlgebra:-Norm(LinearAlgebra:-DiagonalMatrix(U1 - U));
        U := U1;

    end do;

    A := (1/ncols) * LinearAlgebra:-MatrixInverse(LinearAlgebra:-Transpose(ldata) . LinearAlgebra:-DiagonalMatrix(U) . ldata - (LinearAlgebra:-Transpose(ldata) . U) . LinearAlgebra:-Transpose((LinearAlgebra:-Transpose(ldata) . U)));
    center := LinearAlgebra:-Transpose(ldata) . U;
    evalues, evectors := LinearAlgebra:-Eigenvectors(A);
    evectors := evectors(.., sort[index](1 /~ (sqrt~(Re~(evalues))), `>`, ':-output' = ':-permutation'));
    semiaxes := sort(1 /~ (sqrt~(Re~(evalues))), `>`);
    alpha := arctan(Re(evectors[2,1]) / Re(evectors[1,1]));

    if l_output = [':-data'] then
        return A, center, evectors, evalues;
    elif has( l_output, ':-plot' ) then
            x := t -> center[1] + semiaxes[1] * cos(t) * cos(alpha) - semiaxes[2] * sin(t) * sin(alpha);
            y := t -> center[2] + semiaxes[1] * cos(t) * sin(alpha) + semiaxes[2] * sin(t) * cos(alpha);
            if filled then
                p1 := plots:-display(subs(CURVES=POLYGONS, plot([x(t), y(t), t = 0..2*Pi], ':-transparency' = 0.95, _rest)));
            else
                p1 := plot([x(t), y(t), t = 0..2*Pi], _rest);
            end if;
        return p1, `if`( has(l_output, ':-data'), op([A, center, evectors, evalues]), NULL );
    end if;

end proc:

 

You can run this as follows:

M:=Matrix(10,2,rand(0..3)):

plots:-display([MVEE(M,output=plot,filled,transparency=.3),
                plots:-pointplot(M, symbol=solidcircle,symbolsize=15)],
size=[0.5,"golden"]);

 

 

As it stands, this is not an export from the “work in progress” ClusterAnalysis package – it’s actually just a local procedure used by the ClusterPlot command. However, it seemed like an interesting enough application that it deserved its own post (and potentially even some consideration for inclusion in some future more geometry-specific package). Here’s an example of how this routine is used from ClusterAnalysis:

with(ClusterAnalysis);

X := Import(FileTools:-JoinPath(["datasets/iris.csv"], base = datadir));

kmeans_results := KMeans(X[[`Sepal Length`, `Sepal Width`]],
    clusters = 3, epsilon = 1.*10^(-7), initializationmethod = Forgy);

ClusterPlot(kmeans_results, style = ellipse);

 

 

The source code for this is stored on GitHub, here:

https://github.com/dskoog/Maple-ClusterAnalysis/blob/master/src/MVEE.mm

Comments and suggestions are welcomed.

 

If you don’t have a copy of the ClusterAnalysis package, you can install it from the MapleCloud window, or by running:

PackageTools:-Install(5629844458045440);

 

First 28 29 30 31 32 33 34 Last Page 30 of 40