MaplePrimes Commons General Technical Discussions

The primary forum for technical discussions.

Try More/GeneratePDF  in  the menu under  a post/question. See screen_26.09.17.docx as an example of a result. Also Adobe Acrobat Reader fails with it. That was submitted to MaplePrimes staff through the Contact  button at the bottom of this page. I obtained no feedback from them.

This might be of interest to some of us here - a comparison of differential equation solvers between many different packages/tools/libraries:

http://www.stochasticlifestyle.com/comparison-differential-equation-solver-suites-matlab-r-julia-python-c-fortran/

The "analysis" of maple's capabilities are presented as somewhat limited in comparison to mathematica's - I wonder if this is a simple bias/misinformation of the author, or if his conclusions are correct. 

My interface has frozen, but above is a screen shot of what is by far the most unusual response from the CAS in the i guess 8 or so years ive been using it in total.

 

*updated situation its allowing me to interrupt evaluation

Download New_ReportGeneration_with_ExcelData.mw

Dear Users,

I have received a congratulations from a Mapleprime user for my post (on Finite Element Analysis - Basics) posted two years earlier. I  did not touch that subject for two years for obvious reasons. Now that a motivation has come, I have decided to post my second application using embedded components. This I was working for the past two years and with the support from Maplesoft technical support team and Dr.RobertLopez. I thank them here for this workbook has come out well to my satisfaction and has given me confidence to post it public.

About the workbook

I have tried to improve the performance of a 2-Stroke gasoline engine to match that of a four stroke engine by using exhaust gas recirculation. Orifice concept is new and by changing the orifice diameter and varying the % of EGR, performance was monitored and data stored in Excel workbook. These data can be imported to Maple workbook by you as you want for each performance characteristic. The data are only my experimental and not authentic for any commercial use.

This Maple workbook generates curves from data for various experiments conducted by modifying the field variables namely Orifice diameter, % Exhaust gas Recirculation and Heat Exchanger Cooling. Hence optimum design selection is possible for best performance.

Thanks for commenting, congratulating or critisising!! All for my learning and improving my Maple understanding!! 

A new code based on higher derivative method has been implemented in Maple. A sample code is given below and explained. Because of the symbolic nature of Maple, this method works very well for a wide range of BVP problems.

The code solves BVPs written in the first order form dy/dx = f (Maple’s dsolve numeric converts general BVPs to this form and solves).

The code can handle unknown parameters in the model if sufficient boundary conditions are provided.

This code has been tested from Maple 8 to Maple 2017. For Digits:=15 or less, this code works in all of the Maple versions tested.

Most problems can be solved with Digits:=15 with atol = 1e-10 or so. This code can be used to get a tolerance value of 1e-20 or any high precision as needed by changing the number of Digits accordingly. This may be needed if the original variables are not properly sacled. With arbitrarily high Digits, the code fails in Maple 18 or later version, etc because Maple does not support SparseDirect Solver at high precision in some of the versions (hopefuly this bug can be removed in the future versions).

For simple problems, Maple’s dsolve/numeric is superior to the code developed as it is implemented in hardware floats. For large scale problems and stiff problems, the method developed is much more superior to Maple and comparable to (and often times better than) state of the art codes for BVPs - bvp4c (MATLAB), COLSYS,TWPBVP, etc.

The code, as written, cannot be used for problems with a singularity at end points (doable in the future). In addition, mixed boundary conditions are not supported in this version of the code (for example, y1(1)=y2(0)). Future updates will include the application of this approach for DAE-BVPs, currently not supported by Maple’s dsolve/numeric command.

A paper has been submitted to JCAM. I welcome feedback on the code and solicit input from Mapleprimes members if they are able to test (and break this code) for any BVP.

 

PDF of the paper submitted, example maple code and the solver as a text file needed are uploaded here. Additional examples are hosted on my website at http://depts.washington.edu/maple/HDM.html


 

 

##################################################################################

Troesch's problem
This is an inherently unstable, difficult, nonlinear, two-point BVP formulated by Weibel and Troesch that describes the confinement of a place column by radiation pressure. Increasing epsilon increases the stiffness of the ODE.
1. E.S. Weibel, On the confinement of a plasma by magnetostatic fields, Phys. Fluids. 2 (1959) 52-56.
2. B. Troesch, A simple approach to a sensitive two-point boundary value problem, J. Comput. Phys. 21 (1976) 279-290.

