Carl Love

Carl Love

28020 Reputation

25 Badges

12 years, 301 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

You mentioned "matrix" twice---in the title and in the body of your Question. Yet I see no matrix, only a vector. What do you consider the matrix?

@tomleslie So why don't you move it to the other thread?

According to the help page ?ifactor, there are 5 algorithms that can be used for difficult numbers (after the easy methods have been exhausted). These are

mpqs     - Multiple Polynomial Quadratic Sieve method
morrbril - Morrison and Brillhart's continued fraction method
squfof    - Shanks' undocumented square-free factorization
pollard   - Pollard's rho method
lenstra   - Lenstra's elliptic curve method

Or perhaps there's an undocumented multi-core method. There are 30 procedures whose names begin `ifactor/...` in the Maple 2021 library.
 

@mmcdara The replacement for convert(..., listlist) is convert(..., list, nested). It works for rtables of any number of dimensions.

Here is a correction to the bug of the blue exclamation points:

`print/%factorial`:= n-> 
    subs(
        "!"= ("!", mathcolor= "#909090"),
        InertForm:-Typeset(%factorial(n))
    )
:

I incorporated this into the code in my Reply that generates the matrix in the Question. I don't know whether this'll work with InertForm:-Display because I did it all via more primitive methods, i.e., `print/...procedures and Typesetting markups.

@acer I did notice that quirk: the blue exclamation points that should be gray. I chose not to mention it because it's a superficial bug (i.e., doesn't really change how the computation is done), so mentioning it would seem to me to be a cluttering and ephermal detail in an Answer that's already quite complicated and intended not to be ephemeral.

I just added another coded example to my Reply to my Answer which you may not have read.

Here is a coded example showing some of the things described in the above Answer. The end result is a solution to the specific example in your Question.

Download InertFactorial.mw

Here is the code. Download the worksheet and/or execute the code to see the output. [Edit: I updated this code to correct the blue exclamation points. This simply required adding the short procedure `print/%factorial`.]

restart
:
#A syntax-checking inert procedure
`%!`:= (N::list(algebraic), D::list(algebraic))-> 
    'procname'(args) #return unevaluated
:
#The evaluation procedure
`value/%!`:= (N,D)-> mul(N!~)/mul(D!~)
:
#The display procedure. This is invoked automatically when the inert
#form is displayed prettyprinted.
`print/%!`:= (N,D)-> 
    `%*`(%factorial~(N)[]) %/ `%*`(%factorial~(D)[])
:
#Another display procedure to make ! gray:
`print/%factorial`:= n-> 
    subs(
        "!"= ("!", mathcolor= "#909090"),
        InertForm:-Typeset(%factorial(n))
    )
:

#Examples:
e:= `%!`([3,5,7], [4,6]);
lprint(e);
value(e);
#The specific example from your Question:
M:= Matrix((5,5), (m,n)-> `%!`([2*m+3*n-5], [m+2*n-2, m-1, n-1]));
value(M);


And the following code uses some features not described in my Answer:

You were attempting to use NoSimpl. This cannot be used as a function; it needs to be used with the use command, and it overloads infix operators. See the help pages ?InertForm,NoSimpl and ?use. Unfortunately, the syntax is unusual. Here's one way to do it:

restart
:
`%!`:= %factorial: #simply for abbreviation, not the same as the previous example
NS:= InertForm:-NoSimpl: #simply for abbreviation
use NS:-`*`, NS:-`/` in #Just overload those two operators
    M:= Matrix(
        (5,5), 
        (m,n)-> 
            `%!`(:-`*`(2,m) + :-`*`(3,n) - 5) /
            (`%!`(m + :-`*`(2,n) - 2)*`%!`(m-1)*`%!`(n-1))
    )
end use;
value(%);


Note that :-`*` refers to the ordinary (i.e., non-overloaded) multiplication. Unfortunately, the use of quotes is necessary, and thus it must be used in prefix functional form rather than as an infix operator.

I only showed the above to show you correct usage of NoSimpl. The above is not worth doing, and I strongly prefer @acer 's coding of your example. I haven't corrected the blue exclamation points in this code because it's significantly more difficult to do here, and it's not worth elaborating on the NoSimpl approach anyway.

@Sradharam I've attached your worksheet to your original Question (above) and deleted your new Question. We try to keep all the material related to one problem in a single thread.

I vaguely remember something like that in Windows from about 15-20 years ago. Are you using the latest version of Windows Defender? 

Anyway, please post a screen shot of the dialog where it asks you for a "code integrity policy file". Someone here or at Maplesoft Customer Support may be able to tell you the file name to use 

@Carl Love 

I found a very simple worksheet that I can upload (with both Firefox and Chrome). How strange. Tom's Replies show that the complexity of the worksheet cannot be the whole issue since he can display a worksheet that I cannot display---the exact same worksheet.
 

1. Any number can be used as an operator that returns that number:

2.5(x);

2.5

(1)

2(x);

2

(2)

2. Operators can be combined with symbol operators to form new operators:

SetTo0:= lhs-rhs = 0:

SetTo0(x^2 = y^2);

x^2-y^2 = 0

(3)

(lhs-rhs = 0)(x^2 = y^2);

x^2-y^2 = 0

(4)

3. An operator can be used as the first argument to fsolve. This tells fsolve to search for an argument for that operator which would make the operator return 0, or close to it.

fsolve(sin, -1..1);

0.

(5)

fsolve(sin, 3..4);

3.141592654

(6)

fsolve(sin-1, 1..2);

1.570796327

(7)

 


 

Download Operators.mw

@tomleslie Thank you for checking that, Tom.

I just downloaded Firefox. I explicitly checked boxes during the installation to not set anything and to not import anything. I'm using it right now... and...

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/PiecewiseMerge.mw .

Download PiecewiseMerge.mw

@subzero You wrote:

  • The result is assigned to a variable and supressed by (:)

Very glad to hear it.

  • The memory usage is now 30%,

It would perhaps be useful to estimate the rate of memory increase. However, many computations reach their peak memory usage long before they are finished.

  • the CPU keeps fluctuating between 10% and 99% in short intervals

This mostly depends on the number of cores in use at the time that you're looking. I'd guess that the 10% is 1 core, and the 99% is all of them.

  •  I guess the CPU usage is what to worry about here!?

Yes, and what you've described so far is totally normal. If you stop seeing that fluctuation, then you should worry.

  • Does Maple make use of multiple cores?

Yes, it's always used for the garbage collection (gc) (which should likely be more properly called memory recycling). Whenever the Time value on the status bar changes, there's just been a gc. That likely accounts for the 99% CPU utilization that you're seeing. The decision to do a gc is based on the quantity of garbage (memory that has been used but that no longer has any current variables pointing to it); it's not based on the time (either real or CPU) since the last gc.

There's a good chance that multiple cores are not used for the computation itself. Most broad-scale algorithms (such as symbolic solutions of equations) are not suitable for parallel processing, and those that are must be very carefully coded to make use of it. Many numeric algorithms are more suited to it.

The problem that you described---a system of 5 order-3 PDEs---sounds immensely complicated to me; I wouldn't be surprised at all if obtaining a symbolic solution would take months of computation. Nor would I be surprised at all if you obtained a solution with RootOfs and integrals so deeply nested that there's no practical way to make use of the result. And you said that they're "overdetermined". I don't have any experience with that. I hope that a pdsolve expert can jump into this conversion and give an opinion on its ability to handle that. You should experiment with a small overdetermined system (I guess two equations in one dependent variable) with a known solution to see how pdsolve reacts to it.

Before I undertake any large computation, I do experiments with quantifiably smaller related problems that are quantified with hueristic metrics that can also be applied to the larger problem. I measure the time and memory usage for the smaller problem and then use statistical extrapolation to predict the time and memory usage for the large problem.

@subzero I don't know whether you'll eventually get a result. The answers that you gave suggest (but don't prove) that it's still doing useful computations. If you choose to let it keep running, keep an eye on the memory usage in Task Manager. If it gets to about 90% of your total, it's hopeless and you should kill it. If the Time stops going up or if that octagon turns gray, let me know. Don't worry about whether the Memory number changes as long as that Time number keeps going up.

Unfortunately, the results could be NULL, and I believe (not sure) that that could mean either that there is no solution or simply that Maple couldn't find the solution.

You should never start any Maple computation in the Standard GUI that can potentially display a lengthy result without doing the following:

  • The command should assign its result to a variable;
  • The command should suppress its display by ending with a colon (:).

If fail to do this, there's a good chance that if the computation finishes, the GUI will be unable to format the result for display in any reasonable amount of time. This is very unfortunate because it means that you'll not see that result and you'll need to kill your entire Maple session (not just kill the computation kernel) from Task Manager (without being able to save any worksheets!). If that octagon turns gray and Maple isn't responding, that's what's happening. To my mind, this is the most serious design flaw of the Standard GUI because there's no way to save those worksheets. It's hard to believe that they haven't addressed this common and crippling problem after so many years.

@Carl Love Here is a test using Microsoft Edge instead of Google Chrome:

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/PiecewiseMerge.mw .
 

Download PiecewiseMerge.mw

Another (this one is extremely simple):

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/prove.mw .
 

Download prove.mw

The Microsoft Edge is fresh-out-of-the-box, never-been-used, and I didn't import anything from any other browser.

I've seen and read here (other recent threads on MaplePrimes) that the long-standing problem of displaying worksheets inline on MaplePrimes has recently been somewhat "fixed". However, as I reported in the Question above My worksheet-displaying problem is much older than that of other MaplePrimes correspondents and It's absolute, not intermittent: I can't display any worksheet at all, no matter how simple. And now I report that It still doesn't work for me. I use Windows 10 and Google Chrome (always the latest version). I'm not using any unusual settings in Windows, Chrome, or Maple: I think that the only non-default setting in my Chrome is that I never delete history. I use two different computers with that setup, and I have this problem on both.

First 123 124 125 126 127 128 129 Last Page 125 of 708