Applications, Examples and Libraries

Share your work here

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.

This worksheet is designed to develop engineering exercises with Maple applications. You should know the theory before using these applications. It is designed to solve problems faster. I hope you use something that is fully developed with embedded components.

In Spanish

Vector_Force.mw

Lenin Araujo Castillo

Ambassador Of Maple

 

 

Let us consider 

sol := pdsolve({diff(u(x, t), t)-(diff(v(x, t), x))+u(x, t)+v(x, t) = (1+t)*x+(x-1)*t^2, diff(v(x, t), t)-(diff(u(x, t), x))+u(x, t)+v(x, t) = (1+t)*x*t+(2*x-1)*t}, {u(0, t) = 0, u(x, 0) = 0, v(0, t) = 0, v(x, 0) = 0}, time = t, numeric, timestep = 0.1e-1, spacestep = 0.1e-1, range = 0 .. 1); 
sol:-plot3d(v(x, t), x = 0 .. 1, t = 0 .. 1);

A nice plot similar to the one produced by Mma (see the  attached pdf file pdesystem.pdf) is expected. 
The exact solutions u(x,t)=x*t,v(x,t)=x*t^2 are known

pdetest({u(x, t) = x*t, v(x, t) = x*t^2}, {diff(u(x, t), t)-(diff(v(x, t), x))+u(x, t)+v(x, t) =
(1+t)*x+(x-1)*t^2, diff(v(x, t), t)-(diff(u(x, t), x))+u(x, t)+v(x, t) = (1+t)*x*t+(2*x-1)*t});
                              {0}

But the wrong result

               module() ... end module         
Error, (in pdsolve/numeric/plot3d) unable to compute solution for t>HFloat(0.26000000000000006):
solution becomes undefined, problem may be ill posed or method may be ill suited to solution

is obtained. Also 

sol:-plot3d(v(x, t), x = 0 .. 1, t = 0 ..0.1);


 

The plot 

sol:-plot3d(v(x, t), x = 0 .. .5, t = 0 .. .1);

is not better.

Here is a problem from SEEMOUS 2017 (South Eastern European Mathematical Olympiad for University Students)
which Maple can solve (with a little help).

For k a fixed nonnegative integer, compute:

Sum( binomial(i,k) * ( exp(1) - Sum(1/j!, j=0..i) ), i=k..infinity );

(It is the last one, theoretically the most difficult.)

Application that allows us to measure the reliability of a group of data through a row and columns called cronbach alpha at the same time to measure the correlation of items through the pearson correlation of even and odd items. It can run on maple 18 to maple 2017. This will be useful when we are developing a thesis in the statistical part.

In Spanish

StatisticsSocialCronbachPearson.zip

Lenin Araujo Castillo

Ambassador of Maple

 

 

Here's a little procedure to fish out data from the Simbad database.  Some star names may not work if the page Simbad brings up is not completely filled, but it should work for most queries.


 

restart; gc()

Simbad := proc (a::string) local b, c, c1, c2, c3, c4, c5, d1, d2, d3, d4, d5, e1, e2, e3, e4, e5; b := StringTools:-DeleteSpace(StringTools:-Substitute(a, " ", "+")); c := HTTP:-Get(cat("http://simbad.u-strasbg.fr/simbad/sim-id?Ident=", b, "&submit=submit+id")); c1 := StringTools:-Search("Parallaxes", c[2]); c2 := StringTools:-Search("Radial", c[2]); c3 := StringTools:-Search("Spectral type:", c[2]); c4 := StringTools:-Search("Gal", c[2]); c5 := StringTools:-Search("ICRS", c[2]); d1 := c[2][c1+87 .. c1+93]; d2 := c[2][c2+96 .. c2+110]; d3 := c[2][c3+77 .. c3+90]; d4 := c[2][c4+122 .. c4+140]; d5 := c[2][c5+135 .. c5+164]; e1 := d1[() .. StringTools:-Search(" ", d1)]; e2 := d2[() .. StringTools:-SearchAll(" ", d2)[2]]; e3 := d3[() .. StringTools:-Search(" ", d3)]; e4 := convert(evalf(1000/parse(e1)), 'units', 'parsec', 'ly'); e5 := d5[() .. StringTools:-Search("\n", d5)-1]; print(cat(StringTools:-Capitalize(a), "\nDistance", e4, "lightyears", "\nRight Ascension and declination:", e5, "\nGalactic coordinates", d4, "Spectral Type:", e3, "\nRadial velocity:", e2, "\nParallax", e1, "milliarcseconds")) end proc:
 

