Carl Love

Carl Love

28070 Reputation

25 Badges

13 years, 29 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

What is the subexpression int(U(x,z), x, z) supposed to mean? What are the limits of integration? Numerical integration without limits is not "a thing". And what is a?

@Stretto What part of 

  • This is just an info-gathering experiment; I'm not claiming that this [restart] will or won't solve your blank-line problem!

don't you understand?

You wrote:

  • It doesn't matter about restart: I always put it at the top so I can easily clear stuff if need be but it is ultimately irrelevant to the problem.

How could you possibly know whether the information that I get by you simply answering my diagnostic questions about what happens when you do restart is relevant or not? 
 

Now, go to menu Tools => Options => Display. The 4th checkbox from the bottom is "Always insert new execution group after executing". Is that box checked? If it is checked, uncheck it, and see how that affects your blank-line problem. Also, tell me the result that you get from the commands

interface(echo); interface(prompt);

@Agha So why haven't you responded to my Answer, which gets you the 2.5 that you want? 

@Stretto You wrote:

  • I was using this
        global _Hist
        _Hist := [N, op(_Hist[1..-2])];

I'm impressed. Yesterday I wrote a caching application that does just that. It's a tiny bit more efficient (for a small cache) than those list operations and much more efficient for a large cache, and, of course, more robust than using globals. It's on another computer. I'll post it in a few hours, after my wife wakes up (the computer is on the bed).

I know that you're a fan of terse syntax, as am I. So, the code op(_Hist[1..-2]) can replaced by _Hist[..-2][]

  • What you say about option remember, system; Generally how often? Every time memory or numbers , change?

Yes, every time that you see those numbers change, there has been a garbage collection (gc()).

  • They change all the time when I do any computation, this may be a bit excessive if it is constantly collecting.

The frequency is based on the amount of garbage waiting to be collected; it isn't time based. So, you must be generating a lot. The algorithm is AFAIK highly optimized, and it helps that it runs in parallel threads (generally 4 threads--but you can set it). Go to ?kernelopts and read about the eight gc options (but gcfreq does nothing at all in Maple 2019). 

@Kitonum See help page ?QuaNtile (not ?QuaRtile). It documents the eight interpolation method options that can be used with either command.

@Stretto The reason that I asked about restart is because your maple.ini is executed whenever you do a restart, as well as when you start a new worksheet or open an old one. So, is there any difference in your blank line situation between using restart: and restart; ?

I suppose that you already know to suppress the output inside the maple.ini with colons. But colons don't suppress explicit output statements print, printf, lprint, userinfo, etc.

@Ali2020 All these seemingly weird syntax innovations work in Maple 2019 if you use the input style Maple Input (also commonly called 1-D input). This is the style where the input characters are in a monospaced reddish-brown upright bold font (as shown in my code box).

Short        Equivalent longer 
syntax      syntax                           When added (approx.)
----------------------------------------------------------------------------------------------
y::odd                 type(y, odd)     has been valid for decades
s+= x                   s:= s+x           new to Maple 2019
--y                        y:= y-1            new to Maple 2019
x*= 2                    x:= x*2           new to Maple 2019
y/= 2                     y:= y/2           new to Maple 2019
(x,y):= (1,2)          x:= 1; y:= 2;    has been valid for 15 years or so

But there's one feature that I used that has no current equivalent in 2D Input, and it's a profound, game-changing improvement to Maple coding that saves much coding time and much computation time. That is, a looping command (such as while) can be used as an expression rather than as a statement. When this is done, the expression returned is the sequence of the evaluated final expressions in the loop. This allows for the efficient creation of sequences that cannot be created with seq.

I've spent many coding hours over the years converting inefficient loops (inefficient because of the immutable-container issue described in the Answer) into more-efficient forms, such as seq. That's no longer necessary! Hoorah for Maple!
 

Since the singularity of sec (or tan) at Pi/2 is not integrable, you have a problem with this particular example. However, if the integration is possible, then summing an arbitrary number of them is quite easy, and I'll show it in an Answer.

I edited the title of your Question. Please don't try to fit your entire Question into the title box!

@mmcdara I don't see any theoretical difficulty for a CAS to correctly handle the arithmetic of infinity. For Maple, for the bugs that you showed, it'd be a matter of suppressing some automatic simplification. Many such things have been improved with automatic simplification over the years. For example, times a Matrix returns a zero Matrix rather than plain 0. So, I wouldn't be surprised if there was already a CAS where one did not need to be very careful regarding infinity.

However, note that automatic simplification is an essential part of Maple's efficiency. It's quicker to process expressions if the rule is simply "explicit A - A = 0, always".

In addition to being new to Maple 2019, most of its new syntax features only work in 1-D input (aka Maple Input).

@Stretto What happens in your session if you use 

restart:

that is, the output of the restart is suppressed with a colon? (This is just an info-gathering experiment; I'm not claiming that this will or won't solve your blank-line problem!)

 

@Stretto You wrote:

  •  I did look in to memoization but I felt it wouldn't work well since I imagine it would try to remember everything....

It's only used for the specific procedures to which it's applied, not everything.
 

There are two procedure options for limiting the memory used by memoization. The first is 

option remember, system;

With this option, the procedure's remember table is cleared whenever there's a garbage collection. (Whenever you see the memory or time numbers on the status bar change, there's been a garbage collection.)

The second is 

option cache;

A cache is a remember table with a limited number of entries. Once the limit is reached, each new entry causes the removal of the least recently used entry. The default number of entries is 512. That can be changed to some other value, for example, 1024, by

option cache(1024);​​​​​​

Once a procedure has option cache or remember (with or without system), it automatically remembers previously computed values; no explicit assignments are needed, although they are allowed (and often useful).

The command forget can be used to dump remember tables.

Procedures which are local to other procedures can also have remember tables. These will get garbage collected just like any other local.

The statements 'x' = x: and the following with cannot possibly do anything useful, not even display any useful information. I'm wondering what your intention was with those. 

@Carl Love Here are some example solutions under the second pedagogical model that I gave above.
 

Question 1

restart:

v:= t-> t^3-t^2-4*t+4:
maximize(v(t), t= 0..2);

4

Question 2: (ambiguous question)
Answer 1: Net distance:

int(v(t), t= 0..4);

80/3

Answer 2: Total distance:

int(abs(v(t)), t= 0..4);

167/6

Question 3:

restart:

y1:= 5:  y2:= 2*x^2:
int(abs(y1-y2), x= `..`(solve(y1=y2, x)));

(10/3)*10^(1/2)

Question 4:

restart:

y:= 4:
int(Pi*y^2, x= 0..3);

48*Pi

 


 

Download Answers1.mw

If your main interest is the number of partitions of a number rather than the partitions themselves, then this Wikipedia page is more relevant: https://en.wikipedia.org/wiki/Partition_function_(number_theory) It's where I got the recursive formula in my Answer below.

First 225 226 227 228 229 230 231 Last Page 227 of 709