352 Reputation

9 Badges

19 years, 87 days

Stefan Vorkoetter is a Senior Architect at Maplesoft, a position that is a combination of design consultant and developer-at-large.

He has been with Maplesoft since May of 1989 after completing a graduate program at the University of Waterloo under Maplesoft co-founder Gaston Gonnet. During his undergraduate career, he worked part time at UW's Symbolic Computation Group, where the Maple system was born.

Stefan's areas of expertise are in algorithms, data structures, and programming language design and implementation. He has worked extensively on various aspects of the Maple kernel, and more recently, the Modelica compiler component of MapleSim. Despite holding a Master of Mathematics degree, he considers himself a computer scientist first.

Stefan was born in Germany, but immigrated to Canada at the age of three. Like many at Maplesoft, he moved to Waterloo to attend the University of Waterloo, met his wife there, and never left. When not working, Stefan is an active participant in the Norwegian Fjordhorse farm he and Lori call home. He also dabbles in electronics, model and full-scale aviation, music, and collecting slide rules and old calculators, and maintains a web site documenting his hobbies.

MaplePrimes Activity

These are replies submitted by stefanv

@Preben Alsholm The text size of cmaple in Windows is not under cmaple's control. It is just whatever size the Windows command prompt window is set to. To change it, open cmaple, then click on the icon in the top left corner of the window's title bar. Select "Properties", and then the "Font" tab. Here you can choose from a limited selection of fonts, and also the size you want. After closing the dialog, exit cmaple so that the settings are saved. The next time you open cmaple, your new settings should still be in effect.

You are correct about highlighting not being on by default in Windows. I was using the version of Maple currently under development, where it now is on by default. I have updated the article accordingly.


For the situation you describe ("I want to iterate over the list and make some substituion to each entry if needed"), you should encode your substitution algorithm into a procedure (perhaps an anonymous one) and map that over the list or set. This is efficient, as only one new list or set is constructed (the one containing all the modifications). Here's a cooked up example:

S := {seq(i,i=1..1000)}; # Generate a set of integers.
# Square the odd ones.
S := map(proc(x) if x::odd then x^2 else x fi end, S);

Simple "one-liner" procedures like the one above can be written in a more compact notation too:

S := map(x -> if x::odd then x^2 else x fi, S);

Internally, Maple creates a new expression sequence the same size as the one in the original set, applies your procedure to each in turn, in-place, and then turns that back into a set (re-ordering, removing duplicates that may have resulted, etc.).

Note that the example above could not have been written using substitution into the set, whether by the non-existent S[i] := expr syntax, nor using subsop. After each substitution was completed, the set would be resimplified, and likely reordered, and the remaining elements not yet processed would no longer be in their original locations:

Using map:

> S := {seq(i,i=1..10)};                                                               
                         S := {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

> S := map(x -> if x::odd then x^2 else x fi, S);                                      
                        S := {1, 2, 4, 6, 8, 9, 10, 25, 49, 81}

Using a loop (I've added a print statement in the loop so we can see why we're going to get an error):

> S := {seq(i,i=1..10)};                                                               
                         S := {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

> for i to 10 do                                                                       
>     if S[i] :: odd then                                                              
>         S := subsop(i=S[i]^2,S);                                                     
>         print(S)                                                                     
>     fi                                                                               
> od:                                                                                  
                            {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

                             {1, 2, 4, 5, 6, 7, 8, 9, 10}

                             {1, 2, 4, 6, 7, 8, 9, 10, 25}

                            {1, 2, 4, 6, 8, 9, 10, 25, 49}

                            {1, 2, 4, 6, 8, 10, 25, 49, 81}

                           {1, 2, 4, 6, 8, 10, 49, 81, 625}

                          {1, 2, 4, 6, 8, 10, 49, 625, 6561}

                        {1, 2, 4, 6, 8, 10, 49, 625, 43046721}

Error, invalid subscript selector

Notice that the second time we square an entry, 3, it becomes 9, and there is now one less member in the set (because there was already a 9). Furthermore, when we square 5 and replace it with 25, the 25 ends up at the "end" of the set in the underlying data structure, so later we encounter the 25 and square it as well (since it's also odd). Finally, we get an error when accessing the no-longer present 10th element of the set (the one that was lost when we squared 3).

Yes, the original plot code was written in the summer of 1986. I worked for SCG that summer, and wrote the driver side of the code (in C), and Alan Donsig (sp?) wrote the first version of the library side (in Maple).

Stefan Vorkoetter - Maplesoft

Regarding the importing of pictures, there's always ImageTools:-Read. If you want to combine a Maple plot with a photograph, for example, you can export the plot into one of the image formats supported by ImageTools, then read that and your other image in, and then programmatically combine them.

Samir, I haven't looked at the code, but did you take into account that the latitude-longitude grid is not square? At our latitude of about 45 degrees, the width of one degree of longitude is only about 0.7 times the height of one degree of latitude. For any latitude L, the spacing of the longitude lines is cos(L) times the spacing of the latitude lines (so at the equator, latitude and longitude are square, while at the poles, the longitude lines are all coincident).


I'm afraid it's probably a one-way function, or maybe even just a coincidence? When I was in the 8th grade, everyone liked Rush, except me (I couldn't get past the "loud" to discover the content; I don't like loud). Of all the people in my class, I'm one of the few that ended up in high-tech.

Having said that, I did "discover" Rush a few months ago (and a cool little utility called MP3Gain), and was surprised how sophisticated their work is, both musically and lyrically. So maybe it is at least a one-way function, and I just happened to get the result before making the function call.

Stefan Vorkoetter - Maplesoft

1 2 Page 2 of 2