Carl Love

Carl Love

28035 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Adam Ledger Adam, you are confusing the limit of a sequence being infinity (or some might call it its divergence to infinity) with its limit superior being infinity. Consider the sequence

f:= n-> piecewise(n::even, 0, n::odd, n);

This sequence is a canonical example of what you call "oscillating from infinity to 0 an infinite number of times." Its limit superior is infinity, but its limit per se does not exist.

Here's a rigorous definition for the limit superior of a real-valued sequence a(n) being infinity: For all M in N there exists n in N such that a(n) > M. Compare with a rigorous definition of its limit being infinity: For all M in N there exists m in N such that for all n in N[m..], a(n) > M (where N[m..] is the set of natural numbers greater than m).

In the original problem, don't let the weirdness of the constant log10(Pi) distract you. All that matters is that log10(Pi) < 1/2. This is a case where a more-general proposition may be easier to prove:

  • Proposition: Let a and b be any real constants with a > b, and let f:= (k::posint)-> floor(a*(k-1)) - floor(b*k). Then for all n in Z, {k in N | f(k) = n} is finite.

@Kitonum D(x):= ... assigns a value to the remember table of existing library procedure D (without error or warning).

@laurent Thanks, Laurent. I should've also mentioned that an assuming clause is usually a better alternative to assume(...when one wants a temporary assumption. 

@David Sycamore All of the { } that appear in Tom's post are erroneous. I guess that they're just typos, because I'm sure that he knows better. You can bracket an explicit list of values with square brackets [ ] or angle brackets < >. (If you use angle brackets, you'll create what Maple calls a Vector. It's not important to understand the distinction between a list and a Vector at this point; either will work fine in this case. If you use curly braces { }, you'll create what Maple calls a set. That's not good in this case because you can't control the order that items appear in a set.)

Once your list of x values has been entered, there are numerous ways to apply f to each of them. Do you have the code of the procedure f? Is it already in a script or Maple worksheet? Does it take a single argument (the xs in this case)?

@Annonymouse Thanks, the notifications are no problem.

The nops simply counts the number of entries in a list or set. Since that's what you wanted to plot, it must be used. I was not trying to address any memory issues. Are the lists produced by the (7,7) case very large? It may be that it's not possible to simultaneously maintain all the lists in memory at once. You'd need to post the code that gives the memory error for me to figure out more.

@David Sycamore You asked:

  • The data does not exist yet in Maple, I have yet to learn how to do that. Can I incorporate it into the script or must it be a separate file?

You can type it directly into the script. That is the easiest thing to do. Previous suggestions, such as ImportMatrix, were based on the supposition that your data were already in some file, separate from Maple. You can type it into the script numerous ways. I think that the easiest is

MyData:= <
      3,          37; #You can put comments at the ends of lines.
     #You can put comments between lines.
      5,          94;
     
... etc ...
     199,       307  >:

Maple doesn't care about the spacing or line breaks; they're just used for clarity. However, it does care about the punctuation.
     

  

Lest there be any confusion about it, I must point out that this is not a Maple-specific problem; it affects floating-point computation in all languages. At least Maple offers a few ways to fix the problem, albeit ad hoc: symbolic simplification/conversion or increased precision.

@David Sycamore I'm sorry if this seems too obvious to even say, but I don't know what else to advise: Why don't you simply type the numbers into a Maple worksheet?

@David Sycamore Now you're confusing me because you're making the problem sound completely different than in your original Question. So, do you or do you not currently have a file (independent of Maple) containing some numbers that you want to do computations with in Maple?

From the rest of your description of the problem, I'd think that you could easily generate all the data within Maple itself, unless these are some very special and/or very large primes.

@nm It's okay; I already anticipated your followup question, and I was typing up an answer anyway. Declare a local in the parent like this:

local parentfoo:= foo;

It doesn't matter whether this is before or after the definition of procedure foo. Then instead of invoking parent_module:-foo in the child, you invoke parentfoo.

@jamesson You've asked some good questions.