Introduction
The package HDM solves boundary value problems (BVPs) using higher derivative methods (HDM) in Maple®. We explain how to solve BVPs using this package. HDM can numerically solve BVPs of ordinary differential equations (ODEs) of the form shown is the fowllowing example.

###################################################################################

 

 

Reset the program to clear the memory from previous execution command.

restart:

 

Read the txt file which contains the HDM solver for BVPs.

read("HDM.txt");

 

Declare the precision for the entire Maple® sheet.

Digits:=15;

Digits := 15

(1)

 

Enter the first-order ODEs into EqODEs list.

EqODEs:=[diff(y1(x),x)=y2(x),diff(y2(x),x)=epsilon*sinh(epsilon*y1(x))];

EqODEs := [diff(y1(x), x) = y2(x), diff(y2(x), x) = epsilon*sinh(epsilon*y1(x))]

(2)

 

Define the left boundary condition (bc1), and the right boundary condition (bc2). One should collect all the terms in one side.

bc1:=evalf([y1(x)]);

bc1 := [y1(x)]

(3)

bc2:=evalf([y1(x)-1]);

bc2 := [y1(x)-1.]

(4)

 

Define the range (bc1 to bc2) of this BVP.

Range:=[0.,1.];

Range := [0., 1.]

(5)

 

List any known parameters in the list.

pars:=[epsilon=2];

pars := [epsilon = 2]

(6)

 

List any unknown parameters in the list. When there is no unknown parameter, use [ ].

unknownpars:=[];

unknownpars := []

(7)

 

Define the initial derivative in nder (default is 5 for 10th order) and the number of the nodes in nele (default is 10 and distributed evenly across the range provided by the user). The code adapts to increase the order. For many problems, 10th order method with 10 elements are sufficient.

nder:=5;nele:=10;

nder := 5

nele := 10

(8)

 

Define the absolute and relative tolerance for the local error. The error calculation is done based on the norm of both the 9th and 10th order simulation results.

atol:=1e-6;rtol:=atol/100;

atol := 0.1e-5

rtol := 0.100000000000000e-7

(9)

 

Call HDMadapt procedure, input all the information entered above and save the solution in sol. HDMadapt procedure does not need the initial guess for the mesh.

sol:= HDMadapt(EqODEs,bc1,bc2,pars,unknownpars,nder,nele,Range,atol,rtol):

 

Present some details of the solution.

sol[4]; # final derivative

5

(10)

sol[5]; # Maximum local RMSE

0.604570329905172e-8

(11)

 

Store the dimension of the solution (after adjusting the mesh) to NN.

NN:=nops(sol[3])+1;

NN := 11

(12)

 

Plot the interested variable (the ath ODE variable will be sol[1][i+NN*(a-1)] )

node:=nops(EqODEs);
odevars:=select(type,map(op,map(lhs,EqODEs)),'function');

node := 2

odevars := [y1(x), y2(x)]

(13)

xx:=Vector(NN):

xx[1]:=Range[1]:

for i from 1 to nops(sol[3]) do xx[i+1]:=xx[i]+sol[3][i]: od:

for j from 1 to node do
  plot([seq([xx[i],rhs(sol[1][i+NN*(j-1)])],i=1..NN)],axes=boxed,labels=[x,odevars[j]],style=point);
end do;

 

 


 

Download Example_3_Troesch.mws

 

Was just pondering this idea and posted this in the post topic for discussion. 

Each Maple finished version of Maple may still have certain bugs that will not be updated for that version, so I am suggesting (I think anyone could implement it) that if there is a workaround, one could wrap it up in something I would call a patch package updateable by us users we could update here on mapleprimes.  It would be good for people who haven't upgraded or can't upgrade due to costs etc...

For example, there was recent issue with pdsolve that was fixed quite quickly in the seperate updateable Physics package.  Things could be done similarily that might work with other workarounds using this patch package idea. 

If anyone thinks this is good or even viable idea then lets implement it.  I envisioned it with just this one rule to follow - the name of the patch package would reflect the version we are patching (ie. with(patch12) or with(patch2016) for Maple 12 and Maple 2016 respectively etc...)  We could make these patch packages available in this post or start another.

