Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hi, 

Can we tell maple to give output in a form which contain any specific term or expression. For example- Can I tell maple to give output which contain (x^2+2*x+3) expression in the output. I used various combinations in collect command but it doesn't work. It is shown in enclosed maple worksheet.

I have some questions about output produced by maple. I have attached a maple worksheet in which I asked the questions in comments. Please help mein in this problem because it become very tedious to type each expression by hand in desired form. If maple produce it by some means it would be great help.

desired_form_in_output.mw

Thanks and Regards,

Nilesh

 

 

When we first started trying to use Maple to create a maple leaf like the one in the Canada 150 logo, we couldn’t find any references online to the exact geometry, so we went back to basics. With our trusty ruler and protractor, we mapped out the geometry of the maple leaf logo by hand.

Our first observation was that the maple leaf could be viewed as being comprised of 9 kites. You can read more about the meaning of these shapes on the Canada 150 site (where they refer to the shapes as diamonds).

We also observed that the individual kites had slightly different scales from one another. The largest kites were numbers 3, 5 and 7; we represented their length as 1 unit of length. Also, each of the kites seemed centred at the origin, but was rotated about the y-axis at a certain angle.

As such, we found the kites to have the following scales and rotations from the vertical axis:

Kites:

1, 9: 0.81 at +/- Pi/2

2, 8: 0.77 at +/- 2*Pi/5

3, 5, 7: 1 at +/-Pi/4, 0

4, 6: 0.93 at +/- Pi/8

This can be visualized as follows:

To draw this in Maple we put together a simple procedure to draw each of the kites:

# Make a kite shape centred at the origin.
opts := thickness=4, color="#DC2828":
MakeKite := proc({scale := 1, rotation := 0})
    local t, p, pts, x;

    t := 0.267*scale;
    pts := [[0, 0], [t, t], [0, scale], [-t, t], [0, 0]]:
    p := plot(pts, opts);
    if rotation<>0.0 then
        p := plottools:-rotate(p, rotation);
    end if;
    return p;
end proc:

 

The main idea of this procedure is that we draw a kite using a standard list of points, which are scaled and rotated. Then to generate the sequence of plots:

shapes := MakeKite(rotation=-Pi/4),
          MakeKite(scale=0.77, rotation=-2*Pi/5),

          MakeKite(scale=0.81, rotation=-Pi/2),
          MakeKite(scale=0.93, rotation=-Pi/8),
          MakeKite(),
          MakeKite(scale=0.93, rotation=Pi/8),
          MakeKite(scale=0.81, rotation=Pi/2),
          MakeKite(scale=0.77, rotation=2*Pi/5),
          MakeKite(rotation=Pi/4),
          plot([[0,-0.5], [0,0]], opts): #Add in a section for the maple leaf stem
plots:-display(shapes, scaling=constrained, view=[-1..1, -0.75..1.25], axes=box, size=[800,800]);

This looked pretty similar to the original logo, however the kites 2, 4, 6, and 8 all needed to be moved behind the other kites. This proved somewhat tricky, so we just simply turned on the point probe in Maple and drew in the connected lines to form these points.

shapes := MakeKite(rotation=-Pi/4),
          plot([[-.55,.095],[-.733,.236],[-.49,.245]],opts),

          MakeKite(scale=0.81, rotation=-Pi/2),
          plot([[-.342,.536],[-.355,.859],[-.138,.622]],opts),
          MakeKite(),
          plot([[.342,.536],[.355,.859],[.138,.622]],opts),
          MakeKite(scale=0.81, rotation=Pi/2),
          plot([[.55,.095],[.733,.236],[.49,.245]],opts),
          MakeKite(rotation=Pi/4),
          plot([[0,-0.5], [0,0]], opts):
plots:-display(shapes, scaling=constrained, view=[-1..1, -0.75..1.25], axes=box, size=[800,800]);

Happy Canada Day!

Hi,

I have two objective function which I want to prove concave with respect to four independent variables jointly (simultaneously).

`TP1 is the first objective function which is defined  in sol1 equation. TP2 is the second objective function which is defined  in sol3 equation. I want to maximize both function. There are four decision variables (independent variables) in both the objective function expression- T,E,W,p. Ten  parameters used in both the equations are- alpha, beta, c, h, m, o, s, u, a, b.

1) My first question is - How can I prove both the function as a concave function with respect to four decision variables jointly. Can I specify some range of parameters in which both these function would behave like a concave function. The feasible range of these parameters are-

`[alpha>0, 0<= beta<1, c>0, h>0, 0<= m<=1, o>0, s>0, u>0, a>0] [ b>0 for objective function TP1 and b>1 for objective function TP2].

