acer

32348 Reputation

29 Badges

19 years, 330 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Samir Khan It's very likely that his point 1) is problematic because he just typed `feet` and `inch` as regular names rather than as units. Otherwise his claim that calling simplify(w) "produces 10*feet+6*inch" would not have attained. In this case your suggestion to load Units:-Simple would not help.

Why are you posting yet another duplicate of the very recent question (by member NorwegianStudent) about doing just this??

You already asked yet another duplicate, about how to do just the first part of NorwegianStudent's question. (Then you pasted _Maxim_'s answer to that into the earlier thread, claiming you got "some" help which is a very inadequate attribution IMO.)

 

 

@mapleatha Uploading a worksheet/document containing your problematic example is often very useful. Why not do It?! Big Green Arrow in the Mapleprimes editor.

@mapleatha As has been explained to you by some other people, a formulation like A=B=C in the way that you mean it mathematically is not a valid Maple construct.

The mechanisms I've shown you last above are merely pretty-printing mechanisms. The do not produce expressions that you can use for computation because their return values cannot be Maple constructs that match your hoped-for mathematical interpretation (at least, not without further coding to effect such interpreting).

 

@mapleatha Here is another approach to dealing with your earlier Question about printing A=B=C.

When you first started asking I wasn't sure whether you wanted only an effect on pretty-printing of 2D output, or also a similar look to 2D input. Now it seems more clear that you may be satisfied by just an effect on output, which makes it easier to implement.

Note the there are two procedures defined in the Startup Code Region of this attachment. Without those defined you won't get the effect.

 

The procedures EQ and `print/Determinant` are defined in the Startup Code Region of this worksheet.

If you want these effects in another Worksheet or Document then you willl have to copy those definitions into their respective Startup Code Regions (or use and initialization file, or store the procs in a new .mla archive in libname).

 

M:=<-3,-4;-3,-2>;

M := Matrix(2, 2, {(1, 1) = -3, (1, 2) = -4, (2, 1) = -3, (2, 2) = -2})

'LinearAlgebra:-Determinant(M)' = LinearAlgebra:-Determinant(M);

LinearAlgebra[Determinant](Matrix(2, 2, {(1, 1) = -3, (1, 2) = -4, (2, 1) = -3, (2, 2) = -2})) = -6

EQ(A, B, C);

A = B and B = C

EQ(A, B, M, C, M, C, B, A);

A = B and B = (Matrix(2, 2, {(1, 1) = -3, (1, 2) = -4, (2, 1) = -3, (2, 2) = -2})) and (Matrix(2, 2, {(1, 1) = -3, (1, 2) = -4, (2, 1) = -3, (2, 2) = -2})) = C and C = (Matrix(2, 2, {(1, 1) = -3, (1, 2) = -4, (2, 1) = -3, (2, 2) = -2})) and (Matrix(2, 2, {(1, 1) = -3, (1, 2) = -4, (2, 1) = -3, (2, 2) = -2})) = C and C = B and B = A

EQ('LinearAlgebra:-Determinant(M)', LinearAlgebra:-Determinant(M) );

LinearAlgebra[Determinant](Matrix(2, 2, {(1, 1) = -3, (1, 2) = -4, (2, 1) = -3, (2, 2) = -2})) = -6

EQ(''LinearAlgebra:-Determinant''(M),
   'LinearAlgebra:-Determinant(M)',
   LinearAlgebra:-Determinant(M) );

('LinearAlgebra:-Determinant')(Matrix(2, 2, {(1, 1) = -3, (1, 2) = -4, (2, 1) = -3, (2, 2) = -2})) = LinearAlgebra[Determinant](Matrix(2, 2, {(1, 1) = -3, (1, 2) = -4, (2, 1) = -3, (2, 2) = -2})) and LinearAlgebra[Determinant](Matrix(2, 2, {(1, 1) = -3, (1, 2) = -4, (2, 1) = -3, (2, 2) = -2})) = -6

T:=M-lambda*LinearAlgebra:-IdentityMatrix(2):

EQ( 'LinearAlgebra:-Determinant(T)',
    sort(LinearAlgebra:-Determinant(T)),
    0 );

LinearAlgebra[Determinant](Matrix(2, 2, {(1, 1) = -3-lambda, (1, 2) = -4, (2, 1) = -3, (2, 2) = -2-lambda})) = lambda^2+5*lambda-6 and lambda^2+5*lambda-6 = 0

 


Download typesetdeteq.mw

@mapleatha 

First level right-click popup menu's item is "2-D Math". (This seems to be what you've missed.)

That item leads to a secondary submenu popup with an item "Convert To".

That item leads to a tertiary submenu popup with an item "Atomic Identifier.

 

@AmusingYeti I believe that the ability to return memory to the OS upon garbage collection came with Maple 17, building upon the major overhaul of the memory management system seen in Maple 16.

The help page for topic updates,Maple16,memorymanagement which gives some details of the initial changes. The help pages for topic updates,Maple17,MemoryRegions describes the subsequent changes to allow allocation and management of separate memory heaps (including the ability to return larger cleared blocks to the OS).

