William Fish

719 Reputation

7 Badges

16 years, 161 days

MaplePrimes Activity


These are answers submitted by William Fish

The following worksheet contains a solution to exercise 1 on page 255 of the 2007 edition of the Maple 11 Introductory Programming Guide. It is wrong for only one of the test cases included. I tried to use a sequence for a while but ended up using a list, l. I would find a sequence solution interesting. I couldn't do it. View 4937_Exercises10.mw on MapleNet or Download 4937_Exercises10.mw
View file details
On page 252 of the 2007 edition of the Maple 11 Introductory Programming Guide:
> Max := proc (x::numeric, y::numeric)
            if y < x then
              x
            else
              y
            end if
  end proc:
> Max(Pi, 3);

Error, invalid input: Max expects its 1st argument, x, to be of type numeric, but received Pi
Why is this a good thing? Why isn't Pi numeric?
"Literate programs are written to be read by other software developers." — Donald Knuth But, I'm not developing software, I just want to lean how to get Maple to assist me as I try to solve problems, look for answers, truth, the meaning of life and the American way...
"The Feynman Problem-Solving Algorithm:
  (1) write down the problem;
  (2) think very hard;
  (3) write down the answer."
This stuff is cool: > SPLIT:= (f,x) -> [selectremove](`not` @ has, f, x); and I find it entertaining, better than Circ De Sola. "In most computer programming languages, the challenge might be to solve the puzzle in the fewest lines of code. In APL, it is generally a given that the solution will be one line of code: The challenge is to solve the problem in the fewest characters!" "There are two kinds of geniuses: the 'ordinary' and the 'magicians'. An ordinary genius is a fellow whom you and I would be just as good as, if we were only many times better. There is no mystery as to how his mind works. Once we understand what they've done, we feel certain that we, too, could have done it. It is different with the magicians. Even after we understand what they have done it is completely dark. Richard Feynman is a magician of the highest calibre." — Mark Kac What if Feynman was born in 1979 with Maple? Are there Feynmans out there now? "... as far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." — Albert Einstein Math can be fun and sometimes it is even helpful in the real world.
Robert Israel: Did "`not` @ Boolean-valued procedure" fly out of your typing finders on the spur of the moment or had you seen it before somewhere? Thank you for your help.
I see, I see, I see more but not all. "The square brackets around "selectremove" ensure the results appear as a list." I would have never thought of that. I would have put it all in square brakets and that also seems to work: SPLIT:=(f,x)->[selectremove(`not`@has,f,x)] as does: SPLIT:=[(f,x)->selectremove(`not`@has,f,x)] which seems to be the same as: SPLIT:=[proc(f, x)selectremove(`@`(`not`, has), f, x) end proc] Where to gainfully employ the grave accents (left quotes) is still a mystery to me. The `@` and `not` working on "has" is wonderful but I don't think I would ever have thought of it without help. If I were asked for the answer to "SPLITS(int(g(x), x = 0 .. t), x)" I think I would have answered as follows: [int(g(x), x = 0 .. t),{}]. Everything is independent of x and nothing contains x. x is just the dummy variable of integration. Please, explain `not`@has.
Robert Israel and Jacques C.: Thank you for the solutions to exercise 5. I have never seen "[selectremove]". I don't know what it means. I tried Maple Help but it was no help. I tried Google but all it would look for is "selectremove". I've never used "@". I have read about it. I've never successfully used "has" and "freeof" is new to me. This technology is sufficiently beyond me that I can not distinguish it from magic. Can you help me get to the point where I might be able to apply this technology? I don't think that I have a good enough understanding of the question (exercise 5). The input "int(g(x), x = 0 .. t),x" is helpful. I think other examples of appropriate SPLIT input would be helpful. Thanks again.
Are solutions for the exercises in the 2007 Maple Introductory Programming Guide available?
I would like to see a solution to exercise 5 on page 191 of the 2007 Maple Introductory Programming Guide. The exercise reads as follows: "Write a procedure,SPLIT, that, upon input of a product f and a variable x, returns a list of two values. The first item in the list should be the product of the factors in f that are independent of x, and the second item should be the product of the factors that contain an x. Hint: Use the has, select, remove, and selectremove commands." I'm not even sure what to use as input should I manage to come up with a proc to test. If you wish to be confused see my attempt in the following: View 4937_Help.mw on MapleNet or Download 4937_Help.mw
View file details
Sorry, I seem to have used the wrong single quote, apostrophe. I though that I tried grave accent and got an error in the chaos, something about trampling on a reserved word. The grave accents are now working as shown in the book. back quote "`" ASCII code 96. Common names: left quote; left single quote; open quote; ITU-T: grave accent; grave. Rare: backprime; INTERCAL: backspark; unapostrophe; birk; blugle; back tick; back glitch; push; ITU-T: opening single quotation mark; quasiquote.
The 'if' operator doesn't seem to work for me. Here is what I get: View 4937_if_operator_problem.mw on MapleNet or Download 4937_if_operator_problem.mw
View file details Please tell me what I'm doing wrong. P.S. That ES proc from http://beta.mapleprimes.com/forum/help-about-sieve-of-eratosthenes is way cool and very fast. My Eratosthene proc doesn't compile.
On page 166 of the 2007 edition of the Maple 11 Introductory Programming Guide in section 4.9 Exercises, problem 4 it says: "Write a procedure that implements the sieve of Eratosthenes: Count the number of integers (less than or equal to a given integer) that are prime." The following seems to be a solution: View 4937_Eratosthenes.mw on MapleNet or Download 4937_Eratosthenes.mw
View file details I'd like to read other solutions.
Thanks. I'll try
x
 y
  z
next time.
Doug Meade: Why is it that your comment looks so much better than mine even though I tried to copy yours? How did you get your whitespace past the whitespace police?
> evalb((not(P and not Q)) = ((not P) or Q)); false Again, I am very surprised but I like this: > for P in [true, false, FAIL] do for Q in [true, false, FAIL] do B := evalb(`not`(`and`(P, `not`(Q))) = `or`(`not`(P), Q)); print(B) end do; end do; true true true true true true true true true
Robert Israel: Thanks. At some point in the future I hope to be less frequently surprised by Maple. The top of page 125 of the 2007 Maple Introductory Programming Guide seems to says that using evalb(exp1 = exp2) helps. Thanks again.
1 2 3 4 Page 2 of 4