awass

221 Reputation

10 Badges

13 years, 362 days

MaplePrimes Activity


These are replies submitted by awass

@Thomas Richard 

Many thanks for help with my mini-issue. I now have a working file.  Hooray!

@nm.   lists are not mutable, Vectors and Matrices are. For big projects that can make quite a difference.
 

The suggestion (by acer or Joe Riel) to make a copy of the structure is just what is needed.

@acer 

Strange that the compact option is cancelled implicitly when you multiply by 2.


Thanks for the explanation and also for the pointer to Section 6.7 of the Programming Manual which is quite helpful.

@acer Thank you for your explanation. I guess the copy command is just necessary for vectors and matrices; it is not necessary for lists or scalars.

I thought I understood until I tried to apply my new "knowledge" in a slightly different context.
 

I wanted to construct a matrix by altering the identity matrix a bit.  Putting A:=IdentityMatrix(5); A[2,3]:=7; resulted in an error message. You explained why above so..

A:=copy(IdentityMatrix(5)); should work. Nope.

A[2,3]:=7; still resulted in an error message.
My very silly workaround:
B:=2 IdentityMatrix(5); B[2,3]:=14; A:= 1/2 B;
There must be a better way.

@Joe Riel 
the inplace option makes all clear.

@acer I find this issue so strange that I have tried many things. My original post was about typing directly into the Maple worksheet. I later copied and pasted that file into Mapleprimes for the perusal of experts and because I was not able to upload my .Maple file. When I saved the file as .mw I was able to upload. I also opened a plaintext editor to try and see if I was typing something strange but the only peculuarity was the added semiclon and added blank line that you noticed.

@acer  I am not sure what you mean  by the "actual text file". I use the Maple interface to type my commands and that file is what I uploaded. What else can I do? I do not use an external editor.

@acer Here are the contents of a plaintext file:


Copying from 2D worksheet into a plain text file:

q:=proc(x) sin(x);

  end proc;

q:=proc(x) x+3;

  end proc;


Copying from 1D worksheet into a plain text file:

q:=proc(x)
x+3
end proc;

(No space and no semicolon.)

Typing directly into a plain text file:

Q:=proc(x)
sin(x)
End proc;

Maple seems to alter what I type into 2D.

FWIW I am uploading a minimal file with the problem. As soon as I switch from 2D to 1D the problem goes away. I don't know how you see the newline characters.

BTW, the uploaded contents of the file do not look like what I see on my screen; I have cut and pasted that as well.
 

"q:=proc(x) sin(x)"

"  end proc;"
%?%?

Error, unterminated procedure

"q:=proc(x) sin(x)"

Error, unable to parse

"  end proc;"

 

"q:=proc(x) x+3"

"  end proc;"
%?%?

Error, unterminated procedure

"q:=proc(x) x+3"

Error, unable to parse

"  end proc;"

 

restart;

q:=proc(x)x+34end proc;

q := proc (x) x+34 end proc

(1)

 


 

Download bad.mws

 

q:=proc(x)
sin(x)
end proc;

Error, unterminated procedure
    Typesetting:-mambiguous(qAssignTypesetting:-mambiguous(

      procApplyFunction(x) sinApplyFunction(x),

      Typesetting:-merror("unterminated procedure")))
Error, unable to parse
    Typesetting:-mambiguous(  Typesetting:-mambiguous(end,

      Typesetting:-merror("unable to parse")) procsemi)
q:=proc(x)
x+3
end proc;

Error, unterminated procedure
    Typesetting:-mambiguous(qAssignTypesetting:-mambiguous(

      procApplyFunction(x) x + 3,

      Typesetting:-merror("unterminated procedure")))
Error, unable to parse
    Typesetting:-mambiguous(  Typesetting:-mambiguous(end,

      Typesetting:-merror("unable to parse")) procsemi)
restart; #Switching to 1 D input
q:=proc(x)
x+3
end proc;
                    q := proc(x)  ...  end;

No problem!

@acer 
 

restart

Using Maple 2018.1 on an iMac running mac Sierra.

``

``

First strange occurence with description.

``

"q:=proc(x) description "blah,blah";  x^(2     )"

"  end proc;"

Error, unterminated procedure

"q:=proc(x) description "blah,blah";  x^(2     )"

 

Error, unable to parse

"  end proc;"

 

 

 

"q:=proc(x)  x^(2     )"

"  end proc;"
``

Error, unterminated procedure

"q:=proc(x)  x^(2     )"

 

Error, unable to parse

"  end proc;"

 

``

"q:=proc(x) sin(x)"

"  end proc;"
NULL``

Error, unterminated procedure

"q:=proc(x) sin(x)"

 

Error, unable to parse

"  end proc;"

 

restart

"Q:=proc(x) sin(x)"

