Carl Love

Carl Love

28070 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@sideshow Your attempt to use or is nonsense to Maple, although technically it doesn't violate any syntax rule, so there's no error message (until you try to use the function!). The prefix form `if` is an operator with exactly three operands. To use it for an elif situation, you need to nest them:

g:= (x,y)-> `if`(x=0.5, 200*y, `if`(y=0.5, 200*x, 'procname'(args))):

For a short chain of conditions, nested `if`s are shorter to type. But for a long chain of elifs, the parentheses required make that unbearable and you're better off using the long form if-then-elif-else-end if as in the Reply above.

But by applying logic, you can often combine conditions. For example, the four conditions from the previous Reply can be combined into a single condition like this:

g:= (x,y)-> `if`(x*y=0 or 0.5 in {x,y}, 400*x*y, 'procname'(args))):

Many complicated compound conditional statements can be made more efficient (and often less readable) by using some creative logic like this.

@sideshow 

In that case, it's better to use if-then-elif-then-else-end if:

g:= (x,y)->
     if x=0 or y=0 then 0
     elif x=0.5 then 200*y
     elif y=0.5 then 200*x
     else 'procname'(args)
     end if
:

@Rouben Rostamian  

Assuming that the OP has faithfully encoded the algorithm (which I haven't checked mostly because of annoyance with 2D-input issues and also because I don't have the book), the significant difference is that the OP uses Maple's default 10-digit software-float arithmetic and Rouben uses hardware-float arithmetic (which carries about 18 digits) for the Matrix operations. It's very likely that the book's example was executed with this same IEEE 754 arithmetic, which is called "double" or "double precision" in many languages.

@acer Yes, Acer, thanks. I missed that EQ was only the loop index.

Yes, you want (1)=~ 0, where (1) is the equation label reference.

@mskalsi 

You only need the command that I gave. You don't need a for loop. Just six characters:

EQ=~0;

@hind Like I said, the error is at s[2]. That is a "correct indexed subscripted name" in your program!

Please don't include multi-line plaintext Maple output in your posts unless you know how to format it correctly. It's totally unreadable. For the vast majority of questions, we only need to see the input in order to answer them. If we need to see some output, we'll ask for it, in which case an attached worksheet in probably the best option.

I'm about to edit the unreadable output from your post.

@Preben Alsholm 

There's a good chance that those extra multiplication signs came from putting an extra space after each function's name in 2D input. So make sure that you enter, for example, sech(-mu) rather then sech (-mu).

@vv 

Keller box is, I belive, a numerical PDE method, not an ODE method. Since Maple's built-in numerical PDE solver is quite weak, it'd be no surprise at all if the OP has one that it can't solve.

Do you want to see a step-by-step solution proving that the series converges (standard calculus II material)? Or do you want a step-by-step solution showing how to approximate the sum of the series to any given guaranteed accuracy? Either is easy for this particular series.

@fairuzalwani 

Okay, I understand more now. Please let me know if this MEC procedure does what you need:

MEC:= proc(N::nonnegint)
local z, ic, Escape, Capture, MinPts, Used;
     for ic from 0 to N do
          if assigned(Used[ic]) then next end if;
          MinPts[ic]:= true;
          z:= ic;
          while F(z) <= N do
               z:= F(z);
               Used[z]:= true;
               Escape[z]:= true
          end do;
          z:= ic;
          while Finv(z) <= N do
               z:= Finv(z);
               Used[z]:= true;
               Capture[z]:= true
          end do
     end do;
     (`{}`@indices)~([MinPts, Escape, Capture], 'nolist')
end proc:

This is very similar to your original code. Instead of the IsEmpty that you used to mark the points that haven't been used, I use Used to mark the points that have been used. And, of course, these are all Maple tables, not arrays; note the use of the built-in assigned in the if statement. All the Boolean infomation is conveyed by the fact that the element is or isn't assigned; the true that I used is just a dummy.

One thing that I still don't understand is why you think that you need to go to 2*N rather than N.

Here's a better, simpler Orbit procedure:

Orbit:= proc(Map::appliable, ic::nonnegint, Nit::nonnegint)
local orbit:= Array(0..Nit, [ic]), k;
     for k to Nit do orbit[k]:= Map(orbit[k-1]) end do;
     convert(orbit, list)
end proc:

Note that I use Array (with a capital A), rather than array. The use of array is deprecated, meaning that you should never use it. It only exists to support legacy code.

 

@Carl Love

By running the program MEC(200), I was able to quickly come up with a complete characterization of the minimum points, the escapees, and the capturees:

  1. A nonnegative integer n is a minimum point (i.e., it's the minimal value in its F-orbit) iff it's of the form k*(k-1)/2 for some positive integer k. (These are also called the triangle numbers.)
  2. If k is odd, then all the numbers between n and the next triangle number are escapees (i.e., they're on the increasing part of their orbit).
  3. If k is even, then all the numbers between n and the next triangle number are capturees (i.e., they're on the decreasing part of their orbit).

(All of the above only applies to the case a = 4, b = 1. I haven't tried other pairs for a and b.)

(These are just conjectures from experimental evidence; they remain to be proven.)

Is this what you were trying to discover?

 

@Kitonum He's asking if there's any reason to prefer one form over the other given that he doesn't intend to apply f or its derivative to any specific value of t, which doesn't seem to be covered by your Answer.

@Markiyan Hirnyk Do you know that in English the phrase "so-called" is an insult, and that it's hyphenated? I don't understand your comment about capital letters; the OP hasn't misused such.

@pilpilet The body of your Reply is missing. Also note that I added an answer to your question about being sure of the accuracy without using intuition.

First 441 442 443 444 445 446 447 Last Page 443 of 709