awass

276 Reputation

10 Badges

17 years, 364 days

MaplePrimes Activity


These are replies submitted by awass

@_Maxim_ I agree completely.

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

@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!

@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.

 

@taro 

 

I did have smart quotes disabled. Mysterious!

@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.

 

You asked if I was using Maple 2017; the answer is yes. Whis is the new way of adding comments?

@Carl Love H

Here is my (silly) text file

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


Here is the result of my read command

read "Desktop/test3.txt";
                  Comments := blah, blah, blah
Error, on line 4, syntax error, missing operator or `;`:
Cmnts:=    if time goes by then a=2.1    ;
                 ^
Warning, unprintable characters in input
Error, while reading ``Desktop/test3.txt``

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.

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
>comments:="blah, blah, a=7.1, blah";
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.)

@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.
If instead I say
> nan1 := dsolve({eq, y(0) = 1, (D(y))(0) = -1}, numeric, events = [[y(x) = 0, [z = x*y(x), halt]]])
> nan1(20)
> z
I get z for an answer. No assignment hs been made.
 

@Carl Love 

I struggled with the syntax a bit but I do now understand it and it works in the sense that the program runs and I get a plot. I now have to figure out why the result is so different from the result I get using the at routine of Preben Alsholm (below). That must be do to my sloppiness somewhere.

@Preben Alsholm

When you say the first line is most important I take it you do not refer to  local x:=evalf(xx);  but to

  if not type([x,yy],list(realcons)) then return 'procname(_passed)' end if;

(I can get away with out the evalf)


Is the original problem( that your version solves) the fact that odeplot tries to evaluate its arguments before generating the solution?

@tomleslie You are right that f(y) is the numerical solution to an ode that is solved by dsolve.  The command odeplot can access f(y), diff(f(y),y)  and plot them. It can also plot functions of those solutions like f(y)^2 +  y^3 diff(f(y),y) and plot them. There is no need to access them other than by name.
Most importantly, odeplot has no problem with the command

> odeplot(nans, [[y, arctan(diff(f(y),y)/(f(y) - Pi/2)) ]], y = 0 .. 6);

 

which is almost identical to the command I want. It seems clear to me that the problem lies with the if clause in the at procedure.

@Carl Love That clears things up; thank you.

@Kitonum Thanks for your response.

I understand now that evalc is the command I need and that does in fact do the job.

 

However, the solution expand(Re((2-I*X)^4)) assuming X::real; is very mysterious.
(Note Re(expand(((2-I*X)^4)) assuming X::real; also works. )

It tells Maple to take the real part of the expression and then expand it? Whats to expand? After the real part has been taken the job is done. My alternative, to expand and then take the real part makes more sense. I wonder what Maple is doing.

@Rouben Rostamian  Thanks for your response. The transform command is exactly what is needed.

2 3 4 5 6 7 8 Page 4 of 9