Joe Riel

7974 Reputation

22 Badges

14 years, 349 days

MaplePrimes Activity


These are replies submitted by Joe Riel

interface(version); Standard Worksheet Interface, Maple 10, Linux, May 13 2005 Build ID 190196
I have the linux version of Maple 10. Executing Tools -> Check for Updates just returns a message saying that no updates are available. I've heard that, at least for Windows, the updated version 10.01.
I compiled and ran mktime with your example and get
mktime(8,27,2005,13,47,30);
                              1125175650
The number you showed, 1125168450, corresponds to 11:47:30. Two questions: (1) did you transcribe the number incorrectly; (2) does the epoch number correspond to local time or UCT? If the latter, is a translation supposed to be done somewhere?
I don't understand the operation of the environmental variable on the system clock. On my Debian Linux box, to get this to work properly I need to do
export TZ='America/Los_Angeles'
The particular string came from running tzselect. Then the call to FormatTime returns "America/Los_Angeles". Using
export TZ='PDT'
sets the results of date to the wrong time (increases it by 7 hours).
I don't understand the operation of the environmental variable on the system clock. On my Debian Linux box, to get this to work properly I need to do
export TZ='America/Los_Angeles'
The particular string came from running tzselect. Then the call to FormatTime returns "America/Los_Angeles". Using
export TZ='PDT'
sets the results of date to the wrong time (increases it by 7 hours).
On my system the TZ environmental variable is not set. However, if I do assign and export it, FormatTime displays it:
$ export TZ=PDT
$ maple -q
> StringTools:-FormatTime("%Z");
                                 PDT
On my system the TZ environmental variable is not set. However, if I do assign and export it, FormatTime displays it:
$ export TZ=PDT
$ maple -q
> StringTools:-FormatTime("%Z");
                                 PDT
You should be displaying the output in a MathMLViewer element, not a text field. MathML:-Export, which is needed to convert a maple expression to a MathML expression does not, alas, properly handle tables, and the output of tensor[create] is a table with two indices: index_char and compts. Fortunately, you don't want to display the value of index_chars, but rather the matrix stored in compts. Here is the code that does that
restart;
with(Maplets[Elements]):
A := matrix([[a,0,0],[0,a,0],[0,0,a]]);
with(tensor):

maplet := Maplet( Window(
    'title'="test"
    ,[NULL
      ,["g_compts "
       ,TextField['TF1']('value' = eval(A), 60)
       ]
      ,MathMLViewer['MMLV1'](value = "")
      ,[NULL
        ,Button("create tensor", Evaluate('MMLV1' = 'MathML[Export](eval(tensor[create]([-1,-1],eval(TF1))[compts]))'))
        ,Button("OK", Shutdown())
       ]
     ])):

Maplets[Display]( maplet );
You should be displaying the output in a MathMLViewer element, not a text field. MathML:-Export, which is needed to convert a maple expression to a MathML expression does not, alas, properly handle tables, and the output of tensor[create] is a table with two indices: index_char and compts. Fortunately, you don't want to display the value of index_chars, but rather the matrix stored in compts. Here is the code that does that
restart;
with(Maplets[Elements]):
A := matrix([[a,0,0],[0,a,0],[0,0,a]]);
with(tensor):

maplet := Maplet( Window(
    'title'="test"
    ,[NULL
      ,["g_compts "
       ,TextField['TF1']('value' = eval(A), 60)
       ]
      ,MathMLViewer['MMLV1'](value = "")
      ,[NULL
        ,Button("create tensor", Evaluate('MMLV1' = 'MathML[Export](eval(tensor[create]([-1,-1],eval(TF1))[compts]))'))
        ,Button("OK", Shutdown())
       ]
     ])):

Maplets[Display]( maplet );
Will, your post should have been in plain text; as it is, the unterminated <b> and <i> do not show and effect the rest of the page. I'd like to see <c> as an abbreviation for <code>. I use code a lot, but the extra typing is a bit painful.
The procedure assume assigns a local variable named (say) a~ to the global variable a. However, the assignment statement does not evaluate its left-side symbol (for good reason), so following the assignment statement, the global a is assigned 0 (etc). However, the Matrix A has the local variable a~, so there is no effect on it. To assign values to the assumed variables you could replace the line a:=0; b:=1/2; c:=0 with assume(a=0,b=1/2,c=0). That works because, unlike the assignment statement, the procedure assume evaluates the variables.
Here I'll enter the previously mentioned code, this time using Filtered HTML mode with tags:
plot(pts, style=point);
As Stephen mentioned, the missing text does not show up in the page source. I added a second </pre> tag. Without it this text was in the preformatted font (with no line breaks).
Well, I'd prefer for bold, rather than the more cumbersome . Oh, wait, I see that it is listed; never mind. Note that is listed twice in the "allowed HTML tags" bullet under "Filtered HTML".
Here's a slight improvement. By using a neutral operator you don't need to use parentheses. If you do use parentheses, each separate (string) argument is entered as a separate comment line.
fn := proc(n)
local x;
    &//("A multiline comment"
        ,"Here is the second line");
    x := n;
    &// "another comment, no parentheses";
    x := x + n;
end proc:

use CodeGeneration in
    LanguageDefinition:-Define(
        "C_with_comments"
        ,extend = "C"
        ,AddFunction("&//", anything::anything
                     ,proc()
                          Printer:-Print(map(Printer:-Comment,[args])[])
                      end proc));
    Translate(fn, language = "C_with_comments");
end use:

double fn (double n)
{
  double x;
    // "A multiline comment"
  // "Here is the second line"
;
  x = n;
    // "another comment, no parentheses"
;
  x = x + n;
  return(x);
}
Thanks for the explanation of Print:-Comment. Notice, though, that it appears to add another level of indentation, which may not be desired. Does the Maple help system describe Names:-Statement? I've seen, I believe, it used in some of the examples, but don't recall seeing an actual description---at least I cannot find it.
First 175 176 177 178 179 180 181 Page 177 of 181