"  end proc;"
````

Error, unterminated procedure

"Q:=proc(x) sin(x)"

 

Error, unable to parse

"  end proc;"

 

"Q:=proc(x)   sin(x)"

"    end proc;"
``

Error, unterminated procedure

"Q:=proc(x)   sin(x)"

 

Error, unable to parse

"    end proc;"

 

``

H := proc (x) x^2 end proc

proc (x) x^2 end proc

(1)

H := proc (x) x^2*sin(x) end proc

proc (x) x^2*sin(x) end proc

(2)

K := proc (x) sin(x^2) end proc

proc (x) sin(x^2) end proc

(3)

"Q:=proc(x) sin(x)"

"  end proc;"
``

Error, unterminated procedure

"Q:=proc(x) sin(x)"

 

Error, unable to parse

"  end proc;"

 

``

 


 

Download wierdness.mw

@awass 

There are semicolons inserted by the copy and paste procedure after the body of the procedures for some reason. They are not visible in the original worksheet.

 

restart;
Using Maple 2018.1 on an iMac running mac Sierra.


First strange occurence with description.

q:=proc(x) description "blah,blah";  x^(2     );

  end proc;
Error, unterminated procedure
                        /                              /
 Typesetting:-mambiguous\qAssignTypesetting:-mambiguous\

                                                      2       
   procApplyFunction(x) description "blah,blah"semi  x      ,

                                                \\
   Typesetting:-merror("unterminated procedure")//
Error, unable to parse
    Typesetting:-mambiguous(  Typesetting:-mambiguous(end,

      Typesetting:-merror("unable to parse")) procsemi)


q:=proc(x)  x^(2     );

  end proc;

Error, unterminated procedure
                           /                              /
    Typesetting:-mambiguous\qAssignTypesetting:-mambiguous\

                             2       
      procApplyFunction(x)  x      ,

                                                   \\
      Typesetting:-merror("unterminated procedure")//
Error, unable to parse
    Typesetting:-mambiguous(  Typesetting:-mambiguous(end,

      Typesetting:-merror("unable to parse")) procsemi)

q:=proc(x) sin(x);

  end proc;

Error, unterminated procedure
    Typesetting:-mambiguous(qAssignTypesetting:-mambiguous(

      procApplyFunction(x) sinApplyFunction(x),

      Typesetting:-merror("unterminated procedure")))
Error, unable to parse
    Typesetting:-mambiguous(  Typesetting:-mambiguous(end,

      Typesetting:-merror("unable to parse")) procsemi)
restart;
Q:=proc(x) sin(x);

  end proc;

Error, unterminated procedure
    Typesetting:-mambiguous(QAssignTypesetting:-mambiguous(

      procApplyFunction(x) sinApplyFunction(x),

      Typesetting:-merror("unterminated procedure")))
Error, unable to parse
    Typesetting:-mambiguous(  Typesetting:-mambiguous(end,

      Typesetting:-merror("unable to parse")) procsemi)
Q:=proc(x)   sin(x);

    end proc;

Error, unterminated procedure
    Typesetting:-mambiguous(QAssignTypesetting:-mambiguous(

      procApplyFunction(x)   sinApplyFunction(x),

      Typesetting:-merror("unterminated procedure")))
Error, unable to parse
   Typesetting:-mambiguous(    Typesetting:-mambiguous(end,

     Typesetting:-merror("unable to parse")) procsemi)

H := proc (x) x^2 end proc;
                    H := proc(x)  ...  end;
H := proc (x) x^2*sin(x) end proc;
                    H := proc(x)  ...  end;
K := proc (x) sin(x^2) end proc;
                    K := proc(x)  ...  end;
Q:=proc(x) sin(x);

  end proc;

Error, unterminated procedure
    Typesetting:-mambiguous(QAssignTypesetting:-mambiguous(

      procApplyFunction(x) sinApplyFunction(x),

      Typesetting:-merror("unterminated procedure")))
Error, unable to parse
    Typesetting:-mambiguous(  Typesetting:-mambiguous(end,

      Typesetting:-merror("unable to parse")) procsemi)

 

the procedure q discussed above does not have a ; after sin(x) in my worksheet.It only appears after I cpy and paste.
 

q:=proc(x)

sin(x)

  end proc;
 

is what I see.

 

@vv I guess you are right. The procedure you provided is neat!
 

I still think the help pages should warn folks about the procedure, or, even better, incorporate your procedure.

@Kitonum Hi,

Inserting the evalf in abs(x) is certainly better but my problem is in some mysterious hidden quotes in the worksheet. That is why the error message says "unable to delimit..."  The copied version of the worksheet I first entered (as opposed to the uploaded version above) shows those quotes.

 

1 2 3 4 5 6 7 Page 1 of 8