tomleslie

6804 Reputation

17 Badges

10 years, 220 days

MaplePrimes Activity


These are replies submitted by tomleslie

@Fancypants 

So much so that I have trouble figuring out what you intend - so the followinbg is a couple of things I "suspect" that you are probably(?) getting wrong

The difference between assignments and equations.

Just because you enter an equation in Maple and subsequently use the left-hand side of this equation in a subsequent expression/equation/assignment, the former will not be automatically substitued into the latter. Now obviously this is quite a common mathematical operation, so there are many ways within Maple to perform such a substitution/evaluation - but they aren't going to happen by "magic"!

 

Inert and non-inert superscripts and subscripts.

There is a significant conceptual difference between entering (say) x[1] and x__1. Both of these will be "prettyprinted" in Maple output as x1 However the first (ie x[1]) of these represents the first entry in an indexable quantity 'x' - ie 'x' is a vector/list/set whatever and wish to use its first entry. The second (ie x__1) is an "inert" subscript, there is no suggestion of "indexing".

The situation is rather simpler for superscripts - as far as you are concerned, Maple does not use inert superscripts (It may be possible in the Physics package - but that is Maple at whole new level, and trust me you are not using it!), Superscripts are used for the mathematical function of exponentiation

As an illustration, your worksheet contains the quantity S1y but the way you have entered this means that Maple considers it to be the first entry in the indexable quantity S, raised to the power of the (variable) 'y'. I'm guessing that it not what you intended.

 

There are other problems - but most of your issues are related to the desire to use over-complicated(?) typography, so my advice would be not to use the latter, until you really (really!) understand what you are doing

 

 

 

 

@ecterrab 

When I create the appropriate directory structure manually, copy in all of the files manually etc, then restart Maple and do a quick couple of checks - see the attached - everything now seems to be working

