tomleslie

6672 Reputation

17 Badges

10 years, 173 days

MaplePrimes Activity


These are replies submitted by tomleslie

@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))

 

 

@janhardo 

In my previous post I showed the differences between left, right and midpoint sums be simply evaluating.displaying the graphs for

    myRS(x->1+x^sin(x), 1, 5, 30, left);
  myRS(x->1+x^sin(x), 1, 5, 30, right);
  myRS(x->1+x^sin(x), 1, 5, 30, midpoint);

So when you say

But using a drawing of the 3 riemann sums is needed (for me ) to see the structure of the points of the tread-riser plot

which part of the above three graphs don't you understand????

@janhardo 

In your reply to CarlLove's procedure you stated

This is a procedure you made, but that's not needed in this task ( even before the procedure is introduced in the book )
Its too difficult for me now in the learning process to understand the procedure.

So I deliberately tried to avoid using a procedure!!

It is pretty simple to modify my original worksheet to produce a pretty straightforward procedure with no "bells and whistles".

See the attached

  myRS:= proc(f, a, b, N, meth)
              local p0:= plot(f, a..b),
                    X:= Array(0..N, [seq(j, j=a..b, (b-a)/N)]),
                    Y:= Array(0..N, f~(X)),
                    Ymid:=f~(X+~(b-a)/(2*N)),
                    stair,
                    str:=cat( "Approximate integral using ",
                              meth,
                              " values is %1"
                            ),
                    ans:
              uses plots:
              if   meth = left
              then ans:= evalf((b-a)/N*add(Y[0..N-1])):
                   stair:= plot( [ [ a, 0 ],
                                   [ X[0] ,Y[0] ],
                                   seq
                                   ( [ [ X[i+1], Y[i]   ],
                                       [ X[i+1], Y[i+1] ]
                                     ][],
                                     i=0..N-1
                                   ),
                                   [ b,0 ]
                                 ]
                               ):
              elif meth = right
              then ans:= evalf((b-a)/N*add(Y[1..N])):
                   stair:= plot( [ [ a,0 ],
                                    seq
                                    ( [ [ X[i],   Y[i+1] ],
                                        [ X[i+1], Y[i+1] ]
                                      ][],
                                      i=0..N-1
                                    ),
                                    [ X[N], Y[N] ],
                                    [ b, 0 ]
                                  ]
                                ):
              elif meth=midpoint
              then ans:= evalf((b-a)/N*add(Ymid[0..N-1]));
                   stair:= plot( [ [ a, 0 ],
                                   [ X[0] ,Ymid[0] ],
                                   seq
                                   ( [ [ X[i+1], Ymid[i]   ],
                                       [ X[i+1], Ymid[i+1] ]
                                     ][],
                                     i=0..N-1
                                   ),
                                   [ b,0 ]
                                 ]
                               ):
              fi;
              return display( [ p0, stair ],
                                color= [red, black],
                                axes= none,
                                caption= typeset
                                         ( str,
                                           ans
                                         ),
                                captionfont= [times, bold, 20]
                            );
         end proc:

#
# A few examples of usage
#
  myRS(x->1+x^sin(x), 1, 5, 30, left);
  myRS(x->1+x^sin(x), 1, 5, 30, right);
  myRS(x->1+x^sin(x), 1, 5, 30, midpoint);
  myRS(x->1+sin(10*x)*sin(x), 0, 2, 20, left);
  myRS(x->1+sin(10*x)*sin(x), 0, 2, 20, right);
  myRS(x->1+sin(10*x)*sin(x), 0, 2, 20, midpoint);

 

 

 

 

 

 

#
# Using Maple's in-built commands for the same
# calculation.
#
  with( Student[Calculus1]):
  RiemannSum( 1+sin(10*x)*sin(x),
              x=0..2,
              partition=20,
              method='midpoint',
              output=plot
            );

 

 


 

Download rsum2.mw

2 3 4 5 6 7 8 Last Page 4 of 161