Simbad("epsilon eridani")

"Epsilon Eridani
Distance" || (10.48936700) || "lightyears" || "
Right Ascension and declination:" || "03 32 55.84496 -09 27 29.7312" || "
Galactic coordinates" || "195.8446 -48.0513
 " || "Spectral Type:" || "K2Vk: " || "
Radial velocity:" || "V(km/s) 16.43 " || "
Parallax" || "310.94 " || "milliarcseconds"

(1)

Simbad("alpha centauri")

"Alpha Centauri
Distance" || (4.395638513) || "lightyears" || "
Right Ascension and declination:" || "14 39 36.204 -60 50 08.23" || "
Galactic coordinates" || "315.7330 -00.6809
 " || "Spectral Type:" || "G2V+K1V " || "
Radial velocity:" || "V(km/s) -22.3 " || "
Parallax" || "742 " || "milliarcseconds"

(2)

Simbad("beta hydri")

"Beta Hydri
Distance" || (24.32731987) || "lightyears" || "
Right Ascension and declination:" || "00 25 45.07036 -77 15 15.2860" || "
Galactic coordinates" || "304.7720 -39.7821
 " || "Spectral Type:" || "G0V " || "
Radial velocity:" || "V(km/s) 23.10 " || "
Parallax" || "134.07 " || "milliarcseconds"

(3)

Simbad("HR6998")

"Hr6998
Distance" || (42.67386858) || "lightyears" || "
Right Ascension and declination:" || "18 38 53.40045 -21 03 06.7368" || "
Galactic coordinates" || "012.7251 -06.7965
 " || "Spectral Type:" || "G6V " || "
Radial velocity:" || "V(km/s) 36.175 " || "
Parallax" || "76.43 " || "milliarcseconds"

(4)

``


 

Download star_database_-_simbad.mw

I found this http://www.atlasoftheuniverse.com/50lys.html and wondered how to do it in Maple. With a bit of data file editing I came up with this.  All stars within 50 light years that are visible to the naked eye.


 

restart; gc()

with(plots):

with(plottools):

a := readdata("c:/stars3.txt", [string, float, float, float]):

b := map(proc (a) options operator, arrow; [a[4], a[2], a[3]] end proc, a):

g := :-changecoords([x, y, z], [x, y, z], spherical, [r, theta, (1/2)*Pi-phi])

[r*sin((1/2)*Pi-phi)*cos(theta), r*sin((1/2)*Pi-phi)*sin(theta), r*cos((1/2)*Pi-phi)]

(1)

tt := [seq(evalf(subs({phi = convert(b[i][3]*degrees, radians), r = b[i][1], theta = convert(b[i][2]*degrees, radians)}, g)), i = 1 .. nops(b))]:

stars := pointplot3d(tt, color = red, symbol = solidcircle, symbolsize = 5)