Some other restriction on parameters and variables are-  p>c  ,  T<=m , T>=0, E>=0, W>=0, W>=E.

2) My second question is if I simplify my first question and specify some specific values of parameters as I done for both objective function, then I got two new objective function in sol2 and sol4 equation. Now can I prove these two objective function (sol2 & sol4) as concave with respect to four decision variables T,E,W,p jointly. I want to prove concavity for these two objective function because if it is proved concave then The first order optimality solution would give me the global optimal solution. 

Maple worksheet is enclosed.

concavity_proof_question.mw

Thanks and Regards,

Nilesh

I have a plain text file, with hundreds of lines. I read using the command

ImportMatrix(file_to_read, source=csv):

The files has mixed fields which are integers and strings. The problem happens when a string happeneds to be "0". Maple interprets this when reading as the integer zero and not as the string zero! So that when I print this field later on using printf("%s",field) I get an error. (since I know this field is string, the format for output is fixed in the code). 

I made a very small example to illustrate. One line with 4 fields. The 4ht field is string.

This specific field is always a string with alphanumeric content in the file. It has " " around it. But sometimes the content of the string happens to be the string "0".  Maple gets confused and reads "0" as integer 0.

Is there a way to tell Maple not to read this string as an integer using ImportMatrix?

Here is MWE to show the problem


restart;
currentdirName :="C:\\bug";
currentdir(currentdirName);
file_to_read := cat(currentdirName,"\\maple_input.txt");
data:=ImportMatrix(file_to_read, source=csv):

print(data);
whattype(data[1,1]);
whattype(data[1,4]);

printf("%d,%d,%d,%s",data[1,1],data[1,2],data[1,3],data[1,4]):

 

The input file maple_input.txt has this one line in it:

1,2,3,"0"

As you can see, the 4ht field is a string.  But Maple reads it as integer:

 

This is using Maple 2017.1 on windows. Also Attached the text file.

1,2,3,"0"

Download maple_input.txt

 

With Maple, you can create amazing visualizations that go far beyond the standard mathematical plots that you might typically expect (I wince every time I see yet another sine curve).

At your fingertips, you have

  • plotting primitives that can be assembled in new and novel ways
  • precise control over coloring (yay for ColorTools) and placement
  • an interactive coding environment with inline plots, giving you quick visual feedback over aesthetic changes
  • and a comprehensive mathematical programming language to glue everything together

