13015 Reputation

19 Badges

12 years, 296 days

MaplePrimes Activity

These are answers submitted by tomleslie

By default (and unless you have switched it off) Maple will produce a "backup" about every 15minutes. I'm pretty sure backups are turned off whilst Maple is busy executing something - so how lucky you get will depend on relative timing of when you made the changes, when the last backup took place, and when you started the evaluations

Location may vary a little, but on a Windows 7 PC this backup directory is usually located at


You could also try (from the menus) File->Restore Backup, which will pop up a browser of backup files

reading the Maple help?

You state

How to change or control axis style mean style like bold, colour change etc?

So maybe if you read the page on ?Plot Axis Options, which states

The axis and axis[dir] options allow you to provide information about one or more axes to plotting commands such as plot and plot3d. The information may include, for example, the axis color, locations of tickmarks and gridlines, and use of logarithmic scaling.

And you state

How to change or control the font, colour and style of numbers written automatically by maple while plotting on the axis (x-axis, y-axis)?

So maybe if you read the plot/options page, particulary the "axesfont" section, you would be able to work this out

And you state

How to change the font, style and colours of labels?

So maybe if you read the plot/options page, particularly the "labelfont" section, you would be able to work this out.

This site is not a substitute for your inability to read!

A couple of excerpts from the help for the sum() command - emphasis added

The sum command (sum) is for symbolic summation.

To add a finite sequence of values, rather than compute a formula, use the add command.  For example, add(k, k=0..9) returns 45.  Although the sum command can often be used to compute explicit sums, it is strongly recommended that the add command be used in programs if an explicit sum is needed, in particular, when summing over all elements of a list, Array, Matrix, or similar data structure.

In your case using add() just makes everything "work"

the whole issue of whether 'solution' contains an indexed varaiab (ie t[3] ) or a variable with an inert suffix (ie t__3 ), by using indets(solution) to determine the variable name, as in the attached

is a command in the plots() package, so you have tue either the longfirm version of the command, ie plots:-display(), or load the whole plots() package using with(plots) - see the attached.

Note - so far as I can tell your plots p2 and p3 are identical so I change the line thickness on one of them just so that it more obvious that they overlaying.

Don't know exactly what you mean by a phaseportrait for this expression. "Normally" a phaseportrat would be associated with the solution of a (first-order) differential equation, which could be done with DEtools:-DEPlot() or DEtools:-phaseportrait(). I just don;t see how it applies  for your case. So you are going to have to specify exactly what you mean by a "phase portrait graph" - like what variables are on what axe?, and what is the function to be plotted?

for something like the attached, perhaps?

As a general rule, I wouldn't do this in this manner for a couple or reasons, which are

  1. Don't generate data in a crap format, then attempt to fix it!. Generate the data in a simple-to-read format in the first place
  2. Don't use Maple as a text editor. If you have to generate data in a crap format, then it is (probably?) easier to use a decent programmer's editor to convert it to a simple-to-read format

Having got that off my chest, the attached is clunky, but it works. All data is stored in an Array. Each entry of the Array is a five-element list. The first four elements of the list are the requested info from the header for a particular dataset. The final entry in each list is a matrix containing the x-y data for that dataset.

In the attached I have used


You will have to change this line so that the path corresponds to wherever you have the file stored on your machine.

you will have to place it "manually" using a textplot3d() command, as in the attached.

have to "assume" that t>0, as in the attached

the DirectSearch() package - an add-on available from the Maple Application Centre. I am however very doubtful about the actual success of any optimization package on a function which appears to have many, many local minima and maxima.. Contary to popular belief no optimisation algorithnm is capable of finding a global minimum (or maximum) for anything other than convex objective functions.

So for what iis worth you can check out the attached. NB you will not be able to execute this worksheet unless you have the DirectSearch() package installed, so treat the atached as read-only.


You state

The documentation seems like a big reference manual.

