Maple 2016 Questions and Posts

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

I have been working on a general solution to motion analysis and seem to be going backwards.  I have an numerical solution in Octave I use for comparison.  I have reduced the problem to a small example that exhibits the problem.

I posted a question similar to this, but, without a set of known values.

I am doing something wrong, but, what?

Tom Dean

## bearing.mpl, solve the target motion problem with bearings only.
##
## Consider a sensor platform moving through points (x,y) at times
## t[1..4] with the target bearings, Brg[1..4] taken at times t[1..4]
## with the target proceeding along a constant course and speed.
##
## time t, bearing line slope m, sensor position (x,y) are known
## values.
##
## Since this is a generated problem the target position at time t is
## provided to compare with the results.
##
#########################################################################
##
restart;
##
genKnownValues := proc()
    description "set the known values",
    "t - relative time",
    "x - sensor x location at time t[i]",
    "y - sensor y location at time t[i]",
    "m - slope of the bearing lines at time t[i]",
    "tgtPosit - target position at time t[i]";
    global t, m, x, y, tgtPosit;
    local dt, Cse, Spd, Brg, A, B, C, R, X;
    local tgtX, tgtY, tgtRange, tgtCse, tgtSpd;
## relative and delta time
    t := [0, 1+1/2, 3, 3+1/2];
    dt := [0, seq(t[idx]-t[idx-1],idx=2..4)];
## sensor motion
    Cse := [90, 90, 90, 50] *~ Pi/180; ## true heading
    Spd := [15, 15, 15, 22];  ## knots
## bearings to the target at time t
    Brg := [10, 358, 340, 330] *~ (Pi/180);
## slope of the bearing lines
    m:=map(tan,Brg);
## calculate the sensor position vs time
    x := ListTools[PartialSums](dt *~ Spd *~ map(cos, Cse));
    y := ListTools[PartialSums](dt *~ Spd *~ map(sin, Cse));
## target values  start the target at a known (x,y) position at a
## constant course and speed
    tgtRange := 95+25/32; ## miles at t1, match octave value...
    tgtCse := 170 * Pi/180; ## course
    tgtSpd := 10; ## knots
    tgtX := tgtRange*cos(Brg[1]);
    tgtX := tgtX +~ ListTools[PartialSums](dt *~ tgtSpd *~ cos(tgtCse));
    tgtY := tgtRange*sin(Brg[1]);
    tgtY := tgtY +~ ListTools[PartialSums](dt *~ tgtSpd *~ sin(tgtCse));
## return target position vs time as a matrix
    tgtPosit:=Matrix(4,2,[seq([tgtX[idx],tgtY[idx]],idx=1..4)]);
end proc:
##
#########################################################################
## t[], m[], x[], and y[] are known values
##
## equation of the bearing lines
eq1 := tgtY[1] - y[1]    = m[1]*(tgtX[1]-x[1]):
eq2 := tgtY[2] - y[2]    = m[2]*(tgtX[2]-x[2]):
eq3 := tgtY[3] - y[3]    = m[3]*(tgtX[3]-x[3]):
eq4 := tgtY[4] - y[4]    = m[4]*(tgtX[4]-x[4]):
## target X motion along the target line
eq5 := tgtX[2] - tgtX[1] = tgtVx*(t[2]-t[1]):
eq6 := tgtX[3] - tgtX[2] = tgtVx*(t[3]-t[2]):
eq7 := tgtX[4] - tgtX[3] = tgtVx*(t[4]-t[3]):
## target Y motion along the target line
eq8 := tgtY[2] - tgtY[1] = tgtVy*(t[2]-t[1]):
eq9 := tgtY[3] - tgtY[2] = tgtVy*(t[3]-t[2]):
eq10:= tgtY[4] - tgtY[3] = tgtVy*(t[4]-t[3]):
##
#########################################################################
##
## solve the equations
eqs  := {eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10}:

Sol:= solve(eqs, {tgtVx, tgtVy, seq([tgtX[k], tgtY[k]][], k= 1..4)}):
##

genKnownValues():
## these values are very close to Octave
evalf(t);evalf(m);evalf(x);evalf(y);evalf(tgtPosit);
## The value of tgtX[] and tgtY[] should equal the respective tgtPosit values
seq(evalf(eval([tgtX[idx],tgtY[idx]], Sol)),idx=1..4);

 