PLOT3D(POINTS([3.141656625, -3.065814279, -0.5363263369e-1], [-5.772842366, -6.234102660, -1.330509322], [-6.747305264, -1.909294949, -7.815271235], [-9.249301903, -6.168517561, 2.566691531], [1.523622092, 11.26895208, -1.155073477], [7.242651534, -3.194389926, -8.791403287], [-3.375068769, .4084281956, -11.40403864], [-12.10139419, -4.596888455, -10.15024015], [14.09808071, 8.106755961, 3.279135277], [11.15052984, 12.25427229, -2.594493178], [-3.419769677, 17.11427532, 7.015900193], [15.04843187, -6.018943313, 10.40502857], [-10.42150660, 16.29565570, -1.726327245], [19.37009401, -.5748909284, 2.345071093], [16.86849035, 1.535152882, -10.13730432], [-3.624453569, -10.40801291, -16.40104276], [14.53624850, -8.460298659, -10.67366976], [-7.231982853, 19.97813208, -1.187881627], [9.620796689, 4.103617543, 19.18392802], [-15.19214319, 4.528974584, -17.36108506], [23.35174623, -3.365038049, .5765994043], [-6.811639233, 11.11558498, -20.54249842], [-13.85405602, 12.08566336, -15.98159795], [10.68989447, -15.38074244, -15.60587447], [-14.13228719, 19.88605992, -3.385259168], [10.27598870, 2.927192384, -22.50208215], [9.961208544, 3.724343264, -22.70260980], [9.143348930, 22.07399698, 8.320326164], [-23.59749508, -4.800964644, -10.27138571], [-5.411799069, 22.54176541, 12.37819224], [4.496828592, -12.62856178, -22.94041979], [-9.282551806, -2.504624702, 25.44407764], [-4.991684031, 4.803604874, 26.40640965], [15.07681588, 19.57764444, 11.83914952], [13.33734565, -14.86471460, 19.35333487], [10.71939792, -13.57311193, -22.05778867], [-27.91856076, -4.172456862, -1.331228297], [27.18654831, -8.676334271, -2.647341036], [-23.15604687, -10.84708496, -13.14156540], [24.14988887, 6.742770129, -14.12821003], [-18.24903039, -19.43324358, -12.03679499], [-19.47836941, -6.366512513, -21.22052411], [1.737082939, 1.648430159, 29.76381731], [-8.166167580, 1.661425568, 28.68397239], [-21.79918531, .6850669983, -20.40938762], [19.48447839, -12.08088844, -19.44250077], [9.550472834, -26.52745875, 10.65373179], [7.061767869, -26.72771859, 14.26858765], [-8.925013073, -.5615142310, 29.80743604], [27.25388910, 6.643782013, 15.16765603], [-20.51315816, 25.24143542, .9653395827], [-6.514439942, 18.29467278, 26.63134657], [7.897693130, -27.90985562, -15.94604661], [-30.24778274, -6.539802137, 13.39182687], [-17.39717901, -3.729632012, -28.80846417], [-27.77451873, 19.73832304, -4.425416699], [-16.72100652, 29.91871832, 7.975859507], [16.27294095, 21.36128840, 22.77346814], [-25.44324866, 19.59393922, -15.24864399], [.1513479143, -17.34275050, 31.03237984], [1.717990984, -16.62465483, -31.43293430], [-3.952184454, -11.22283603, 34.16753707], [13.79744768, 29.99780276, 14.83921382], [-13.23790880, 23.68644879, -24.00672435], [22.42836846, 11.77515669, 25.95817545], [-24.22192093, -3.619990337, 27.00973559], [-28.14737644, 22.63107168, -6.108739192], [12.64368664, 3.411528480, 34.29464625], [10.76859270, .9989721406, 35.37371292], [16.76571480, 7.324760688, 32.87131102], [-2.125303532, -30.39325725, -22.70975559], [26.50575552, 7.450431864, 26.68129662], [4.681906269, 34.62812576, -15.77746051], [21.22229159, 16.34336469, -27.73774271], [8.642995477, -16.39289961, 33.84907047], [4.194125964, -26.48066899, -28.95298045], [29.05143012, -24.81226531, -9.951698266], [-12.02418205, -37.67674179, 3.460082988], [-36.31468346, 14.37800028, 8.301913818], [31.32513775, -24.56204547, -5.240626617], [-11.18258143, 31.40433711, -22.91113229], [-30.95713334, -9.346509576, 24.99311013], [-23.18290754, -32.62151994, 9.092350346], [-26.39556889, 28.60460399, -13.63041355], [-40.27955197, 8.782362586, 1.079537348], [-11.43139039, -7.856576969, -38.95407568], [3.769221962, 22.28497845, 34.93658256], [-4.619258428, 34.61973164, 22.85528894], [-23.40542087, 11.26426836, 32.88997769], [39.51971345, -13.14645885, 5.261489147], [6.069471167, -26.08199826, 32.48539497], [-40.13923071, 12.57887241, 3.384394608], [41.02326573, 9.244992210, -5.014408062], [-29.06950326, -20.65862072, -24.78609025], [-27.49729080, 30.53883527, -15.52814989], [-29.74467917, 7.692497076, 31.48332336], [25.85459060, -9.924647480, -34.69169378], [-13.64550398, 34.99890783, -24.20893992], [30.42203099, 31.61316765, -8.607657127], [-33.27978250, -2.970141446, -29.76905838], [-1.180761099, 27.04387545, -35.92262524], [-21.03852595, 37.95450550, 11.87164852], [-19.67481024, -7.473759355, -40.42995379], [39.79319523, 3.271596183, 22.31470081], [-20.50141444, 1.505529746, 41.05062102], [-.6748395635, 38.66153119, 24.82404273], [-16.85106712, -16.67552070, -39.45541086], [40.49802876, 12.53623404, -18.78641538], [-32.93404980, 18.55738333, 27.16384339], [34.92406817, 25.28080920, 17.94659157], [-6.296985384, 45.37992800, 9.404414370], [22.24424377, 32.85461078, 25.08249928], [39.53312079, -25.57512282, 6.115214927], [-1.588926894, 23.92244252, 41.02855658], [-35.74198886, 5.341675996, 31.19429964], [36.98453431, 14.41966737, -26.57424156], [-46.68814535, -5.898084394, -8.552109953], [35.05110270, 5.991394707, 32.01789951], [36.60612781, 13.32354091, -27.78663643], [13.51762166, -35.96304965, 29.05652877], [-10.38961406, -43.95116043, 17.78996954], [-28.30533977, -7.584392920, 38.74662727], [9.914015961, -13.79681314, -45.68312418], [-9.191698604, 47.28718983, 7.802201960], [21.29072957, 42.51660453, 11.24023016], [-35.75149122, -29.78701952, -15.57013949], [5.493536467, -15.01179385, -46.42496206], [-3.928870403, 39.36220535, 29.27122934], [33.42605444, 36.35056112, -1.638197365], [-17.62503890, -46.15541461, -4.148747474], [44.66028688, -18.77345598, 11.18456642], [45.91393827, -16.62061368, -9.934504171]), SYMBOL(_SOLIDCIRCLE, 5), COLOUR(RGB, 1.00000000, 0., 0.))