Here is an example, run in Maple 2017.3 using 64bit Linux and the Standard GUI. (Note that the command kernelopts(heaps) was new to Maple 17.)

restart;

kernelopts(heaps);

_rtable[18446884572585271294]

kernelopts(bytesalloc);

8781824

M:=Matrix(4000,datatype=float[8]):

kernelopts(heaps);

_rtable[18446884572585273214]

kernelopts(bytesalloc);

170340352

M:='M': # unassign
a: b: c: # clear %,%%,%%%

gc(); # no reference to the Matrix should persist

kernelopts(heaps);

_rtable[18446884572585271414]

kernelopts(bytesalloc);

42336256

 


Download heaps.mw

The other notable aspects of the memory management overhaul include the ability to do garbage collection of disparate chunks in parallel, and the improvement to garbage collection during external calls (think of LinearAlgebra with sfloats in external compiled functions).

@Arcas Gabriel 

It looks like you have an extra blank space between the minimize and the opening round bracket that follows it.

If you are using the (default) of 2D Math input mode then you should remove that space.

In 2D Input the space indicates implicit multiplication, but what you want is function-application (ie. the command minimize applied to what's inside the round brackets).

Also, let me repeat: the syntax,
  with simplex
is invalid and wrong. It should be,
  with(simplex);

 

 

Sometimes it's useful to take a step back and consider the larger context. (I cannot tell whether the following is applicable in your code...)

Does your other code rely on utilizing all or most of the S_||n at any given time? If not, and if your general process can be looped so that only a subset of the ten S_||n are ever needed at any one time, then you may not need to create them all together, up front.

In such a situation you could create the smaller subset only as needed:
  - You could try unassigning the earlier one's (and successfully forcing gc which can be tricky), so that allocated memory is re-used for the new one(s).
  - Even better you might use the 4th calling sequence described here, where out is a container rtable to be populated. The container could be one of the earlier S_||n rtables/Vectors. In this way you could, each time through the loop, repopulate a fixed, smaller number of S_||n with new random data, without having to worry about the "old ones" being garbage-collected.

 

Just a note regarding the numeric quadrature.

Using Maple 2017.3 on 64bit Linux,

restart; # splitting as described
evalf(IntegrationTools:-Split(Int(1/((1-1/4*t^2)*sqrt(1-t^2)*sqrt(1-4*t^2)),
                                  t = 0 .. 3/2),[1/2,1]));
                                                0.1560547979 - 1.261993176 I

restart;
evalf(Int(evalc((1/((1-1/4*t^2)*sqrt(1-t^2)*sqrt(1-4*t^2)))),
          t = 0 .. 3/2));
                                                0.1560547979 - 1.261993176 I

restart;
evalf(Int(1/((1-1/4*t^2)*sqrt(1-t^2)*sqrt(1-4*t^2)),
          t = 1 .. 2-10^(-7), digits = 20, epsilon=1.0e-19));
                                                   -3.1645980460317541096

restart;
evalf(Int(1/((1-1/4*t^2)*sqrt(1-t^2)*sqrt(1-4*t^2)),
          t = 1 .. 2-10^(-7), digits = 20, epsilon=0.99e-19)); # returns unevaluated
The second to last one above succeeds in Maple 16.02 with epsilon=2.0e-19 but not with epsilon=1.0e-19.

As you may have realized  It is unlikely someone can accurately diagnose and answer your Question 1) without more details. I would stress that complete worksheet and code/data to reproduce the issues are key.

Please add details as Comment to this thread. Please do not duplicate with a completely new Question thread.

Or, for a black and smaller center-dot,

InertForm:-Display( `%.`(A,B), 'inert'=false ) = A.B;

@hpc As I mentioned, the source ffor EmbedAnim resides in the Startup Code Region of the worksheet that I attached.

So that's why it works in the worksheet that I attached. The Maple GUI runs the startup code (if allowed), and that defines EmbedAnim.

Your pasted image shows that EmbedAnim returned unevaluated, which means that in that session EmbedAnim is simply not defined. Your output is just an unevaluated function call to an undefined name.

If you want to run EmbedAnim in some other worksheet/document then you'd have to either 1) copy that source for EmbedAnim into your new worksheet (in its own Startup Code Region, say), or 2) Use LibraryTools to Create a .mla archive and Save it to that, and then put the .mla to some place specified by libname.

Since doing all that is a bother (or difficult for a new user) I mentioned that I could put it into a "package" that Maple 2017 could install straight from the Maple Cloud. Then it would always be directly available.

@_Maxim_ The Question is marked as "Maple 2015", and in that older version Explore was not as capable about evaluating references to assigned names.

This variant seems to work in Maple 2015.

rat_2015.mw

It seems like what you're really trying to do is write a procedure which implements multivariate Newton's method, which you could then export to C++.

You are not going to be able to do that using any call to fsolve. The CodeGeneration mechanisms will not translate that. You have to write the implementation of Newton's method explicitly.

Please stop posting duplicates of this question.

First 269 270 271 272 273 274 275 Last Page 271 of 592