I accidentally came across a nice Mma animation. Unfortunately, I am able to present only few frames of it in MaplePrimes. See two inconsecutive frames below

 

I find this animation very deep. I don't remember something similar. It looks like an iterative
map shown in its dynamics. Not being an expert in Mathematica, I don't understand the machinery of the generating code.
n = 1000;
r := RandomInteger[{1, n}];
f := (#/(.01 + Sqrt[#.#])) & /@ (x[[#]] - x) &;
s := With[{r1 = r}, p[[r1]] = r; q[[r1]] = r];
x = RandomReal[{-1, 1}, {n, 2}];
{p, q} = RandomInteger[{1, n}, {2, n}];
Graphics[{PointSize[0.007], Dynamic[If[r < 100, s];
Point[x = 0.995 x + 0.02 f[p] - 0.01 f[q]]]}, PlotRange -> 2]
Here is its fragment translated into Maple:
>with(MmaTranslator):
>FromMma(" (#/(.01 + Sqrt[#.#])) & /@ (x[[#]] - x) &;");
map(unapply(_Z1/(0.1e-1+sqrt(_Z1 . _Z1)), _Z1), unapply(x(_Z1)-x, _Z1))
To my regret,
>FromMma(" n = 1000;
r := RandomInteger[{1, n}];
f := (#/(.01 + Sqrt[#.#])) & /@ (x[[#]] - x) &;
s := With[{r1 = r}, p[[r1]] = r; q[[r1]] = r];
x = RandomReal[{-1, 1}, {n, 2}];
{p, q} = RandomInteger[{1, n}, {2, n}];
Graphics[{PointSize[0.007], Dynamic[If[r < 100, s];
Point[x = 0.995 x + 0.02 f[p] - 0.01 f[q]]]}, PlotRange -> 2]");
Error, (in MmaTranslator:-FromMma) incorrect syntax (at position 11) in last character of "...0)
r"

Hi all,

Using the Physics package, I have defined a density operator, shown in the image below:

Definition of Density Operator

(I did assume(s ≠i), assume(v≠h).

I then operate on it with the Bracket as shown in the next image:

Bracket on Density Operator

 

I think this should evaluate to (|Y,s,h><Y,s,h|)/2; or at least that's the result I want. However, Maple evaluates this to zero.

Is there a where to convince Maple to evaluate this to what I want/expect?

Thanks in advance,

Kevin

I would prefer that all the polynomials generated in my workbook by MAPLE were in expanded form.  For instance, it the elements of a matrix are polynomials, I want to see the expanded form for all of them.  What do I type into a workbook to make this happen.  (I am a new user of MAPLE.) 

12pt type is difficult for me to read.  I would like to fix a workbook so that everything yet to appear will be in 18pt type, without my having to enlarge things one at a time.   (I am a new MAPLE user.)  

A few people have asked me how I created the sections in the Maple application in this video: https://youtu.be/voohdmfTRn0?t=572

Here's the worksheet (Maple 2016 only). As you can see, the “sections” look different what you would normally expect (I often like to experiment with small changes in presentation!)

These aren't, however, sections in the traditional Maple sense; they're a demonstration of Maple 2016's new tools for programmatically changing the properties of a table (including the visibility of its rows and columns). @dskoog gets the credit for showing me the technique.

Each "section" consists of a table with two rows.

  • The table has a name, specified in its properties.
  • The first row (colored blue) contains (1) a toggle button and (2) the title of each section (with the text in white)
  • The second row (colored white) is visible or invisible based upon the state of the toggle button, and contains the content of my section.

Each toggle button has

  • a name, specified in its properties
  • + and - images associated with its on and off states (with the image background color matching the color of the first table row)
  • Click action code that enables or disables the visibility of the second row

The Click action code for the toggle button in the "Pure Fluid Properties" section is, for example,

tableName:="PureFluidProperties_tb":
buttonName:="PureFluidProperties_tbt":
if DocumentTools:-GetProperty(buttonName, 'value') = "false" then   
     DocumentTools:-SetProperty([tableName, 'visible[2..]', true]);
else
     DocumentTools:-SetProperty([tableName, 'visible[2..]', false]);
end if;

As I said at the start, I often try to make worksheets look different to the out-of-the-box defaults. Programmatic table properties have simply given me one more option to play about with.

 

For many years I succesfully used the command:

Lambda := ImportMatrix(LambdaFile, delimiter = "", datatype = string);

 

but for some txt files I now got the following error in Maple 2016:
Error, (in ImportMatrix) cannot interpret file

The same code still runs without problems at all in previous versions of Maple.

The strange thing is that other txt files can be still be imported in Maple 2016 without problems.

I will upload two files:

ULSlx3.txt returns an error message

ULStd3.txt no problems

ULSlx3.txt

ULStd3.txt

complete code:

restart;
with(LinearAlgebra); with(Statistics);
interface(rtablesize = infinity);
with(Typesetting):
interface(typesetting=extended):

LambdaFile := "C:/path/ULSlx3.txt";
Lambda := Matrix(5, 1);

in the whatsnew there is no information on changes with respect to the ImportMatrix command, although there is some (unrelated) information on Importing Data:

Importing Data
By default, the Import command now returns a DataFrame when importing from Excel, CSV, DIF, and TSV file formats, and returns a DataSeries when importing from ODS, SXC, and TSV file formats. Use the output option to specify a different format. For example, Import(origin, output=Matrix).

 

I have no clue what is wrong with my code and why some text files can be imported as before whereas other files returns an error message.

greetings Harry

In using Maple there are many ways to complete a command on a function. Using shortcuts in the worksheet/document you can enter the command on the line rather than using the drop down menus or clickable math menu.  I would like to see what the shortcut command are for the packages in Maple.  There are so many, I am using the LinearAlgebra package and have seen Dr. Lopez use " ||A||2 to determine the Euclidean Norm of A.  But where does this use get described in the help or examples of other shortcut usage for Maple. I've seen the shortcut commands for Documents in General, but the use of shortcut commands for other packages  don't seem to discuss the usage of such shortcuts.

Is there a document that documents these shortcuts.

 

Hello there,

 

Suppose I have a parametric experssion like   P(ε)=1+ε+ε23 where ε is very small. How can I get P(ε)≈1+ε or P(ε)≈1+ε+ε2

 

Thanks

Hello.

int(floor(x^2), x = 0 .. 2) = 6 , but it should be 1.85374.

 

 

Bug_in_integrate(floor_and_ceil).mw

Mariusz Iwaniuk

If I am in the Maple debugger, stopped in a routine, how can I navigate between stack frames, such as looking at the variables of the calling function?

"outfrom" is not sufficient for this purpose as that continues execution until return, which would change the variables of the routine I am in, and could potentially take a long time. And more importantly for my particular purpose, the routine I am stopped in is a package's "I found an error" routine which is (deliberately) throwing an exception, so there will not be any return.

I can use where or where? to look at the name of the calling routines. Unfortunately, for the code I am debugging, the calling routine is being dynamically loaded so I do not have a file name for it and I cannot put a persistent breakpoint in it: I need to climb the tree of dynamic calls with their various parameters in order to figure out how the error occured.

Is there an elegant way to plot the region between the surfaces z=-y^2 and z=x^2, only on the domain of the XY-plane bounded by the triangle with vertices (0,0), (1,0) and (1,1)?

This week I am participating in 19th Ising lectures (see https://drive.google.com/folderview?id=0B0uPwoK-03XgSEZpYWljYnpXN0U&usp=sharing). The Serguei Nechaev's talk inspired me to ask the question:
"How to simulate a random walk on an undirected and unweighted (and, of course, connected) graph
(All the paths from a vertex of degree k have the same probability 1/k.)?"
A Maple procedure to this end is welcome.

Is there an elegant way to plot in 3d only the portion of the function f(x,y)=sqrt(25-x^2-y^2) for which 9 <= x^2+y^2 <= 16 ? I'm looking for a nice plot that shows it against the whole sphere with radius 5, so that it's clear which part of the sphere is cut out.

I have a Document that I have been putting together.  When I insert a Subsection into a section below the title I get a 1D-math input command symbol.  Is there a way to prevent this from happening?  I have not had this problem before. 

It appears there is something confused in the startup of the document because when I start a new document and this doesn't happen.

It's almost like when I insert the subsection it converts that part to a worksheet?????

First 54 55 56 57 58 59 60 Page 56 of 60