(2)

lines := seq(`if`(tt[i][3] > 0, line(tt[i], [tt[i][1], tt[i][2], 0], color = blue), line(tt[i], [tt[i][1], tt[i][2], 0], color = blue, linestyle = dot)), i = 1 .. nops(b)):

c1 := circle([0, 0], 10, color = blue):

c2 := circle([0, 0], 20, color = blue):

c3 := circle([0, 0], 30, color = blue):

c4 := circle([0, 0], 40, color = blue):

c5 := circle([0, 0], 50, color = blue):

l1 := line([-50*cos((1/4)*Pi), -50*sin((1/4)*Pi)], [50*cos((1/4)*Pi), 50*sin((1/4)*Pi)], color = blue):

l2 := line([-50*cos(2*Pi*(1/4)), -50*sin(2*Pi*(1/4))], [50*cos(2*((1/4)*Pi)), 50*sin(2*((1/4)*Pi))], color = blue):

l3 := line([-50*cos(3*((1/4)*Pi)), -50*sin(3*((1/4)*Pi))], [50*cos(3*((1/4)*Pi)), 50*sin(3*((1/4)*Pi))], color = blue):

l4 := line([-50*cos(4*((1/4)*Pi)), -50*sin(4*((1/4)*Pi))], [50*cos(4*((1/4)*Pi)), 50*sin(4*((1/4)*Pi))], color = blue):

t1 := textplot([55, 0, "0"], color = blue):NULL

t2 := textplot([55*cos((1/2)*Pi), 55*sin((1/2)*Pi), "90"], color = blue):