As I said, I'm just throwing the idea out there.  Thoughts?

There seems to be a bug with improper integration:

integrate(cos(t)*exp(-x*t),t=-infinity..infinity)

gives

0

Substituting any number for x, or assuming x >= 0  (or x<=0) does give the correct result,

The problem also persists when assuming x>-1 (or x>-Maple_floats(MIN_FLOAT))

 

Books free. Like!!!

Lenin Araujo Castillo

Yahoo Finance recently discontinued their (largely undocumented) historical stock quote API.

Previously, you simply send a HTTP:-Get request like this…

HTTP:-Get(“http://ichart.yahoo.com/table.csv?s=AAPL&a=00&b=1&c=2016&d=00&e=1&f=2017&g=d&ignore=.csv")

…and get historical OHLCV (open, high, low, close, trading volume) data in your worksheet (in this case for AAPL between 1 January 2016 and 1 January 2017).

This no longer works! Yahoo shut the door on this easy-to-use and widely disseminated API.

You can still download historical stock quotes from Yahoo Finance into Maple, but the process is now somewhat more involved. My complete code in this worksheet but I'll step through the process below.

If you visit the updated Yahoo Finance website and download historical data for a ticker, you see a URL like this in the status bar of your browser

https://query1.finance.yahoo.com/v7/finance/download/AAPL?period1=1497727945&period2=1500319945&interval=1d&events=history&crumb=C9luNcNjVkK

Let's examine how ths URL is constructed.

  • period1 and period2 are Unix time stamps for your start and end date
  • interval is the data retrieval interval (this can be either 1d, 1w or 1m)
  • crumb is an alphanumeric code that’s periodically regenerated every time you download new historical data from from the Yahoo Finance website using your browser. Moreover, crumb is paired with a cookie that’s stored by your browser.

Here’s how to extract and supply the cookie-crumb pair to Yahoo Finance so you can still use Maple to retrieve historical stock quotes

Send a dummy request to get a cookie-crumb pair

res:=HTTP:-Get("https://finance.yahoo.com/lookup?s=bananas"):

Grab the crumb from the response

i:=StringTools:-Search("CrumbStore\":{\"crumb\":\"",res[2]):
crumbValue := res[2][i+22..i+32]
                  crumbValue := "btW01FWTBn3"

Store the cookie from the response

cookieHeader:=res[3]["Set-Cookie"]
    cookieHeader := "B=702eqhdcmq7cl&b=3&s=0t; expires=Mon,17-Jul-2018 20:27:01 GMT; path=/; domain=.yahoo.com

Construct the URL

  • Your desired start and end dates have to be defined as Unix time stamps. Converting a human readable date (like 1st January 2017) to a Unix timestamp is simple, so I won't cover it here.
  • The previously retrieved crumb has to be added to the URL.
ticker:="AAPL":
p1 := 1497709183:
p2 := 1500301183:
url:=cat("https://query1.finance.yahoo.com/v7/finance/download/",ticker,"?period1=",p1,"&period2=",p2,"&interval=1d&events=history&crumb=", crumbValue):

Send the request to Yahoo Finance, including the cookie in the header

data:=HTTP:-Get(url,headers = ["Cookie" = cookieHeader])

Your historical data is now returned

The historical data is now easily parsed into a matrix.

Please note that any use of Yahoo Finance has to be consistent with their terms of service.

Maple 2017 has launched!

Maple 2017 is the result of hard work by an enthusiastic team of developers and mathematicians.

As ever, we’re guided by you, our users. Many of the new features are of a result of your feedback, while others are passion projects that we feel you will find value in.

Here’s a few of my favourite enhancements. There’s far more that’s new - see What’s New in Maple 2017 to learn more.

 

MapleCloud Package Manager

Since it was first introduced in Maple 14, the MapleCloud has made thousands of Maple documents and interactive applications available through a web interface.

Maple 2017 completely refreshes the MapleCloud experience. Allied with a new, crisp, interface, you can now download and install user-created packages.

Simply open the MapleCloud interface from within Maple, and a mouse click later, you see a list of user-created packages, continuously updated via the Internet. Two clicks later, you’ve downloaded and installed a package.

This completely bypasses the traditional process of searching for and downloading a package, copying to the right folder, and then modifying libname in Maple. That was a laborious process, and, unless I was motivated, stopped me from installing packages.

The MapleCloud hosts a growing number of packages.

Many regular visitors to MaplePrimes are already familiar with Sergey Moiseev’s DirectSearch package for optimization, equation solving and curve fitting.

My fellow product manager, @DSkoog has written a package for grouping data into similar clusters (called ClusterAnalysis on the Package Manager)

Here’s a sample from a package I hacked together for downloading maps images using the Google Maps API (it’s called Google Maps and Geocoding on the Package Manager).

You’ll also find user-developed packages for exploring AES-based encryption, orthogonal series expansions, building Maple shell scripts and more.

Simply by making the process of finding and installing packages trivially easy, we’ve opened up a new world of functionality to users.

Maple 2017 also offers a simple method for package authors to upload workbook-based packages to the MapleCloud.

We’re engaging with many package authors to add to the growing list of packages on the MapleCloud. We’d be interested in seeing your packages, too!

 

Advanced Math

We’re committed to continually improving the core symbolic math routines. Here area few examples of what to expect in Maple 2017.

Resulting from enhancements to the Risch algorithm, Maple 2017 now computes symbolic integrals that were previously intractable

Groeber:-Basis uses a new implementation of the FGLM algorithm. The example below runs about 200 times faster in Maple 2017.

gcdex now uses a sparse primitive polynomial remainder sequence together.  For sparse structured problems the new routine is orders of magnitude faster. The example below was previously intractable.

The asympt and limit commands can now handle asymptotic cases of the incomplete Γ function where both arguments tend to infinity and their quotient remains finite.

Among several improvements in mathematical functions, you can now calculate and manipulate the four multi-parameter Appell functions.

 

Appel functions are of increasing importance in quantum mechanics, molecular physics, and general relativity.

pdsolve has seen many enhancements. For example, you can tell Maple that a dependent variable is bounded. This has the potential of simplifying the form of a solution.

 

Plot Builder

Plotting is probably the most common application of Maple, and for many years, you’ve been able to create these plots without using commands, if you want to.  Now, the re-designed interactive Plot Builder makes this process easier and better.

When invoked by a context menu or command on an expression or function, a panel slides out from the right-hand side of the interface.

 

Generating and customizing plots takes a single mouse click. You alter plot types, change formatting options on the fly and more.

To help you better learn Maple syntax, you can also display the actual plot command.

Password Protected Content

You can distribute password-protected executable content. This feature uses the workbook file format introduced with Maple 2016.

You can lock down any worksheet in a Workbook. But from any other worksheet, you can send (author-specified) parameters into the locked worksheet, and extract (author-specified) results.

 

Plot Annotations

You can now get information to pop up when you hover over a point or a curve on a plot.

In this application, you see the location and magnitude of an earthquake when you hover over a point

Here’s a ternary diagram of the color of gold-silver-copper alloys. If you let your mouse hover over the points, you see the composition of the points

Plot annotations may seem like a small feature, but they add an extra layer of depth to your visualizations. I’ve started using them all the time!

 

Engineering Portal

In my experience, if you ask an engineer how they prefer to learn, the vast majority of them will say “show me an example”. The significantly updated Maple Portal for Engineers does just that, incorporating many more examples and sample applications.  In fact, it has a whole new Application Gallery containing dozens of applications that solve concrete problems from different branches of engineering while illustrating important Maple techniques.

Designed as a starting point for engineers using Maple, the Portal also includes information on math and programming, interface features for managing your projects, data analysis and visualization tools, working with physical and scientific data, and a variety of specialized topics.

 

Geographic Data

You can now generate and customize world maps. This for example, is a choropleth of European fertility rates (lighter colors indicate lower fertility rates)

You can plot great circles that show the shortest path between two locations, show varying levels of detail on the map, and even experiment with map projections.

A new geographic database contains over one million locations, cross-referenced with their longitude, latitude, political designation and population.

The database is tightly linked to the mapping tools. Here, we ask Maple to plot the location of country capitals with a population of greater than 8 million and a longitude lower than 30.

 

There’s much more to Maple 2017. It’s a deep, rich release that has something for everyone.

Visit What’s New in Maple 2017 to learn more.

In the recent years much software has undergone a change towards allowing for better sharing of documents. As is the case with other software as well, the users are no longer mainly single persons sitting in a dark corner doing their own stuff. Luckily Maplesoft has taken an important step in that direction too by introducing MapleCloud some years ago. This means that it is now possible quite easily to discuss calculations done in Maple in the classroom. One student uploads and the Teacher can find the document seconds later on his own computer connected to a Projector and show the student's solutions for the other  students in the classroom. That's indeed great! Maple is however lacking in one important aspect: It's Graphics User Interface (GUI) is not completely ready to for that challenge! I noticed that quite recently when the entire teaching staff received new netbooks: 14 inch Lenovo Yoga X1 with a resolution of 2560 x 1440 pixels. From factory defaults text zoom was set to 200%. Without it, text would be too small in all applications used on the computer. The Microsoft Office package and most other software has adapted to this new situation dealing with high variation in the users screen resolutions, but not Maplesoft:

  1. Plots and Images inserted become very small
  2. Open File dialogs and the like contain shortened text for folder names ... (you actually have to guess what the folders are)
  3. Help menus are cluttered up and difficult to read.

I show screen images of all three types below.

I know it is possible to make plots larger by using the option size, but since it relies on pixels it doesn't work when documents are shared between students and teachers. You cannot expect the receiving student/teacher to make a lot of changes in the document just to be able to read it. It will completely destroy the workflow!

Why doesn't Maplesoft allow for letting documents display proportionally on the users computer like so many other programs do? Why do it need to be in pixels? If it is possible to make it proportional, it would also solve another issue: Making prints (to a printer or to pdf) look more like they do on the screen than is the case at present.

I really hope Maplesoft will address this GUI challenge, because I am sure the issue will pile up quite rapidly. Due to higher costs, most laptops/netbooks among students don't have that high resolution compared to computer dimensions at the moment, but we already have received a few remarks from students owning such computers. Very soon those highend solution computers will dive into the consumer market and become very common.

I have mentioned this important GUI issue in the beta-testing group, but I don't think those groups really are adapted to discussions, more bug fixes. Therefore I have made this Post in the hope that some Maple users and some chief developers will comment on it!
     

Now I have criticized the Maple GUI, I also feel urged to tell in what departments I think Maple really excels:

  1. The Document-structure is great. One can produce good looking documents containing 'written math' (inactive math) and/or 'calculated math'. All-in-one! Other competting software does need one to handle things separatly.
  2. Sections and subsections. We have actually started using Maple to create documents containing entire chapters or surveys of mathematics or physics subjects, helping students to get a better overview. I am pretty sure the Workbook tool also will help here.
  3. Calculations are all connected. One can recalculate the document or parts of it, eventually using new parameters. Using Maple for performing matematical experiments. Mathematical experiments is a method entering more into the different mathematics curriculums.
  4. MapleCloud. Easy sharing of documents among students and teachers.
  5. Interactive possibilities through the Explore command and other commands. Math Apps as well.
  6. Besides that mathematical symbols can be accessed from the keyboard, they can also be accessed from palettes by less experinced users.  
  7. Good choice by Maple to let the user globally decide the size text and math is displayed in Maple - set globally in the menu Tools < Options.
  8. Maple can handle units in Physics
  9. Maple has World-Class capabilities. If you have a mathematical problem, Maple can probably handle it. You just need to figure out how.
  10. etc.

 

Small plots:

 

Shortened dialog text:

 

Cluttered help menus:

 

Regards,

Erik

 

The is and coulditbe commands of Maple are known to be buggy.
Here are some math inventions done by these commands in Maple 2016.2.

restart; assume(x::real, y::real);
is(exp(x+I*y) <> 0);
                             false
coulditbe(exp(x+I*y) = 0);
                              true
coulditbe(exp(x+I*y) = infinity);
                              true
coulditbe((x+I*y)^2 = infinity);
                              true

It should be noticed that

is((-infinity)::real);
                             false

though

exp(-infinity+0*I);
                               0

The latter means

limit(exp(x),x=-infinity);
                                   0

, no more and no less.

The Joint Mathematics Meetings are taking place this week (January 4 – 7) in Atlanta, Georgia, U.S.A. This will be the 100th annual winter meeting of the Mathematical Association of America (MAA) and the 123nd annual meeting of the American Mathematical Society (AMS).

Maplesoft will be exhibiting at booth #118 as well as in the networking area. Please stop by our booth or the networking area to chat with me and other members of the Maplesoft team, as well as to pick up some free Maplesoft swag or win some prizes.

There are also several interesting Maple-related talks and events happening this week:

 

Teaching Cryptology to Increase Interest in Mathematics for Students Majoring in Non-Technical Disciplines and High School Students

Wednesday, January 4, 0820, L401 & L402, Lobby Level, Marriott Marquis

Neil Sigmon, Radford University

 

Enigma: A Combinatorial Analysis and Maple Simulator

Wednesday, January 4, 0900, L401 & L402, Lobby Level, Marriott Marquis

Rick Klima, Appalachian State University

 

MYMathApps Calculus - Building on Maplets for Calculus

Thursday, January 5, 0800, Courtland, Conference Level, Hyatt Regency

Philip B. Yasskin, Texas A&M University 
Douglas B. Meade, University of South Carolina 
Andrew Crenwelge, Texas A&M University

 

Maple Software Technology as a Stimulant Tool for Dynamic Interactive Calculus Teaching and Learning

Thursday, January 5, 1000, Courtland, Conference Level, Hyatt Regency

Lina Wu, Borough of Manhattan Community College-The City University of New York 

 

Collaborative Research: Maplets for Calculus

Thursday, January 5, 1400, Marquis Ballroom, Marquis Level, Marriott Marquis

Philip Yasskin, Texas A&M University 
Douglas Meade, U of South Carolina

 

Digital Graphic Calculus Art Design in Maple Software

Thursday, January 5, 1420, International 7, International Level, Marriott Marquis

Lina Wu, Borough of Manhattan Community College-The City University of New York 

 

Maplesoft will also be hosting a catered reception and brief presentation on Teaching STEM Online: Challenges and Solutions, Thursday January 5th, from 6:00pm – 7:30pm, at the Hyatt Regency, Hanover AB, on the exhibitor level. Please RSVP at www.maplesoft.com/jmm or at Maplesoft booth #118.

 

If you are attending the Joint Math meetings this week and plan on presenting anything on Maple, please feel free to let me know and I'll update this list accordingly.


See you in Atlanta!

Daniel

Maple Product Manager

Is this a bug?

hypergeom([1, -1, 1/2], [-12,-3], 1);
Error, (in hypergeom/check_parameters) function doesn't exist: missing appropriate negative integers in the first list of parameters to compensate the negatives integer(s): [-3], found in the second list.
 

Yet this hypergeometric series terminates and Maple should be able to handle it, at least according to the Maple help page (the second rule below applies, yet the numerator has a smaller absolute value, so the first rule below applies).

If some   n[i] is a non-positive integer, the series is finite (that is,   F(n, d, z)  is a polynomial in    z).
If some  d[j]  is a non-positive integer, the function is undefined for all non-zero  z, unless there is also a negative upper parameter of smaller absolute value, in which case the previous rule applies.
 

 

Interestingly, the Wolfram Mathematica app can evaluate this to 311/312.

 

 

The DFT windowing functions in the SignalProcessing package seem to be inconsistent in the type of data they will accept, and the type they return.

BartlettHannWindow,  BlackmanHarrisWindow, BlackmanNuttallWindow,   BohmanWindow, CauchyWindow, CosineWindow, ExponentialWindow, FlatTopWindow,  GaussianWindow, HannPoissonWindow, ParzenWindow, PoissonWindow,  RectangleWindow, ReiszWindow, RiemannWindow, TaperedCosineWindow, TriangleWindow, TukeyWindow

accept Arrays, containing almost any data type (haven't tried them all!) as input. and always return a Vector[row].

But

BartlettWindow, BlackmanWindow, HammingWindow, HannWindow, KaiserWindow

require that the option datatype=float[8] be set in the Array() constructor, which is used as input and always return an hfarray.

Thus, for example

with(SignalProcessing);
sig:= Array( -50..50,
                        fill=1
                    ):
BartlettHannWindow(sig); # this works
BartlettWindow(sig);# this fails with datatype unsupported error

Very confusing!!!!

4 5 6 7 8 9 10 Last Page 6 of 78