Carl Love

Carl Love

28025 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

Could you give some more details please? In general, a permutation may have several disjoint orbits.

@David Sycamore 

1. Adaption to counting up to a given ordinal of prime: Yes, this just requires a small modification to my procedure. Here is it is:

k1k2:= proc(N::posint, a::posint:= 10, b::posint:= 1)
local K1, K2, p:= 1, i, k1:= 0, k2:= 0;
    for i to N do
        p:= nextprime(p);
        if isprime(a*p+b) then 
            k2:= k2+1; K2[p]:= k2
        else 
            k1:= k1+1; K1[p]:= k1
        fi
    od;
    K1, K2
end proc
:
(K1,K2):= CodeTools:-Usage(k1k2(10^6)):
memory used=5.51GiB, alloc change=80.00MiB, 
cpu time=31.98s, real time=31.27s, gc time=2.34s

2. The straight-lines anomaly: Note that Kitonum's first plot is implicitly logarithmically scaled along its horizontal axis simply due to the way his procedure works. My plot is linearly scaled on both axes. To my mind, this completely explains the anomaly.

3. Doing it without a procedure: It can be done, but I think that pedagogically it's both the wrong thing to do and the wrong thing for me to show you how to do.

@janhardo I think that Acer's point is that you should in general "chance it" by accepting the default values for a first try. Then only start setting options if the first try produces an unacceptable plot. I'd apply this principle especially to the computational options, such as gridgridrefinenumpoints.

@nm For what it's worth, I can't figure out any way to have type assertion checking automatically done for assignments to globals, as can be done easily for locals.

That was the gist of your deleted Question. Personally, I don't see where you've also asked that in this thread. 

I very often see Questions deleted by Moderators on StackExchange sites. I think 4 Moderators need to flag it before it's deleted. I hate it when this happens after I've Answered the Question.

There is definitely a need on this site for Moderators to control duplicate Questions. I usually agree with Acer's deletion decisions, and I delete numerous duplicates myself. But I don't agree with him on this one. I don't recall any situation where you, nm, has posted what I'd consider to be a duplicate Question. Indeed, from what I've seen, you've always acted here with a high degree of respect and honor. 

@nm Again, why do you use has when `=` will do the job? `=` is much faster and more to the point.

One drawback to using a mutable structure such as a Record or table for a procedure's input is that the procedure will obtain no benefit from a remember table.

@Carl Love You can declare types for a Record's fields when you define the Record:

A:= Record('x'::integer= 1);

Then if you've correctly set assertlevel to 2, an attempt to assign the wrong type to x will give an error.

@nm You can define any type whatsoever and give it a simple name with TypeTools:-AddType.

A type match can be made against any subset of the fields, so each procedure should only check for the fields that it uses.

There is no difference between using the single or double quotes when defining the record's fields. But when you're accessing the fields, you can't use the double quotes, nor would any quoting be needed if you use :-

@Carl Love The output of my procedure k1k2 can be efficiently counted into ranges with the command Statistics:-TallyInto:

Statistics:-TallyInto([indices](K1, nolist), [seq(1..10^k, k= 1..7)]);
  [                                                   
  [1. .. 10. = 2, 1. .. 100. = 18, 1. .. 1000. = 131, 

                                         5         
    1. .. 10000. = 1021, 1. .. 1.00000 10  = 8240, 

                     6                            7         ]
    1. .. 1.000000 10  = 69231, 1. .. 1.0000000 10  = 596908]


Statistics:-TallyInto([indices](K2, nolist), [seq(1..10^k, k= 1..7)]);
   [                                                 
   [1. .. 10. = 2, 1. .. 100. = 7, 1. .. 1000. = 37, 

                                         5         
     1. .. 10000. = 208, 1. .. 1.00000 10  = 1352, 

                      6                           7        ]
     1. .. 1.000000 10  = 9267, 1. .. 1.0000000 10  = 67671]


 

@nm Unlike the map and map2 commands, the ~ only maps over lists, sets, tables, and rtables. Other arguments are passed as they are. In this example, A is the only thing that's a list, set, etc.

@acer It was only for pedagogical reasons that I didn't give the "whole story" on implicitplot and grid. I hope it was the right decision.

Yes, the OP does seem resistant, perhaps because they have a textbook which deviates a bit from what we say.

@janhardo Here on MaplePrimes, you have access to the best Maple educators in the world, by far. If what we say seems to deviate from your book, there are three likely (and interconnected) reasons:

  1. We feel that the book's pedagogy is flawed: An example would be the binom procedure that returned its results through an argument rather than directly.
  2. We feel that aspects of Maple that didn't exist at the time that the book was written are easier to learn: An example would be Array(1..3, 1..5, (i,j)-> i^j) rather than filling the Array with loops.
  3. We feel that it's a waste of time to learn archaic or deprecated techniques, such as array (lowercase).

Remember that we want to help you learn Maple. We will guide you through the pedagogical pitfalls of this book, so please trust us if we say that it's not worth doing something a particular way that your book suggests.

@janhardo I have visited DesCartes's house in Leiden, Netherlands. It did not seem to be open to the public. I don't know about a house in Amsterdam also. I've visted Amsterdam twice. My younger stepdaughter is a physical therapist there, and she's even learned Dutch fluently.

@acer Thanks for spotting that, and I've corrected it.

@Scot Gould I've lost sight of the main point of debate here. I thought that you were arguing that Maple had an "inconsistency" that led to a pedagogical flaw. Yet the example that you showed shows Maple working perfectly (in a pedagogical sense also). And, you can do that in both the top-down and bottom-up modes. If you were indeed arguing that there was a pedagogical flaw, then I want you to give an example that highlights that flaw.

You wrote:

  • [C]ould not one devise a system, for which space is allocated, but all evaluation is performed numerically at the last step?

I guess you mean essentially this: Is it possible to write a symbolic system (such as Maple) in a non-symbolic language (such as C, C++, etc.)? Yes, of course it's possible since Maple itself is an example of that. But I think that your conception of what's involved is overly simplistic. If the variables don't have numeric values, you have to internally handle all the algebraic manipulations. You need to put expressions in "normal forms" so that equality can be recognized.

  • If understand the statement in Maple, can you provide an example of a language they are referring to?

Almost all languages in widespread use before 1986 (such as C, C++, Fortran, Pascal, BASIC, Algol, COBOL) have no built-in support for symbolic variables. In those languages, the bottom-up evaluation style must be used.

You specifically mentioned Matlab and Python. As far as I'm aware, both of those languages have some support for symbolic variables. In Matlab, they're call "symms" (I believe). In Python, there's a package sympy. 

@J F Ogilvie The first of your three examples can be done like this:

inttrans:-fourier(
    convert(exp(-a*abs(x))/sqrt(abs(x)), Heaviside), 
    x, s
) assuming a>0;

For the other two examples, I can't get Maple to fully expand them, even by direct integration. But neither are the results incorrect, as was suggested by your original Question. It may be possible to include these in Maple's "known" fourier transforms by using the inttrans:-addtable command.

First 191 192 193 194 195 196 197 Last Page 193 of 708