t4 := textplot([55*cos(3*Pi*(1/2)), 55*sin(3*Pi*(1/2)), "270"], color = blue):

t3 := textplot([55*cos(Pi), 55*sin(Pi), "180"], color = blue):

a1 := arrow([60, 0], [80, 0], 1.5, 4, .4, color = blue):

a2 := textplot([95, 5, "Galactic Center"]):

d := display(c1, c2, c3, c4, c5, l1, l2, l3, l4, t1, t2, t3, t4, a1, a2, axes = none, scaling = constrained):

to3d := transform(proc (x, y) options operator, arrow; [x, y, 0] end proc):

display(to3d(d), stars, lines, orientation = [-46, 75])

 

``

``

NULL

NULL

The modified data file and the maple worksheet below

stars3.txt

Download Stars50LY.mw

Sudoku is a well known Latin square type game, see https://en.wikipedia.org/wiki/Sudoku

Here is a Sudoku game and its (unique) solution:

A,Sol:=  # A = Sudoku matrix, 0 for each empty cell
Matrix(9, [
[0,0,3,0,9,0,1,0,0],
[0,5,0,3,0,0,7,0,0],
[1,0,2,0,0,5,0,6,4],
[0,1,0,0,2,0,9,0,0],
[2,0,0,6,0,3,0,0,1],
[0,0,7,0,8,0,0,3,0],
[7,6,0,9,0,0,8,0,5],
[0,0,8,0,0,7,0,9,0],
[0,0,4,0,6,0,2,0,0]]),
Matrix(9, [
[4,7,3,2,9,6,1,5,8],
[8,5,6,3,4,1,7,2,9],
[1,9,2,8,7,5,3,6,4],
[3,1,5,7,2,4,9,8,6],
[2,8,9,6,5,3,4,7,1],
[6,4,7,1,8,9,5,3,2],
[7,6,1,9,3,2,8,4,5],
[5,2,8,4,1,7,6,9,3],
[9,3,4,5,6,8,2,1,7]]);


The procedure which follows is a very compact Sudoku solver. It uses Groebner bases. I hope that you will like it.
The input is the Sudoku matrix and the solution matrix is returned.
Note that the Sudoku matrix must be valid and must have a unique solution.
(Otherwise, theoretically, the error "Invalid Sudoku matrix" should appear.)
Note also that the procedure may be very slow for some games or Maple may crash. This happened to me once with a very "hard" matrix.

I was impressed that Maple's implementation for Groebner bases works now so well for this problem!

A few years ago on this site: http://www.mapleprimes.com/questions/131939-Calculating-Groebner-Basis-For-Sudoku
it was an attempt to solve the problem with this method but it failed (due to wrong number of polynomials).

sudoku:=proc(A::'Matrix'(9,integer))
local x_A,x,Q,R,r, i,j,u,v,G;
Q:=proc(X,Y) normal((mul(X-i,i=1..9)-mul(Y-i,i=1..9))/(X-Y)) end;
x_A:=seq(seq( `if`(A[i,j]>0,x[i,j]-A[i,j],NULL),i=1..9),j=1..9);
R:={seq({seq(x[i,j],j=1..9)},i=1..9), seq({seq(x[i,j],i=1..9)},j=1..9),
    seq(seq({seq(seq(x[3*u+i,3*v+j],i=1..3),j=1..3)},u=0..2),v=0..2)};
G:=Groebner:-Basis({seq(seq(seq(Q(u,v),u=r minus {v}),v=r),r=R),x_A},'_vv');
if nops(G)<>81 then error "Invalid Sudoku matrix" fi;
eval(Matrix(9,symbol=x), `union`(map(u->solve({u}), G)[]));
end:

sudoku(A) < A; # Solving the previous game

# Let's solve another one:
A:=Matrix(9,9,[[0,0,0,4,0,0,0,8,0],[0,5,2,7,0,0,4,0,0],[3,0,0,0,0,0,0,0,0],[5,1,0,8,0,0,0,0,0],[0,0,0,5,0,0,6,7,0],[0,9,0,0,7,0,0,0,3],[2,4,0,0,0,5,0,0,0],[9,0,0,0,0,0,0,3,8],[0,0,0,0,0,0,9,4,0]]):
sudoku(A) < A;