Yes the documentation is a big reference manual. However it also contains a lot of "getting started" info. In fact if you just use the menus Help->Maple Help, this will open the built-in Maple help, and the first section in the in the Table of Contents pane on the left-hand side is labelled "Getting Started" The help page displayed states (amongst other things)

• The User Manual covers an introduction to the Maple interface and the basics of using the Maple programming language.
• The Programming Guide covers introductory, intermediate and advanced programming techniques in the Maple programming language.

Both the User Manual and Programming Guide are available as PDF downloads at the Maplesoft online documentation center.

From this starting help page, you can access the User Manual in an (executable) worksheet and work your way through Maple basics. In PDF format, this manual is about 350 pages - and by the time you have finished reading it, you will have an understanding of Maple basics. The Programming Guide is when things get serious! In pdf format about 650 pages on how to write Maple programs.

You also state

Take the documentation on the Grid package. It lists out the 18 commands in the package. Am I supposed to go through all of the 18 to find out how this package is usually used? 

No probably not! Try reading Chapter 15 Parallel Programming of the Programming Guide , which serves as an introduction to both the 'Threads' and 'Grid' models for parallel programming. This covers the basic commands in both packages in a "didactic" fashion

You further state

Have a look at this page, for Grid:-Run. This page is seemingly abandoned. The formatting of the page runs way to the right. Someone didn't care at all about the reader of this. Like, is this command so unimportant that no one cares to maintain the documentation page for it?

The equivalent page in the built-in help looks absolutely fine - why would uou use on-line help rather than built-in?

The expression you waant to plot, assigned to the upper-case Greek letter Nu (which confusingly looks like an upper-case Roman N), does not depend on your plotting variables , y or N. This expression also does not contain the variable 'x', so why substitute for it?

Thus your 2D plots will be three horizontal lines (nothing varies with 'y') and your 3D plots will be three horizontal planes (nothing varies with either 'y' or 'N' ),

Can one combine these 2D and 3D plots? - Yes, see the attached: but what is the point?

For some reason this worksheet won't display inline here, so you will have to download to examine

logical and syntactical errors in the garbage code which you provide that I doubt anyone could either

  1. fix the garbage
  2. even figure out what you actually want

The attached may be what you are trying to produce, although I had to make so many guesses that I seriously doubt it

  _EnvHorizontalName := 'x':
  _EnvVerticalName := 'y':  
  EQ := proc(M, N)
             return ((y - M[2])/(x - M[1]) = (N[2] - M[2])/(N[1] - M[1])):
        end proc:

  a := 7:  b := 5:  
  t:= (3* Pi)/(4):    
  ellipse(el,x^2/a^2 + y^2/b^2 - 1 ):
  point(M1, a*cos(t), b*sin(t)):  
  point(F1, -c, 0):
  point(F2, c, 0):    
#  line( L1, [F1, M4]):    
  line( L1, [F1, M1]):

#  point(M1, a*cos(t),b*sin(t)):  
  op(solve({x^2/a^2 + y^2/b^2 - 1 =0, y=m*(x-c)},{x,y},explicit)[2])[1]:
  op(solve({x^2/a^2 + y^2/b^2 - 1 =0, y=m*(x-c)},{x,y},explicit)[2])[2]:
  line( tang1,x*xM2/a^2 + y*yM2/b^2 = 1):  