Regarding integral nomenclature, specifically path vs. line: According to the Wikipedia article "Line integral", the two names are used interchangably! I guess that you're a student in a third-semester calculus course. If that is true, I recommend that you not yet try to read that article past the first paragraph as it may lead to some confusion in your coursework. It's far from being the most well-written Wikipedia article on a calculus topic, although I have no specific quibble with its accuracy.

I can't keep the two straight myself: "path", "line", not much difference in the words, right? And even a line integral isn't necessarily over a straight line. The important distinction is the number of dimensions of output of the integrand. In what Maple calls a path integral, it's one dimension; and for a line integral, it's more than one[1]. Your correct integrand  (as clearly shown in Larson's problem) is x*y---a function that takes as input 2 real numbers and outputs 1 real number. Your proposed integrand, <x,y> (which would be xi + yj in Larson's notation, which is standard), takes as input 2 real numbers and outputs 2 real numbers. The syntax checkers in PathInt and LineInt will not let you use an integrand of the wrong dimensionality, so there's not a strong need to remember which is which.

Regarding the issue of prepending Student:-: I meant that the syntax is identical for the specific command that I gave. The Student versions of commands often allow for additional syntax; for example, output= integral only works in the Student versions of the integration commands.

[1] Functions which output more than one dimension are called "vector" functions, or, more precisely vector-valued functions. Functions which take more than one dimension of input are called multivariate.

@rahinui I believe that it is expected behavior that Maple will order the terms of an algebraic expression in whatever way it sees fit. Furthermore, I'm certain that it will not allow you to maintain two separate algebraic expressions that are identical except for the order of the terms. It will store only one version, one order, in memory.

Sets are handled differently. A long time ago, the order that elements appeared in sets was based on memory addresses and hence was session dependent. Now, the user still has no control over the order of sets1, but that order won't change from session to session. However, it may change if you upgrade to a new version of Maple.

[1] For the purpose of rigorous testing of code, it is possible to change the set-ordering rule through a command-line option. See ?maple for details.

@pppc Here's an example of forcing the value of a constant. I have a simple BVP:

ODEs:= diff(y(x),x$2) - C*y(x) = 0:
BCs:= y(0) = 0, y(1) = 0, D(y)(1) = 1:

The differential order is 2, and there's 1 arbitrary constant, C. That means that the numeric BVP solver will require there to be exactly 3 BCs (2+1 = 3). As you can see above, I do have 3 BCs. Pass it to the solver:

Sol:= dsolve({ODEs, BCs}, numeric):
Sol(0);

      [x = 0., y(x) = 0., diff(y(x), x) = -1.00000000000000, C = -9.86960442538029]

So, the solver is telling me that the value of C must be -9.8696.... In other words, it's forcing the value of C to be a specific value.

 

@pppc What is wrong is that you went from 5 BCs to 6. You can't simply add BCs without giving up something in return.

@pppc You say that you "changed the boundary condition to a more complex one". What I see in your worksheet is that you not only changed them, you reduced them to 4. There must be 5, and that is the reason for the error message. The numeric solver will accept quite complex BCs as long as you stick to two boundary points. The way that I've coded it now (which was done very quickly), that must be exactly 5 BCs. Since no w(x) without a derivative appears in the system, it's possible (with some modification to the coding) to give up one BC and solve the system for diff(w(x),x) instead w(x).

Since you have 5 arbitrary constants already, it's also possible to add up to 5 more BCs, but for each one added, the numeric solver will solve for and tell you the value of one of your constants. That would also require some modification of the coding.

Maple does have a fully symbolic implementation of piecewise functions. The command is piecewise (see ?piecewise). For example,

forcingfunc= piecewise(x < 1/3, 0, x < 2/3, 3*x-1, x < 1, 1)

That one is continuous. The numeric solver will let you enter a discontinuous one also, but whether it'll be able to use it without erroring out, I don't know.

First 329 330 331 332 333 334 335 Last Page 331 of 708