## 296 Reputation

18 years, 325 days

## Thanks...

Yes, parentheses are a programmers best friend!

## Thanks...

@vv Thanks,  I did not think of that.

## ?...

Sorry, I don't understand your comment.

## Great!...

I understand now. It is like trying to plot
f := proc (x) options operator, arrow; if Pi < x then x^2 else -x end if end proc;

plot(f)

Works fine but

plot(f(x), x = -5 .. 5);
Error, (in f) cannot determine if this expression is true or false: Pi < x

plot('f(x)', x = -5 .. 5) also works for the same reason I guess.

I appreciate the clear explanations and the stylistic improvements also. Many thanks.

## Thank you. It certainly works....

I understand that you have reformatted the input to meet Maple requirements for the plot3d command.
That is the difference between td and TD.

Also, the option remember addition to spped things up by a factor of 3 is clear.

However, the eval command is the magic which somehow prevents premature evaluation in this case.

I do not undertand what is going on.

The alternative solution you proposed using an if statement works equally well but I also find that a bit mysterious as well as your comment about "bound variables". Could you please explain that?

## Yes, yes yes....

@_Maxim_ I agree completely.

BTW,in my case doing the computaion 3 times does consume significant time.

## Thank you. That is now clear....

@acer  I understand what Maple is complaining about now.

However, I must say I regard it as lazy coding. It would require only a few extra lines of code to accept either  input of the form [f(x,y), g(x,y),h(x,y)] or of the form [triple of values that depend on (x,y)]. It very much reminds me of the web pages that cannot deal with dashes in phone numbers or spaces in credit card numbers. Duh!

## I could not disagree more!...

@tomleslie  I have never spent much time worrying about the idiosyncrasies and/or weaknesses of Maple. I have work to do. If something does not work in an intuitive way I flail around a bit to get what I want and then go on with my life. It is the 21st century; people do read manuals.

I remember well that in Maple I if you typed a command that had a t in it like plot or int or diff(f(t),t) Maple might balk on occasion for no discernable reason. The fix was to go back, erase the offending t and retype it. Pretty silly but that worked and that is what I told my students to do. Programs can be quirky like people. Not worth thinking about! That bug was fixed by Release 2.

## Thank you for the suggestion but...

I did have smart quotes disabled. Mysterious!

## How strange!...

@Carl Love

Good detective work.

I used the TextEdit application on my Mac to create the file as plain text. I wonder why the quotes were not ASCII.

## thank you....

Here is my (silly) text file

(*ignore this message*)
Cmnts:= “if time goes by then a=2.1” ;

Here is the result of my read command

Error, on line 4, syntax error, missing operator or `;`:
Cmnts:=    if time goes by then a=2.1    ;
^
Warning, unprintable characters in input

In Maple I enter
Cmmnts := "blah, blah,if  read save are included then end  blah" and the words if read save are all in bold. I can, however, save Cmmnts to an .mpl file or a .txt file and then read it back without problem.

## one further question...

When I save some data to a file for later use it is likely that I will forget some details of the calculation. I would like to add some text to the file. I have tried commands like
and that works. When I read the file back I get the comments. However, it does not work if there are any reserved words included between the quotes, for exapmle if, read, do etc. Any suggestions for dealing with that? Idealy i would like to recall text enclosed with (* *)

That is very clear. I would love to see this in the help page; iy would have saved me a lot of time.

Now I can easily save a bunch of commands to a text file or .mpl file and then read them into a Maple session. If I do start a new worksheet and read a file  iinto that worksheet and later save the new worksheet will the values of L and A also be saved? (I suspect not; the read statements will still be there to re-enter those values.)

## any old eq will do but...

@tomleslie Hi,

I used a toy equation in my attempts to understand events.

> eq := diff(y(x), x, x)+y(x) = 0
> nan := dsolve({eq, y(0) = 1, (D(y))(0) = -1}, numeric, events = [[y(x) = 0, [print("Yes"), halt]]])

"Yes"
nan := proc(x_rkf45)  ...  end;

>nan(20)

Warning, cannot evaluate the solution further right of .78539817, event #1 triggered a halt
[                                                 -17
[x = 0.785398176646644, y(x) = 1.04083408558608 10   ,
[

d                          ]
--- y(x) = -1.41421369774756]
dx                         ]

Notice that the print command in not executed.