#  C1:=[ HorizontalCoord(C1), VerticalCoord(C1)]:
#   F1:=[-c,0]:
#  M2:= [ HorizontalCoord(M2), VerticalCoord(M2)]:
  triangle(T1, [C1,F1,M2]):
  ( [ textplot
      ( [ [ -c, 0, "F1"],
          [ c,  0, "F2"] ,                         
          [ coordinates(M1)[], "M1"],                          
          [ coordinates(M2)[], "M2"],                         
          [ coordinates(C1)[], "C1"]
      ( [ el(color=red),
          M1(color=black,symbol=solidcircle, symbolsize=16),
          M2(color=black,symbol=solidcircle, symbolsize=16),                      
          L1( color=black),
          F1(color=blue, symbol=solidcircle, symbolsize=16),                      
          F2(color=red, symbol=solidcircle, symbolsize=16),
          C1(color=black, symbol=solidcircle, symbolsize=16),
          T1(color=blue, filled=true, transparency=0.9)




trivial to plot the analytical solution for the same parameters as the numerical solutions - either separately or together, see the attached.

One would have to say that the agreement is terrible - a typo somewhere maybe?


ode := diff(theta(y), y, y)+Br*((-3*We*(y+1+(1/2)*x^2)*((9*(1+(1/2)*x^2)^2+9*y^2)*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)^3/(4*(1+(1/2)*x^2)^7)+3*y*(k+1)*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)^2/(1+(1/2)*x^2)^5+3*(k+1)^2*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)/(2*(1+(1/2)*x^2)^3)-(-120*lambda*(1+(1/2)*x^2)^4+(63*k^2-36*k+63)*(k-1)*(1+(1/2)*x^2)^3+288*Q*(k^2-(11/8)*k+1)*(1+(1/2)*x^2)^2+486*Q^2*(k-1)*(1+(1/2)*x^2)+324*Q^3)/(15*(1+(1/2)*x^2)^5))/(16*(1+(1/2)*x^2)^2)-3*We*(y-1-(1/2)*x^2)*((9*(1+(1/2)*x^2)^2+9*y^2)*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)^3/(4*(1+(1/2)*x^2)^7)+3*y*(k+1)*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)^2/(1+(1/2)*x^2)^5+3*(k+1)^2*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)/(2*(1+(1/2)*x^2)^3)-(-120*lambda*(1+(1/2)*x^2)^4+(63*k^2-36*k+63)*(k-1)*(1+(1/2)*x^2)^3+288*Q*(k^2-(11/8)*k+1)*(1+(1/2)*x^2)^2+486*Q^2*(k-1)*(1+(1/2)*x^2)+324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*(1+(1/2)*x^2)^2+486*Q^2*(k-1)*(1+(1/2)*x^2)+324*Q^3)/(15*(1+(1/2)*x^2)^5))/(16*(1+(1/2)*x^2)^2)-3*We*(y-1-(1/2)*x^2)*(y+1+(1/2)*x^2)*(9*y*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)^3/(2*(1+(1/2)*x^2)^7)+(3*(k+1))*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)^2/(1+(1/2)*x^2)^5)/(16*(1+(1/2)*x^2)^2)+(-3*y*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)/(1+(1/2)*x^2)^2-k-1)/(x^2+2))^4) = 0

bc := theta(-1-(1/2)*x^2) = 0, theta(1+(1/2)*x^2) = 1

Q__vals := [.5617, .4392, .2564, .1645, 0.659e-1]

`λ__vals` := [0.96e-2, 0.10e-2, 0.93e-2, 0.75e-2, 0.31e-2]; k__vals := [.1, .3, .5, .7, .9]

We__vals := [.1, .3, .5, .7, .9]

colors := [black, red, blue, green, orange, cyan, purple, yellow, navy]; for j to numelems(k__vals) do sol := dsolve(eval([ode, bc], [k = k__vals[j], We = .1, Br = .3, x = 0, Q = Q__vals[j], lambda = `λ__vals`[j]]), numeric); pltn[j] := plots:-odeplot(sol, [y, theta(y)], y = 0 .. 1, axes = boxed, color = colors[j]) end do; plots:-display([seq(pltn[j], j = 1 .. 5)], title = "Numerical Solution")


Analytical_sol := -(3*y+3+3*x^2*(1/2))*((-2/3+(-(5/12)*k^2+(1/6)*k-5/12)*Br)*(1+(1/2)*x^2)^5-lambda*Br*((-(1/12)*k^2+(1/6)*k-3/4)*y+Q*(k-1))*(1+(1/2)*x^2)^4-(((1/6)*k+7/6)*y+Q)*Br*((-(1/2)*k+1/2)*y+Q)*(1+(1/2)*x^2)^3+We*Br*((1/4)*(k-1)^2*y^2-(1/3)*Q*(k-5)*y+Q^2)*y*(1+(1/2)*x^2)^2-((1-k)*y+Q)*Br*y^2*Q*(1+(1/2)*x^2)+Q^2*y^3*Br)/(4*(1+(1/2)*x^2)^6)

