Doug Meade

 

Doug

---------------------------------------------------------------------
Douglas B. Meade <><
Math, USC, Columbia, SC 29208 E-mail: mailto:meade@math.sc.edu
Phone: (803) 777-6183 URL: http://www.math.sc.edu

MaplePrimes Activity


These are replies submitted by Doug Meade

I have now updated the MLA that can be access at the URL http://www.math.sc.edu/~meade/TEST/SimpleMaplet.mla. This version of the file uses kernelopts(homedir) in an attempt to automatically generate the corect absolute path to the image. It works for me. Does it work for anyone else? ("works" means the maplet and image are extracted, the maplet runs, and you can see an image in the maplet) Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
The interactive InstallBuilder is pretty easy to use. But, it can become tedious to have to enter all information about the MLA ou are trying to create. InstallBuilder:-Interactive does accept optional arguments that can be used to specify any of the values that can be set within the GUI. For example:
InstallerBuilder:-Interactive(
  name = "SimpleMaplet",
  author = "Douglas B. Meade",
  version = "1.0",
  uninstaller = false,
  NULL
);
These values are defaults, and can be changed by the user. You can also do everything directly from the command line. Here is the command I used to create the MLA discussed in another post in this thread:
InstallerBuilder:-Build(
  name = "SimpleMaplet",
  author = "Douglas B. Meade",
  version = "1.0",
  uninstaller = false,
  manifest = [
   "C:\\Documents and Settings/mead/Desktop/MapletWithImage/Simple.hdb"
    = "lib/Simple.hdb",
   "C:\\Documents and Settings/mead/Desktop/MapletWithImage/PrimesBack.jpg"
    = "misc/PrimesBack.jpg",
   NULL ],
  welcome = [
    text = "Welcome! Just accept all prompts and the maplet should run, eventually.",
    image = none,
    script = none,
    validate = true],
  installation = [
    text = "Two more steps.",
    image = none,
    script = none,
    validate = true],
  finish = [
    text = "Your patience has paid off. This is the final step!",
    image = none,
    script = proc() try help(StartMe); catch: end try; end proc,
    validate = true],
  NULL
);
It is pretty self-expanatory, but I would never have come up with all of this from the online help. (To be honest, the majority of this comes from the Build Command in the Interactive builder.) I hope this is useful to someone else. Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
Nice explanation. This works exactly as described. I would like to be able to avoid some of the popups in the installation process, but that is not the issue here. I created SimpleMaplet.mla exactly (I believe) as acer described. When the SimpleMaplet.mla is double-clicked from the folder in which it was created, all works great. It still works if I move the .mla file to a different folder, but the image is not displayed. The same happens if I access the .mla file via the WWW. I believe the image file from the MLA is not being seen. I confirmed this (to me) by changing the name of the image file in my working directory. Now, running the maplet from the archive does not show the image. Restore the name of the file and it's ok again. With a little thought, this makes sense. The hdb is saved in lib and the image is saved in misc and these two folders exist in a folder named toolbox somewhere in the user's file system (/home/acer/maple/toolbox/ in acer's Linux system and C:\Documents and Settings\mead\maple\toolbox on my Windows system). When I changed the code in the definition of the maplet in the .mw file to explicitly look for the image in this path the maplet and image appear when this MLA is downloaded. To try this for yourself, use http://www.math.sc.edu/~meade/TEST/SimpleMaplet.mla (if necessary, create a file association for .mla files to Maple). Save the file or execute it directly, my results are the same. (You will have to click through the installation process. Just accept everything as is.) This works - but only for me. What is missing is a way to write the maplet without using a absolute filename for the image. Would there happen to be an environment variable that contains the location where the MLA will be extracted to? (How does the uninstaller know where to put the extracted files?) That's enough for this post. Comments and suggestions are always welcome! Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
I'm back, with a (simple) example of what I want to do. I will demonstrate with a very simple (and small) example. Download the ZIP archive to your computer, then extract the contents to create a folder named MapletWithImage and containing the following four files:
  • Simple.mw -- Maple 11 worksheet defining a maplet that displays an image [17,788 bytes]
  • Simple.maplet -- Simple.mw exported as a maplet (actually, just a text file of commands) [368 bytes]
  • PrimesBack.jpg -- an image file (stolen from MaplePrimes) [8,094 bytes]
  • MapletWithImage.mla -- a Maple Library Archive created by InstallerBuilder[Interactive] [135,075 bytes]
Browse to this folder and double-click on Simple.maplet and the maplet that appears should display an image from MaplePrimes and give you a choice of two buttons to click. To see the actual commands used to create the maplet, either open the .maplet file with your favorite text editor or open the .mw file as a Maple worksheet. My goal is to be able to serve this maplet via the internet in a way that it automatically executes when downloaded. The Simple.maplet file is available on MaplePrimes. Click on this link and the maplet should be downloaded to your computer and executed using a local copy of Maple. Note that the image is not displayed because the image file is not found in the directory currently saved in currentdir(). The .mla file is my initial attempt to use InstallerBuilder[Interactive] to create a Maple Library Archive containing the maplet and image files. The .mla contains these two files and. because I included the uninstaller, Maple opens and the files are extracted. What I have not yet been able to do is find a way to have the maplet automatically execute after extraction. The InstallerBuilder does provide for a "script" and "validation" for each step. The online help give me some encouragement that there might be a way to use these to achieve my goal. But, to date my attempts have been unsuccessful. It seems that I might need to use a system (or ssystem) call to send a maplet to the maplet viewer, but this seems like it might be a little overkill. I hope my explanation is clear and that there is someone out there who is able to put together a single file that can be served by HTTP, extracted and executed automatically. Please let me know if you have any questions about this. I notice also how inefficient the .mla appears to be. I'll guess that it includes a lot of information needed to ensure the files are executed in an appropriate environemnt, but the .mla file is more than 15 times larger than the combined sizes of the .maplet and .jpg files. Thanks for reading, Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
If you want to put the user input directly in a Maple worksheet or document (and not as a separate maplet or dll), then I recommend using an embedded component. This can be a button, field, menu, or other "component" of a Maple document/worksheet. See ?EmbeddedComponent for more details and some examples. Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
If you want to put the user input directly in a Maple worksheet or document (and not as a separate maplet or dll), then I recommend using an embedded component. This can be a button, field, menu, or other "component" of a Maple document/worksheet. See ?EmbeddedComponent for more details and some examples. Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
Your question, I believe, is how can you get the x domain to be [0,4] and not [0,1]. This is very simple. In your loop to construct the plots, you create lists of points, [x,u]. You want these to be [X,u]. Since X=4x, just replace i*h with 4*i*h in the definition of plot||j and change the label from x to X. You need to make a similar adjustment for t and T, but this must be done in the creation of pexact. (Is the plottime a value of t or T? How do you convert this to the correct form?) When these changes are made, I think you will like the result. (You might want to use the thickness option to better see the two curves.) There are other issues to consider, some of which I have hinted at previously. Here's a list to get you started. First, the problem is inconsistent. You cannot have u(x,0)=0 and uX(0,t)=1 and uX(4,t)=2. These are incompatible. You can still talk about a solution, but you have to be careful what this really means. Second, look at your "exact" solution.
  1. Have you plotted uexact(x,0) to see how well it satisfies the initial condition?
  2. Does it improve as more terms are used? (I would also suggest using add in place of sum, but that won't change the pictures.)
  3. How well does uexact satisfy the boundary conditions? You can find the spatial derivative of uexact with (uX := D[1](uexact):).
  4. Are you sure you have used a correct rescaling of the boundary conditions? (Plot uX(0,t) and uX(1,t) for t=0..0.25 - or is your uexact in terms of X and T?)
You've done some good work here. I hope it has been instructive . Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
Your question, I believe, is how can you get the x domain to be [0,4] and not [0,1]. This is very simple. In your loop to construct the plots, you create lists of points, [x,u]. You want these to be [X,u]. Since X=4x, just replace i*h with 4*i*h in the definition of plot||j and change the label from x to X. You need to make a similar adjustment for t and T, but this must be done in the creation of pexact. (Is the plottime a value of t or T? How do you convert this to the correct form?) When these changes are made, I think you will like the result. (You might want to use the thickness option to better see the two curves.) There are other issues to consider, some of which I have hinted at previously. Here's a list to get you started. First, the problem is inconsistent. You cannot have u(x,0)=0 and uX(0,t)=1 and uX(4,t)=2. These are incompatible. You can still talk about a solution, but you have to be careful what this really means. Second, look at your "exact" solution.
  1. Have you plotted uexact(x,0) to see how well it satisfies the initial condition?
  2. Does it improve as more terms are used? (I would also suggest using add in place of sum, but that won't change the pictures.)
  3. How well does uexact satisfy the boundary conditions? You can find the spatial derivative of uexact with (uX := D[1](uexact):).
  4. Are you sure you have used a correct rescaling of the boundary conditions? (Plot uX(0,t) and uX(1,t) for t=0..0.25 - or is your uexact in terms of X and T?)
You've done some good work here. I hope it has been instructive . Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
The interactive builder does appear to present some chance that I can do what I want. It will take more time to understand how all of the features work and any limitations. I will try to put together a small example to demonstrate what I want to do, and what I am able to figure out with the interactive InstallerBuilder. Thanks for the suggestion. Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
Interesting. I am still doubtful this will do what I need, but I'm willing to give it a try. Consulting the online help, I come across the following example in the help for InstallerBuilder,General,Panels:
with(InstallerBuilder):
Build( "SampleToolbox",
    'uninstaller' = false,
    'author'      = "Some Maple User",
    'welcome'     = ['text' = "Welcome to the SampleToolbox installer"],
    'validation'  = [
         'text'     = "Enter the code below:",
         'validate' = proc()
              local code;
              code := ToolboxInstaller:-Data:-Get("validation_attempt");
              if code = "My Secret Code" then
                  true
              else
                  false
              end if;
         end proc
    ]
);
When I execute this, all I see is the following warning message:
Warning, InstallerBuilder is not a correctly formed package - option `package' is missing
I am running Maple 11.01 with the standard interface, worksheet and 1-D Maple input. Does any of this matter? Am I missing something? Does this work for anyone? It's still not clear to me that this will do what I want, but it could be a start. I will try to put together a sammple set of files and see if someone can create a single file to do what I have tried to describe. More to follow soon, Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
I second the interest in being able to use compressed worksheets (.mwz) to communicate Maple information via e-mail (or, more generally, the web). I do not personally have a problem with mail systems corrupting my files, but I have had colleagues indicate that they cannot receive my .mw files. I would like to extend this discussion slightly. Instead of cluttering this discussion, please see my blog posting. Looking forward to your responses, Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
I second the interest in being able to use compressed worksheets (.mwz) to communicate Maple information via e-mail (or, more generally, the web). I do not personally have a problem with mail systems corrupting my files, but I have had colleagues indicate that they cannot receive my .mw files. I would like to extend this discussion slightly. Instead of cluttering this discussion, please see my blog posting. Looking forward to your responses, Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
Here is some more data for this problem. Copy the code into a worksheet and select the terms you want to see. I show here the individual steps used in computing the first term, and then the numbers involved in finding the final result.
for i from 1 to 10 do
  evalf[i]([
    20.952*t - 20.103,
    cos(20.952*t - 20.103),
    -54.281*cos(20.952*t - 20.103)+ 386.8485782,
    (4/3)*(-54.281*cos(20.952*t - 20.103)+ 386.8485782)^3,

#    11.261*t-50.692,
#    cos(11.261*t-50.692),
#    -37.995*cos(11.261*t-50.692),
#    31.592*t,
#    cos(31.592*t),
#    -0.4270215474e-1*cos(31.592*t),
#    -37.995*cos(11.261*t-50.692)-0.4270215474e-1*cos(31.592*t),
#    -37.995*cos(11.261*t-50.692)-0.4270215474e-1*cos(31.592*t)+292.5927782,
    (4/3)*(-37.995*cos(11.261*t-50.692)-0.4270215474e-1*cos(31.592*t)+292.5927782)^3,

    (4/3)*(-54.281*cos(20.952*t - 20.103) + 386.8485782)^3
   -(4/3)*(-37.995*cos(11.261*t-50.692)-0.4270215474e-1*cos(31.592*t)+292.5927782)^3,
    NULL
  ]);
end do;
                  [                       7      7      7]
                  [10000., -1., 400., 8 10 , 4 10 , 4 10 ]
              [                           7        7        7]
              [11000., -0.28, 400., 8.5 10 , 3.2 10 , 5.3 10 ]
            [                             7         7         7]
            [11000., -0.283, 402., 8.66 10 , 3.25 10 , 5.41 10 ]
          [                                7          7          7]
          [10960., -0.5261, 415.4, 9.557 10 , 2.404 10 , 7.153 10 ]
        [                                  7           7           7]
        [10959., 0.43134, 363.44, 6.4008 10 , 2.3027 10 , 4.0981 10 ]
     [                                      7            7            7]
     [10958.7, 0.678686, 350.009, 5.71711 10 , 2.28945 10 , 3.42766 10 ]
  [                                          7             7             7]
  [10958.75, 0.6411317, 352.0473, 5.817572 10 , 2.290287 10 , 3.527285 10 ]
[                                              7              7              7]
[10958.745, 0.64496085, 351.83946, 5.8072748 10 , 2.2902881 10 , 3.5169867 10 ]
    [                                                 7               7  
    [10958.745, 0.644960846, 351.839458, 5.80727464 10 , 2.29028800 10 , 

                   7]
      3.51698664 10 ]
  [                                                    7                7  
  [10958.745, 0.6449608461, 351.8394585, 5.807274668 10 , 2.290288001 10 , 

                  7]
    3.516986667 10 ]


Notice how -54...*cos(..)+386.... takes on values from 350 to 415. I once did some calculations where I had to use almost 20 significant digits to get enough accuracy to be able to plot the expression. At first I thought my expression was non-trivial. But, when enough digits were used, it became crystal clear that I was just plotting zero. (The expression was so complicated I never was able to prove it was zero, but extensive and careful numerical work sure supports this conjecture.) Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
There are a couple of issues involved in these computations. First, subs substitutes and does not simplify the result while eval substitutes and simplifies (evaluates). Next, by default Maple does all floating point calculations with 10 significant digits (see ?Digits). So, when eval is executed by itself, the evaluation is done with Digits=10. But, embedded within evalf( ..., i ), the evaluation is done with Digits=i. Evidence of this is visible in the table below. Note how the errors decrease by a factor of 10 as i increases from 1 to 10 (with exceptions when the two computations agree) but, for i>10, the answers agree to 10 digits.
restart;
f := (4/3)*(-54.281*cos(20.952*t - 20.103) + 386.8485782)^3 - (4/3)*(-37.995*cos(11.261*t-50.692)-0.4270215474e-1*cos(31.592*t)+292.5927782)^3;
4                                               3   4  
- (-54.281 cos(20.952 t - 20.103) + 386.8485782)  - - (
3                                                   3  
-37.995 cos(11.261 t - 50.692) - 0.04270215474 cos(31.592 t) + 292.5927782)^3
fTmpE := eval(f, t=524);
                                             7
                               3.516986667 10 
fTmpS := subs(t=524, f);
4                                       3
- (-54.281 cos(10958.745) + 386.8485782) 
3                                        

     4                                                                     3
   - - (-37.995 cos(5850.072) - 0.04270215474 cos(16554.208) + 292.5927782) 
     3                                                                      
for i from 1 to 22 do
  i, evalf[i]( [fTmpE, fTmpS, fTmpE-fTmpS] );
end do;
                               [    7      7    ]
                            1, [4 10 , 4 10 , 0.]
                           [      7        7       6]
                        2, [3.5 10 , 3.9 10 , -4 10 ]
                            [       7         7    ]
                         3, [3.52 10 , 3.52 10 , 0.]
                         [        7          7        ]
                      4, [3.517 10 , 3.516 10 , 10000.]
                        [         7           7       ]
                     5, [3.5170 10 , 3.5169 10 , 1000.]
                       [          7            7       ]
                    6, [3.51699 10 , 3.51703 10 , -400.]
                       [           7             7      ]
                    7, [3.516987 10 , 3.516988 10 , -10.]
                       [            7              7    ]
                    8, [3.5169867 10 , 3.5169867 10 , 0.]
                     [             7               7     ]
                  9, [3.51698667 10 , 3.51698664 10 , 0.3]
                     [              7                7    ]
                 10, [3.516986667 10 , 3.516986667 10 , 0.]
                   [              7                 7       ]
               11, [3.516986667 10 , 3.5169866664 10 , 0.006]
                  [              7                  7        ]
              12, [3.516986667 10 , 3.51698666675 10 , 0.0025]
                 [              7                   7         ]
             13, [3.516986667 10 , 3.516986666738 10 , 0.00262]
                [              7                    7          ]
            14, [3.516986667 10 , 3.5169866667373 10 , 0.002627]
               [              7                     7           ]
           15, [3.516986667 10 , 3.51698666673727 10 , 0.0026273]
              [              7                      7            ]
          16, [3.516986667 10 , 3.516986666737242 10 , 0.00262758]
             [              7                       7             ]
         17, [3.516986667 10 , 3.5169866667372428 10 , 0.002627572]
            [              7                        7              ]
        18, [3.516986667 10 , 3.51698666673724296 10 , 0.0026275704]
           [              7                         7               ]
       19, [3.516986667 10 , 3.516986666737242988 10 , 0.00262757012]
          [              7                          7                ]
      20, [3.516986667 10 , 3.5169866667372429858 10 , 0.002627570142]
         [              7                           7                 ]
     21, [3.516986667 10 , 3.51698666673724298590 10 , 0.0026275701410]
        [              7                            7                  ]
    22, [3.516986667 10 , 3.516986666737242985908 10 , 0.00262757014092]
In both cases, the differences are determined by the calculation done with few significant digits. Notice that this does not mean the calculation is correct to i digits, just that i digits were used in the calculation. In your case, it appears that the calculation with 20 digits is probably correct to 19 digits (do calculation with more digits and look for agreement)
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
Or, more compactly and with more transparency,
M := <<m1|m2>,<m3|m4>>;
or
M := <<m1,m3>|<m2,m4>>;
The first builds M from two "rows", each consisting of two "columns". The second builds M from two "columns, each consisting of two "rows". Note that this can also be done with blocks that have different dimensions. The only requirement is that dimensions make sense as the rows and columns are assembled. Doug
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
First 59 60 61 62 63 64 65 Last Page 61 of 76