## 378 Reputation

17 years, 193 days

## an obscure way...

If working in Windows, and if you are able to create a DLL, you could make a DLL that will get user input and return it to your Maple worksheet. However, because you are unable to allocate dialog resources or console within the DLL, it's a bit difficult but doable - I think.

## reusing j...

did you know you're reusing j? replacing j as index with something else like: ```for i from 0 to 1 do for n from i to 1 do Gij := diff(psi2, a[i], a[n]): .... ``` worked for me.

## use print?...

To show the evaluation, can you just add a "print" in your loop like: ``` print(lzr2); print(N[i,j]); ```

## ti89 and maple...

Rick, I usually keep my ti89 in radian mode - it keeps things easier if working between the ti89 and Maple. The ti89 has a degree key right on the front so it's very simple to use degrees in radian mode without changing settings. The ti89 is a wonderful calculator! Maple is incredible software!

``` pc := proc (x::float, b::float)::float; evalf(x^b) end proc; cp := Compiler:-Compile(pc); cp(1.1, 2/3); ``` edited to add: ``` c := proc (S::float, K::float, t::float, r::float, v::float, b::float)::float; S*(b+b*erf(b*((ln(S/K)+r*t)/(v*t^b)+b*v*t^b)*2^b))-K*exp(-r*t)*(b+b*erf(b*((ln(S/K)+r*t)/(v*t^b)-b*v*t^b)*2^b)) end proc; Compiler:-Compile(c);``` then use: ``` c(1.1, 2.3, 5.5, 6.6, 7.7, evalf(1/2)) ``` This seems like an okay way to go about it - no?

## one way - but surely not the best...

```mySet := {2, 5, a, r, w}   for i to nops(mySet) do   if whattype(op(mySet[i])) = integer then   print(i); print(mySet[i]); break: end if end do ``` but keep in mind the set is going to be ordered with the first integer, first in this case.

## good point...

I just got back to this and found: `tprime := proc (s) if isprime(s) then s else 0 end if end proc` time(sum('tprime(n)', n = 1 .. 11112))       produces:   `0.071` `time(add(isprime(n), n = 1 .. 11112))`       produces:   `0.031` I also observed the following - but this is to be expected: `time(sum('piecewise(isprime(n) <> false, n)', n = 1 .. 11112))`       produces:   `0.359`

## Thanks...

Thanks Doug for the general idea and thanks Jacques and Georgios for the refinement. This is pretty much what I was looking for - I really appreciate the help.

## not working for me neither...

I also tried to upload the file and then run it in MapleNet and it doesn't work for me neither, and unfortunately I don't know how to delete it. I've tried that in the past without success, and It's kinda embarrasing when that happens which is the reason I don't usually upload here. There might be something special that needs to be done to the worksheets in order for them to work on MapleNet. I just download the file I just uploaded and loaded back into Maple 11 and it worked fine.

When I look at the spiral created by the calculations I was reminded of something. Did you know that Dr. Euler, although blinded by cataracts later in life was able to calculate the orbit of the moon as it was influenced by the sun and the earth. He was a great mathematician and perhaps had a better grasp on the meaning of "infinite" than anyone past or present. There have been many great mathematicians. If you get past this problem with the worksheet and want to treat yourself to some really good reading, have a look at:     "God Created the Integers" by Stephen Hawking A very good book! I'm not a mathematician, but I enjoy math very much.

## sorry to hear that...

I can't tell you how many times I've uttered those words - "This is too hard for me". Fortunately, I only believe it for a minute and then I dig my heels in and give it another tug. I wonder what you might be doing different than I. I left your code block at the top of my sample worksheet, so you won't be able to execute the entire worksheet unless you remove that. After removing that block, then choose Edit/Execute/Worksheet from the menu. If it executes okay then and you want to move the code into a new worksheet, you can use your mouse and keyboard to copy and paste each of the lines into a new worksheet. Something that you may already know, is that each line should end with either a colon or a semi-colon. If lines of code are grouped together between the "Greater-Than" prompts in worksheet mode then the line MUST end with either a colon or semi-colon, our you'll get an error. If in document mode the same applies if the lines are between two markers. You can show the markers in document mode by selecting the option from the "view" menu.

## why no display...

Did you try my worksheet right above your last comment - it's 2-D

## cat and mouse - what I got...

Below is a link to load an HTML that shows what I got with your "4937_Page 87H.mw" version of the code with the change recommended by Joe in his comment above, along with a few other minor changes. I've included a link to the Maple 11 worksheet that I used as well. Fast Cat HTML  ( includes worksheet link ) Slow Cat HTML

A little weird, but how about ```foo := 2*Array(1 .. 10, proc (i) options operator, arrow; i end proc) bar := convert([seq(convert(select(proc (x) options operator, arrow; `mod`(x, 3) = 0 end proc, foo), set)[i], i = 1 .. nops(convert(select(proc (x) options operator, arrow; `mod`(x, 3) = 0 end proc, foo), set)))], Array)``` the code above isn't quite how it looked in Maple, and it won't work if you copy and paste it back into Maple so below is a screenshot