Thanks for the help

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 709 and is the same as the version installed in this computer, created 2020, June 17, 9:28 hours Pacific Time, found in the directory C:\Users\TomLeslie\maple\toolbox\2020\Physics Updates\lib\Physics Update`

(1)

libname

"C:\Users\TomLeslie\maple\toolbox\2020\Physics Updates\lib", "C:\Program Files\Maple 2020\lib", "C:\Users\TomLeslie\maple\toolbox\Glyph2\lib", "C:\Users\TomLeslie\maple\toolbox\OrthogonalExpansions\lib", "C:\Users\TomLeslie\maple\toolbox\Syrup\lib"

(2)

 

Download physUp.mw

@ecterrab 

Prior to installation attempt

kernelopts(version);
Physics:-Version();
libname;

`Maple 2020.1, X86 64 WINDOWS, Jun 10 2020, Build ID 1474787`

 

`The "Physics Updates" package is not installed`

 

"C:\Program Files\Maple 2020\lib", "C:\Users\TomLeslie\maple\toolbox\Glyph2\lib", "C:\Users\TomLeslie\maple\toolbox\OrthogonalExpansions\lib", "C:\Users\TomLeslie\maple\toolbox\Syrup\lib"

(1)

 

Download preTry.mw

During installation attempt: (the consistent feature is mserver.exe crashing)

After installation attempt, then closing Maple, then restarting Maple

kernelopts(version);
Physics:-Version();
libname;

`Maple 2020.1, X86 64 WINDOWS, Jun 10 2020, Build ID 1474787`

 

`The "Physics Updates" version "708" is installed but is not active. The active version of Physics is within the library C:\Program Files\Maple 2020\lib\maple.mla, created 2020, March 5, 1:36 hours`

 

"C:\Program Files\Maple 2020\lib", "C:\Users\TomLeslie\maple\toolbox\Glyph2\lib", "C:\Users\TomLeslie\maple\toolbox\OrthogonalExpansions\lib", "C:\Users\TomLeslie\maple\toolbox\Syrup\lib"

(1)

 

Download postTry.mw

Now obviously I cannot demonstrate a "working" installation in Maple 2020, because when I updated to Maple 2020.1, everything went tits-up.

However just for historical interest, the following show "working" installations for Maple 2019.2 and Maple 2018.2, because I have been using Physics Updates packages for a long time

Ironically I only keep these around in case anyone on Mapleprimes has a version-specific problem

kernelopts(version);
Physics:-Version();
libname;

`Maple 2019.2, X86 64 WINDOWS, Nov 26 2019, Build ID 1435526`

 

`The "Physics Updates" version in the MapleCloud is 708; the version installed in this computer is 602 created 2020, February 9, 23:46 hours, found in the directory C:\Users\TomLeslie\maple\toolbox\2019\Physics Updates\lib\`

 

"C:\Users\TomLeslie\maple\toolbox\2019\Physics Updates\lib", "C:\Program Files\Maple 2019\lib", "C:\Users\TomLeslie\maple\toolbox\Glyph2\lib", "C:\Users\TomLeslie\maple\toolbox\OrthogonalExpansions\lib", "C:\Users\TomLeslie\maple\toolbox\Syrup\lib"

(1)

 

Download 2019wkg.mw

kernelopts(version);
Physics:-Version();
libname;

`Maple 2018.2, X86 64 WINDOWS, Nov 16 2018, Build ID 1362973`

 

"C:\Users\TomLeslie\maple\toolbox\2018\Physics Updates\lib\Physics Updates.maple", `2019, March 14, 23:22 hours, version in the MapleCloud: 708, version installed in this computer: 326.`

 

"C:\Users\TomLeslie\maple\toolbox\2018\Physics Updates\lib", "C:\Program Files\Maple 2018\lib", "C:\Users\TomLeslie\maple\toolbox\Glyph2\lib", "C:\Users\TomLeslie\maple\toolbox\OrthogonalExpansions\lib", "C:\Users\TomLeslie\maple\toolbox\Syrup\lib"

(1)

 

Download wkg2018.mw

@

Support for Windows 7 has now finished. There have been no updates for several months. Even when updates were being issued Updating was under user control, unlike Windows 10.

@ecterrab 

multiple times.

And every time I get an mserver.exe crash about midway through the installation. But I'm prepeared to try again. Process goes as follows

  1. Delete the "Physics Updates" folder from its default location. On my system this is at 'C:\Users\TomLeslie\maple\toolbox'. This may be significant later.
  2. Open Maple, enter the command Physics:-Version(); the return is `The "Physics Updates" package is not installed`
  3. Use MapleCloud Icons->Packages->Physics Updates->Install: first pop-up says downloading, then moves to installing but about half-way through (based on the progress bar) I get a further pop-up which says mserver.exe has stopped working.
  4. Maple completely stalled ta this point, so shut it down and start it up again
  5. Physics:-Version() now returns `The "Physics Updates" version "708" is installed but is not active. The active version of Physics is within the library C:\\Program Files\\Maple 2020\\lib\\maple.mla, created 2020, March 5, 1:36 hours`
  6. Now I don't believe the Physics Updates package is "installed" anywhere, because (see  bullet 1 above) although the "Physics Updates" folder has reappeared at the default location ie ( 'C:\Users\TomLeslie\maple\toolbox'), there is nothing in this folder except a version.txt file - contents shown below.

package-title: Physics Updates
cloud-id: 5137472255164416
cloud-version: 708
cloud-link: https://maple.cloud
install-date: 2020-06-18 17:04

Now it seems obvious to me that the problem is caused by the mserver.exe crash during the installation process (see bullet 3 above) which happens every time I try to do this

 

@ 

As stated in my original post I'm running 64-bit windows 7

@Carl Love 

not only do you have to ensure that

D(theta)(0) = 0 #Initially there's no vertical motion

but also that the horizontal component of tension in the pendulum is equal to the centripetal force. And if you plough through the algebra for this latter condition, it means that for any starting angle theta(0), it is necessary that

D(phi)(0)=sqrt( g/cos(theta(0))/l ).

Note the divide by 'l' in the latter: in my previous post I was relying on the fact that the pendulum length was 1 and I omitted the divide-by-l, - mea culpa etc

 

@wolfgan 

yu just have to set the initial conditions correctly: See the attached which has my original calculation, and one (with a different set of ics) which produces circular motion

  restart;

#
# Parameters
#
  l:=1:
  g:= 9.8:
#
# Odes and initial conditions: the latter are
# arbitrarily chosen
#
  odes:= diff(theta(t),t$2) = diff(phi(t),t)^2*sin(2*theta(t))/2 - g*sin(theta(t))/l,
         diff(phi(t),t$2) = -2*diff(theta(t),t)*diff(phi(t),t)*cot(theta(t)):
  ics:= phi(0)=0, D(phi)(0)=1, theta(0)=Pi/3, D(theta)(0)=0.1:
#
# ics for circular motion
#
  ics2:= phi(0)=0, D(phi)(0)=sqrt( g/cos(Pi/3) ), theta(0)=Pi/3, D(theta)(0)=0:
#
# the coodinate transformation from
#
#  [l, phi(t), theta(t)] -> [x, y, z]
#
  f:= tau-> [ l*sin(theta(tau))*cos(phi(tau)),
              l*sin(theta(tau))*sin(phi(tau)),
              l*(1-cos(theta(tau)))
            ]:
#
# Animate the solution
#
  plots:-odeplot
         ( dsolve({odes, ics}, numeric),
           f(t),
           t=0..10,
           frames=100,
           labels=[x,y,z],
           view=[-1..1, -1..1, 0..1]
         );
#
# Animate the "circular motion solution
#
  plots:-odeplot
         ( dsolve({odes, ics2}, numeric),
           f(t),
           t=0..10,
           frames=100,
           labels=[x,y,z],
           view=[-1..1, -1..1, 0..1]
         );

 

 

 

Download conPend2.mw

@Test007 

  x^5 + 2*x^3 + 3  is an expression, not a function - there is a difference

@nm 

in my comments.

It is perfectly possible to use multiline strings in Maple using the explicit embedded "\n" character sequence.

It is not generally recommended to achieve the same effect by having an opening string delimiter on one line, and the closing string delimiter on a subsequent line, and relying on the EOL sequence from your editor to produce a "newline" within the string.

Just out of interest, I used your original code in an mpl file, ie

oo1:= proc(x)
local z := "";
    if not x in ["A","B"] then
        return;
    fi;

    z:=cat("A
            B");    
end proc;

and used a simple worksheet "read" statement, just to see what would happen - I was expecting a hard error. However, although Maple issued a warniing, it did a reasonable job of "fixing" the problem. However the mere fact that it generates an error means that I would expect the 'linter' to object to this construct.

See the attached

  restart:

 read "C:/Users/TomLeslie/Desktop/foo1.mpl"

Warning, incomplete string;  use " to end the string

 

proc (x) local z; z := ""; if not `in`(x, ["A", "B"]) then return  end if; z := cat("A
            B") end proc

(1)

foo1("A");

"A
            B"

(2)

foo1("C");

 

Download mplRead.mw

I'm not sure that your references to 'here-text' or "here-strings" are particularly relevant - in languages where these facilities are available, they usually come with their own specific delimiters

@Carl Love 

Maybe one ought to consider references to this topic in Maple's help. The only two explicit statements I can find are

1. From chapter4 of the MapleProgrammingGuide (my emphasis)

A set is an unordered sequence of unique expressions. When a set is created, Maple reorders the expressions to remove duplicate values and to make certain operations faster.

2. From the help page ?Sets and Lists

Sets
Repeated elements in a set are ignored.

I find it (mildly) interesting that nowhere is the concept of "equality" mentioned - just slightly weaselly (as well as undefined and untestable?) terms like "duplicate" and "repeated".

This begs the obvious question: as a set is being constructed what constitutes  "duplicate/repeated" elements, and how is this property tested ?

It seems obvious that neither ArrayTools:-IsEqual() or LinearAlgebra:-Equal(...., compare=all) are involved - so maybe a simple evalb(), or some other (unspecified??) definiton of "equality".

Because we now have the situation where (for example) it is possible for a set to contain two (matrix/vector) elements e1, e2 for which LinearAlgebra:-Equal(e1, e2, compare=all) returns true. See the attached.

I (think I) understand how/why this is happening - but the more fundamental question is - should it be happening?

  restart:

  P:={ Matrix(2, 1, [1,2])}:
  P:= P union { Matrix(2, 1, [1,2])};
#
# Compare entries
#
  LinearAlgebra:-Equal( P[1], P[2], compare=all);
  evalb( P[1]=P[2]);
###################################################
  Q:={Vector( [1,2])}:
  Q:= Q union {Vector( [1,2])};
#
# Compare entries
#
  LinearAlgebra:-Equal( Q[1], Q[2], compare=all);
  evalb( Q[1]=Q[2]);
###################################################
  R:={Array( [1,2])}:
  R:= R union {Array( [1,2])};
#
# Compare entries
#
  ArrayTools:-IsEqual( R[1], R[2] );
  evalb( R[1]=R[2]);

[Vector(2, {(1) = 1, (2) = 2}), Vector(2, {(1) = 1, (2) = 2})]

 

true

 

false

 

[Vector(2, {(1) = 1, (2) = 2}), Vector(2, {(1) = 1, (2) = 2})]

 

true

 

false

 

[Array(%id = 18446744074381983742), Array(%id = 18446744074381991798)]

 

true

 

false

(1)

 

Download eleq.mw

 

 

 

@Carl Love 

I think either you are "overcomplicating" or missing the point - so I stripped the OP's problem back to something as basi as possible.

Essentially when one creates a set with duplicate elements, by explicitly entering these elements within a {} construct - it never works. No duplicate elements appear

However when  one creates a set with duplicate elements, by using a 'union' command, then (for some data types), the resulting set will contain duplicate entries

Since `union` is a builtin command, I can't showstat() and see what kind of element equality checking is being performed before the final "container" is returned - but a simple examination of the attached ought to convince you that something is going badly wrong.

BTW I haven't checked other possible element datatypes -my life's too short

  restart:

  P:={ Matrix(2, 1, [1,2]),
       Matrix(2, 1, [1,2])
     };
  Q:={ Vector([1,2]),
       Vector([1,2])
     };
  R:={ Array([1,2]),
       Array([1,2])
     };

[Vector(2, {(1) = 1, (2) = 2})]

 

[Vector(2, {(1) = 1, (2) = 2})]

 

[Array(%id = 18446744074382624038)]

(1)

  P:={ Matrix(2, 1, [1,2])}:
  P:= P union { Matrix(2, 1, [1,2])};
  Q:={Vector( [1,2])}:
  Q:= Q union {Vector( [1,2])};
  R:={Array( [1,2])}:
  R:= R union {Array( [1,2])};

[Vector(2, {(1) = 1, (2) = 2}), Vector(2, {(1) = 1, (2) = 2})]

 

[Vector(2, {(1) = 1, (2) = 2}), Vector(2, {(1) = 1, (2) = 2})]

 

[Array(%id = 18446744074382621502), Array(%id = 18446744074382621622)]

(2)

 

Download isItUnion.mw

 

 

@Carl Love 

But then perhaps the Maple help page for "Sets and Lists" should be modified, so that it doesn't say (my emphasis)


Examples
Sets
Repeated elements in a set are ignored.

 

@Test007 

enter the part of your Maple command that is to the right of the ":="

you would see an issue with your suggestion?

@janhardo 

Because this probably isn't the best palce to obtain instruction on basic Maple programming.

For your first query: the seq() command accepts two arguments, which are

  1. an expression to be evaluated
  2. a range of values over which the expression is to be evaluated.

So what happens if you want to evaluate two expressions, Can't be done -right? Well, actually it can:just group the two expressions in a list as in [expr1, expr2] - which makes it a single expression. This can be evaluated. Then add the 'unlist' operator which '[]' which will convert this single expression ( a list) into its two entries. So

seq( [expr1, expr2][] , range)

is just a method of evaluating two expressions in a single seq() command, becuase as far as seq() is concerned,

[expr1, expr2][]

is treated as a single expression, even if ultimately it provides two answers

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

For your second query: the '~' operator is an elementwise command, so the code

X+~(b-a)/(2*N)

adds the scalar quantity (b-a)/(2*N) to every element in the container X  which is an Array. Hence, for example if X is the Array with elements x1, x2, x3, then X+~(b-a)/(2*N) will produce the Array with elements x1+(b-a)/(2*N), x2+(b-a)/(2*N), x3+(b-a)/(2*N).

In a similar way, the syntax f~(X) will apply the function 'f' to eh element of the container X. So if X is the Array with entries x1, x2, x3, this will produce the Array with entries f(x1), f(x2), f(x3).

The combination of the the two elementwise commands should then be obvious. If the container X contains the entries x1, x2, x3, then the command

f~(X+~(b-a)/(2*N));

will producee an Array with the entries f(x1+(b-a)/(2*N)), f(x2+(b-a)/(2*N)), f(x3+(b-a)/(2*N))

 

 

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