for j to numelems(k__vals) do sol[j] := eval(Analytical_sol, [k = k__vals[j], We = .1, Br = .3, x = 0, Q = Q__vals[j], lambda = `λ__vals`[j]]); plta[j] := plot(sol[j], y = 0 .. 1, axes = boxed, color = colors[j], linestyle = dash) end do; plots:-display([seq(plta[j], j = 1 .. numelems(k__vals))], title = "Analytical Solution"); plots:-display([seq(plots:-display([pltn[j], plta[j]]), j = 1 .. numelems(k__vals))], title = "Numerical and Analytical Solutions")






if you posted the complete worksheet for your calculation using the big green up-arrow in the Mapleprimes toolbar.

In the attached I have performed the calculation you seem to want in two completely different ways.

The first uses Maple's bult-in numapprox() and orthopoly() packages.  The second uses an "add-on" package (which you probably don't have?) called OrthogonalExpansions() which is available from the Maple Application Centre. These return the same answers: the desired series is

-0.577350269189626*T(0, x) - 0.309401076758503*T(1, x) - 0.0829037686547607*T(2, x)

The coefficients in this series disagree with those which you report - but since you do not specify how you obtained your coefficients, there isn't much I can say?

When converted to a simple polynomial in 'x', both give

-0.494446500534865 - 0.309401076758503*x - 0.165807537309521*x^2

and both return your measure of "error" as 0.02776926226

# Use built-in approach with numapproz and orthopoly packages
# NB numapprox(0 will only give floating point coefficients
# for the series. Retyrned series is claimed to be accurate
# to 10^-(Digits) - Diigits is on default, ie 10
  ser0:= numapprox:-chebyshev(u, x=-1..1):
# Restrict to first three terms, and use orthopoly() to
# evaluate the ChebyshevT polynomials. Note that the latter
# returns the same as using the OrthogonalExpansions package
# below
  ser2:=add(op([1..3], ser0));
  ser3:=eval( ser2, T=orthopoly[T]);
# Compute OP's definition of "error"
  evalf(Int(abs(u - ser3), x = -1 .. 1));



-HFloat(0.5773502691896257)*T(0, x)-HFloat(0.309401076758503)*T(1, x)-HFloat(0.08290376865476069)*T(2, x)






# Generate ChebyshevT series of 'u' above over the
# range x=-1..1
  ser := ChebyshevTSeries(u, x = -1 .. 1, 'n', 'Coefficients');
# Restrict series to th first three terms, ie, ChebyshevT(0, x)
# ChebyshevT(1, x), and ChebyshevT(2, x)
# Return the restricted series and the coefficients. Compare the
# latter with the values in 'ser2' above
  n:= 2;
# Use the orthopoly() package to convert the ChebyshevT polynomials
# Compare 'ser3' below with 'ser3' in previous execution group
  ser3:=evalf(eval(ser2, [ seq( ChebyshevT(i, x)=orthopoly:-T(i,x), i=0..2)]));
# Check OP's definition of the "error" between the series
# expansion and the orifginal function
  evalf(Int(abs(u - ser3), x = -1 .. 1));

u := 1/(x-2)


Sum(piecewise(i = 0, 1/Pi, 2/Pi)*(int(ChebyshevT(i, x)/((x-2)*(-x^2+1)^(1/2)), x = -1 .. 1))*ChebyshevT(i, x), i = 0 .. n)




-(1/3)*3^(1/2)*ChebyshevT(0, x)+2*(Pi-(2/3)*Pi*3^(1/2))*ChebyshevT(1, x)/Pi+2*(4*Pi-(7/3)*Pi*3^(1/2))*ChebyshevT(2, x)/Pi


[-.5773502693, -.3094010774, -0.8290376528e-1]








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