nm

11353 Reputation

20 Badges

13 years, 16 days

MaplePrimes Activity


These are questions asked by nm

restart;
sol:=dsolve(diff(y(x),x)= x/(sqrt(x^2-16))*1/(2*y(x)),y(x));

Gives

But the solution can also be written as

I just do not know how to transform the first solution to the second simpler one. I tried:

sol:=map(x->rhs(x),[sol]);
simplify(sol,radical);

Also tried simplify(sol,sqrt); simplify(sol,radical,symbolic); simplify(sol,size);

The simpler solution can be found as follows

restart;
sol:=dsolve(diff(y(x),x)= x/(sqrt(x^2-16))*1/(2*y(x)),y(x),'implicit');

But the term in the middle above is

Therefore the solution is really

eq:=y(x)^2-sqrt(x^2-16)-_C1 = 0;
solve(eq,y(x));

Which gives

What command to simplify the long solution to the shorter one obtained from the implicit?

 

The solution by Maple below is correct, but non-the-less, a little strange.

restart;
dsolve(diff(y(x),x)=3*x^2*(y(x)^2+1),y(x));

Gives

Ofcourse 3*constant is still constant. But it is a little strange and have no reason for it to be there.  When I solve it by hand

What could made Maple put the 3 in there? Again, solution is 100% correct, but it could be simpler.

Maple 2017.1

 

 

Maple help pages are terrible.  Sorry, but this is true.

I am looking for one example of how one is supposed to open a file and correctly check that the open was successful and no error occured, all done in code. As in a script.

All what help in fopen says is that if this and that, it generates an error.

            "

OK. But to check for this in code? Why not show an example? the help page on iostatus just lists possible errors. Again, not a SINGLE example of actual Maple code showing how to actually check or handle an error. It just says to call iostatus() and shows the output without an example of what to do next and what to check for.

Lets say one does this:


fileName := "C:\\foo.txt";
fd       := fopen(fileName,WRITE):

Now what? How to check the above was successful? Do I need a trap and catch? catch what? Do I need to check for fd being greater or equal to zero and also use trap in addition? And if an error happens, how to know what it is? How to to format the message, etc.. all in CODE (not interactive) and not by saying just look at the screen and see if there is an error message.

Spend 30 minutes in the help pages and could not find ONE example that shows how to actually check for errors.

I have no idea who writes Maple helps pages, but I find the help pages useless most of the time.

Compare the help for linux fopen for example, where is gives exact details of how to handle the error and find the exact error, all in code.

 

Sometimes dsolve returns solution as implicit, even when not using the `implicit` option. For example

restart;
ode:=diff(y(x),x)=(x*y(x))^(1/2):
sol:=dsolve(ode,y(x));

Gives

Which is the same result if I had used 'implicit'.

Is there a way to tell dsolve not to do this? is it becuase it can't solve for y(x) from the above?

Maple 2017.1

 

Maple 2017.1 on windows 7.

This is VERY frustrating. If I have a string which is too long (do not blame me, it is Maple's output), and  try to save it to text file using fprintf(), then Maple decides to insert CARRIAGE RETURN at about each 1,000,000 characters intervals. 

So if the string happened to be 5 million chars, and instead of getting one long line in the file for this one result, It writes 5 lines in the file.

Becuase of this, I can't postprocess this output, since the program that reads the file expects one line per one result. So it fails to parse it. And having to post process the file to correct this is not easy at all.

Why is there a limitation of writing long string to a file without it being chopped of like this? Is there a way to work around this? Here is a MWE

 

restart;
directory("C:\\bug");
result:=int((a+b*tan(e*x+d)+c*tan(e*x+d)^2)^(1/2)*tan(e*x+d)^2,x):
result_as_string:=convert(result,string):
fd := fopen("out.txt",WRITE):
fprintf(fd,"%s\n",result_as_string);
fclose(fd);

As you can see, I wrote the result as one string. Now if you look at the file out.txt in the directory (you might want to use good editor for this, such as vi or textedit), you will see many lines in there, and not one long line as expected. Or you can run this code

restart;
directory("C:\\bug");
number_of_lines :=0:
line:=readline("out.txt"):
while line <>0 do
   number_of_lines :=number_of_lines + 1:
   line:=readline("out.txt"):
od:
print(` number of lines read is `,number_of_lines);

The above gives

                ` number of lines read is `, 24

This problem now means I am not able to continue with what I am doing. Does this happen on other platforms?

I think this happens due to Maple limits

      `[Length of output exceeds limit of 1000000]`

However, I am NOT dispalying anything on the screen. This is all going to text files.  It seems Maple output limits of 1,000,000 is confusing fprintf() to a file as well?

First 165 166 167 168 169 170 171 Last Page 167 of 199