Matrix   # A Sudoku matrix which crashes Maple!
(9,[[8,0,0,0,0,0,0,0,0],[0,0,3,6,0,0,0,0,0],[0,7,0,0,9,0,2,0,0],[0,5,0,0,0,7,0,0,0],[0,0,0,0,4,5,7,0,0],[0,0,0,1,0,0,0,3,0],[0,0,1,0,0,0,0,6,8],[0,0,8,5,0,0,0,1,0],[0,9,0,0,0,0,4,0,0]]):

 

 

The distance from the point to the surface easily calculated using the NLPSolve of Optimization package. If the point is not special, we will find for it a point on the surface, the distance between these two points is the shortest between the selected point and the surface.
Two examples:  the implicit surface and the parametric surface.
To test, we restore the normals from the  calculated  points (red) by using analytical equations.
DISTANCE_TO_SURFACE.mw

In the creation of this animation the technique from here  was used.

 

                    

 

The code of this animation:

with(plots): with(plottools):
SmallHeart:=plot([1/20*sin(t)^3, 1/20*(13*cos(t)/16-5*cos(2*t)/16-2*cos(3*t)/16-cos(4*t)/16), t = 0 .. 2*Pi], color = "Red", thickness=3, filled):
F:=t->[sin(t)^3, 13*cos(t)/16-5*cos(2*t)/16-2*cos(3*t)/16-cos(4*t)/16]:
Gf:=display(translate(SmallHeart, 0,0.37)):
Gl:=display(translate(SmallHeart, 0,-1)):
G:=t->display(translate(SmallHeart, F(t)[])):
A:=display(seq(display(op([Gf,seq(G(-Pi/20*t), t=3..k),seq(G(Pi/20*t), t=3..k)]))$4,k=2..17),display(op([Gf,seq(G(-Pi/20*t), t=3..17),seq(G(Pi/20*t), t=3..17),Gl]))$30, insequence=true, size=[600,600]):
B:=animate(textplot,[[-0.6,0.25, "Happy"[1..round(n)]],color="Orange", font=[times,bolditalic,40], align=right],n=0..5,frames=18, paraminfo=false):
C:=animate(textplot,[[-0.2,0, "Valentine's"[1..round(n)]],color=green, font=[times,bolditalic,40], align=right],n=1..11,frames=35, paraminfo=false):
E:=animate(textplot,[[-0.3,-0.25, "Day!"[1..round(n)]],color="Blue", font=[times,bolditalic,40], align=right],n=1..4,frames=41, paraminfo=false):
T:=display([B, display(op([1,-1,1],B),C), display(op([1,-1,1],B),op([1,-1,1],C),E)], insequence=true):
K:=display(A, T, axes=none):
K;


The last frame of this animation:

display(op([1,-1],K), size=[600,600], axes=none);  # The last frame

                          

 

ValentinelDay.mw
 

Edit. The code was edited - the number of frames has been increased.

Let us consider the linear integer programming problem:

A := Matrix([[1, 7, 1, 3], [1, 6, 4, 6], [17, 1, 5, 1], [1, 6, 10, 4]]):
 n := 4; z := add(add(A[i, j]*x[i, j], j = 1 .. n), i = 1 .. n):
restr := {seq(add(x[i, j], i = 1 .. n) = 1, j = 1 .. n), seq(add(x[i, j], j = 1 .. n) = 1, i = 1 .. n)}:
 sol := Optimization[LPSolve](z, restr, assume = binary);

Error, (in Optimization:-LPSolve) no feasible integer point found; 
use feasibilitytolerance option to adjust tolerance

sol1 := Optimization[LPSolve](z, restr, assume = binary, feasibilitytolerance = 100, integertolerance = 1);

Error, (in Optimization:-LPSolve) no feasible integer point found;
 use feasibilitytolerance option to adjust tolerance

That was OK in Maple 16, outputting

.