Here, I thought I'd share a few of the visualizations I've really enjoyed creating over the last few years (and I'd like to emphasize 'enjoy' - doing this stuff is fun!)

Let me know if you want any of the worksheets.

 

Psychrometric chart with historical weather data for Waterloo, Ontario.

 

Ternary plot of the color of gold-silver-copper alloys

 

Spectrogram of a violin note played with vibrato

 

Colored zoom of the Mandelbrot set

 

Reporting dashboard for an Organic Rankine Cycle

 

Temperature-entropy plot of an ideal Rankine Cycle

 

Quaternion fractal

 

Historical sunpot data

 

Earthquake data

 

African literacy rates

Do you have Maple content that you want to protect from editing and viewing, while still allowing others to execute the code within and obtain results? In Maple, worksheets can be password protected so the users of your Maple application can benefit from the specialized routines you've created while the details remain hidden.


The password protection feature can be useful for a variety of situations, such as:

  • • Providing a Maple-based solution while protecting the intellectual property embodied in your algorithms
  • • Ensuring the users of your application can not accidentally make changes that break your code

 

To learn more about this feature in Maple, you can download the free Tips & Techniques from the Application Center.

Dear Community,

Entering a long line in 1D mode breaks at the right window bounday. How could I prevent this? I would like the entered line stay just as one, single, long line extending over the window boundary and I would like to use the bottom window scroll bar to view it. BTW it also does not appear, so how could I invoke it? I use Maple2016. I have neither found any information about this in the help, nor in the documentation.

Also is there a possibility to split the IDE screen vertically, as e.g. in Visual Studio? Looking at long programs this feature is very useful.

tx in advance,

best regards

Andras

Moments ago, when I consulted the help pages, there popped up an Update window followed by a download of some 100MB+, and then nothing more seemed to happen. What was that about?, I wonder. Was it automatic updating of the help pages, or what?

Is there a command to find out what is new in 2017.1 that just got installed on my PC?

kernelopts(version);
  Maple 2017.1, X86 64 WINDOWS, Jun 19 2017, Build ID 1238644

I searched and googled and could not find such a command.

It used to be that when I clicked on the little icon in the help window which tells Maple to display all examples in 1D, then I did not see any 2D or any document style (i.e. italic) notation in the examples.

Now in Maple 2017 I see many examples in help show up in 2D/italic. It is worst, on same page, some code displays in Maple language and some code displays in 2D notation.

I do not like 2D. I want to only see examples written in the plain good old fashioned Maple language (which Maplesoft seems to be trying very hard to kill as it seems to be trying to force document style/2D on users by any means).

Here is an example. ?diff shows this

The above has 2D as input and above it has Maple code as input. One can't even copy the input to the open worksheet. If I copy it, this what happens:

value(??);

Here is another example, from page titled

 

Scrolling down I see this

I want all the input code above in examples and documentation to be in plain 1D Maple language notation. Not italic and not 2D and not anything fancy.  I do not like to even look at italic code above.

But clicking on the icon has no effect.

Is there a way to force everything to show using Maple notation for input? 

Maple help and documenation is a big mess if you ask me.

 

 

We have just released an update to Maple, Maple 2017.1.  It includes improvements to the display on high resolution monitors for the debugger, MapleCloud, and help system table of contents. It also contains a variety of small improvements to the math engine, including in limit, series, Physics, typesetting, and PackageTools. This update is available through Tools>Check for Updates in Maple, and is also available from our website on the Maple 2017.1 download page.

eithne

In some cases, maple is able to return a series expansion when line A is called but fails to do so when line B is called, and in the help page for asympt it defines them to be identical procedures:

A: asympt(f,z)

B:

this has generally occured when ever the function f is of the form:

where g(z) has an asymptotic expansion and when asympt(f,z) is called, maple provides this expansion divided by the exponential function, however line B as prescribed above returns an error. 

 

So, my question is, which line in showstat(asympt) is responsible for catching the error which line B as above encounters?

I am computing some finite points in the plane. Then I'm using point style plot to plot them. My points have order and I want to conncet the i-th point to the (i+1)-th point with a line segment. I searched the help but I didn't figure out how to do it. Is it possible to do this in Maple?

If I just want to define an itegral and do not want maple to simplify it to a closed form, what should I do?

For example, I want define

s := int(exp(-x^2)*cos(2*x*y), x = 0 .. infinity).

Maple automatically simplify s to

(1/2)*sqrt(Pi)/exp(y^2)

But I want to keep s in integral form.

This Saturday is Canada’s 150th birthday. As you can imagine, the country has been paying a lot more attention to this year’s anniversary than our usual low key approach, and as a Canadian company, we at Maplesoft decided to join in the fun.

And what better way for Maplesoft to celebrate Canada’s birthday than to create a maple leaf in Maple! 

So here is a maple leaf inspired by the Canada 150 logo, which was created by Ariana Cuvin, a student at the University of Waterloo and former co-op here at Maplesoft:

Here’s the code to reproduce this plot (more details can be found in this follow up post):

p:=thickness=5,color="#DC2828":
plots:-display(

    plot([[-.216,-.216],[0,0],[-.216,.216],[-.81,0],[-.216,-.216]],p),  
    plot([[-.55,.095],[-.733,.236],[-.49,.245]],p),
    plot([[-.376,0],[0,0],[0,.376],[-.705,.705],[-.376,0]],p),
    plot([[-.342,.536],[-.355,.859],[-.138,.622]],p),
    plot([[-.267,.267],[0,0],[.267,.267],[0,1],[-.267,.267]],p),
    plot([[.342,.536],[.355,.859],[.138,.622]],p),
    plot([[0.,.376],[0,0],[.376,0],[.705,.705],[0.,.376]],p),
    plot([[.55,.095],[.733,.236],[.49,.245]],p),
    plot([[.216,.216],[0,0],[.216,-.216],[.81,0],[.216,.216]],p),
    plot([[0,-.5],[0,0]],p),

scaling=constrained,view=[-1..1,-.75..1.25],axes=box);

 

Know other ways to plot a maple leaf in Maple?  If so, please share them below - we’d love to see them!

First 938 939 940 941 942 943 944 Last Page 940 of 2215