The bug in one of the principal Maple commands lasts since Maple 2015, where the above code causes "Kernel connection has been lost". The SCRs about it were submitted three times (see http://www.mapleprimes.com/questions/204750-Bug-In-LPSolve-In-Maple-20151).

The Mobius strip  Mobius_strip_rolling.mw

Variants :


The line and the curve on the surface.

 

Recently, I came across an addendum to a problem that appears in many calculus texts, an addendum I had never explored. It intrigued me, and I hope it will capture your attention too.

The problem is that of girding the equator of the earth with a belt, then extending by one unit (here, taken as the foot) the radius of the circle so formed. The question is by how much does the circumference of the belt increase. This problem usually appears in the section of the calculus text dealing with linear approximations by the differential. It turns out that the circumference of the enlarged band is 2*Pi ft greater than the original band.

(An alternate version of this has the circumference of the band increased by one foot, with the radius then being increased by 0.16 ft.)

The addendum to the problem then asked how high would the enlarged band be over the surface of the earth if it were lifted at one point and drawn as tight as possible around the equator. At first, I didn't know what to think. Would the height be some surprisingly large number? And how would one go about calculating this height.

It turns out that the enlarged and lifted band would be some 616.67 feet above the surface of the earth! This is significantly larger than the increase in the diameter of the original band. So, the result is a surprise, at least to me.

This is the kind of amusement that retirement affords. I heartily recommend both the amusement and the retirement. The supporting calculations can be found in the attached worksheet: Girding.mw

Let us consider 

restart; 
MultiSeries:-limit(sin(n)/n, n = infinity, complex);
0

The answer is wrong: in view of the Casorati-Weierstrass theorem the limit does not exist. Let us try another limit command of Maple

limit(sin(n)/n, n = infinity, complex);


(lim) (sin(n))/(n)

which fails. Therefore, Maple user does not obtain the correct answer. 

Suppose we have some simple animations. Our goal - to build a more complex animation, combining the original animations in different ways.
We show how to do it on the example of the three animations. The technique is general and can be applied to any number of animations.

Here are the three simple animations:

restart;
with(plots):
A:=animate(plot, [sin(x), x=-Pi..a, color=red, thickness=3], a=-Pi..Pi):
B:=animate(plot, [x^2-1, x=-2..a, thickness=3, color=green], a=-2..2): 
C:=animate(plot, [[4*cos(t),4*sin(t), t=0..a], color=blue, thickness=3], a=0..2*Pi):

 

In Example 1 all three animation executed simultaneously:

display([A, B, C], view=[-4..4,-4..4]);

                                

 

In Example 2, the same animation performed sequentially. Note that the previous animation disappears completely when the next one begins to execute:

display([A, B, C], insequence);

                                 

 

Below we show how to save the last frame of every previous animation into subsequent animations:

display([A, display(op([1,-1,1],A),B), display(op([1,-1,1],A),op([1,-1,1],B),C)], insequence);

                                 

 

Using this technique, we can anyhow combine the original animations. For example, in the following example at firstly animations   and  B  are executed simultaneously, afterwards C is executed:

display([display(A, B), display(op([1,-1,1],A),op([1,-1,1],B),C)], insequence);

                                     

 

The last example in 3D I have taken from here:

restart;
with(plots):
A:=animate(plot3d,[[2*cos(phi),2*sin(phi),z], z =0..a, phi=0..2*Pi, style=surface, color=red], a=0..5):
B:=animate(plot3d,[[(2+6/5*(z-5))*cos(phi), (2+6/5*(z-5))*sin(phi),z], z=5..a, phi=0..2*Pi, style=surface, color=blue], a=5..10):
C:=animate(plot3d,[[8*cos(phi),8*sin(phi),z], z =10..a, phi=0..2*Pi, style=surface, color=green], a=10..20):
display([A, display(op([1,-1,1],A),B), display(op([1,-1,1],A),op([1,-1,1],B),C)], insequence, scaling=constrained, axes=normal);

                        


 

AA.mw

1 2 3 4 5 6 7 Last Page 1 of 43