nm

9747 Reputation

19 Badges

12 years, 63 days

MaplePrimes Activity


These are questions asked by nm

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?

I have a plain text file, with hundreds of lines. I read using the command

ImportMatrix(file_to_read, source=csv):

The files has mixed fields which are integers and strings. The problem happens when a string happeneds to be "0". Maple interprets this when reading as the integer zero and not as the string zero! So that when I print this field later on using printf("%s",field) I get an error. (since I know this field is string, the format for output is fixed in the code). 

I made a very small example to illustrate. One line with 4 fields. The 4ht field is string.

This specific field is always a string with alphanumeric content in the file. It has " " around it. But sometimes the content of the string happens to be the string "0".  Maple gets confused and reads "0" as integer 0.

Is there a way to tell Maple not to read this string as an integer using ImportMatrix?

Here is MWE to show the problem


restart;
currentdirName :="C:\\bug";
currentdir(currentdirName);
file_to_read := cat(currentdirName,"\\maple_input.txt");
data:=ImportMatrix(file_to_read, source=csv):

print(data);
whattype(data[1,1]);
whattype(data[1,4]);

printf("%d,%d,%d,%s",data[1,1],data[1,2],data[1,3],data[1,4]):

 

The input file maple_input.txt has this one line in it:

1,2,3,"0"

As you can see, the 4ht field is a string.  But Maple reads it as integer:

 

This is using Maple 2017.1 on windows. Also Attached the text file.

1,2,3,"0"

Download maple_input.txt

 

Is there a command to find out what is new in 2017.1 that just got installed on my PC?

kernelopts(version);
  Maple 2017.1, X86 64 WINDOWS, Jun 19 2017, Build ID 1238644

I searched and googled and could not find such a command.

It used to be that when I clicked on the little icon in the help window which tells Maple to display all examples in 1D, then I did not see any 2D or any document style (i.e. italic) notation in the examples.

Now in Maple 2017 I see many examples in help show up in 2D/italic. It is worst, on same page, some code displays in Maple language and some code displays in 2D notation.

I do not like 2D. I want to only see examples written in the plain good old fashioned Maple language (which Maplesoft seems to be trying very hard to kill as it seems to be trying to force document style/2D on users by any means).

Here is an example. ?diff shows this

The above has 2D as input and above it has Maple code as input. One can't even copy the input to the open worksheet. If I copy it, this what happens:

value(??);

Here is another example, from page titled

 

Scrolling down I see this

I want all the input code above in examples and documentation to be in plain 1D Maple language notation. Not italic and not 2D and not anything fancy.  I do not like to even look at italic code above.

But clicking on the icon has no effect.

Is there a way to force everything to show using Maple notation for input? 

Maple help and documenation is a big mess if you ask me.

 

 

Maple newbie here.

I do not understand why algsubs do not replace the symbol in the denominator in the following example, but does replace it in the numerator. This is on Maple 2017 on windows 7

Here is the expression

sol := u(x, t) = Sum((2*cos((1/2)*Pi*_Z1)+
       2+4*(-1)^(1+_Z1))*sin(Pi*_Z1*x/L)*
       exp(-k*Pi^2*_Z1^2*t/L^2)/(Pi*_Z1), 
       _Z1 = 1 .. infinity);

I wanted to replace _Z1  with n

But algsubs will not replace _Z1 in the denominator as seen in this screen shot but subs does:

 

 

From help, my impression is that algsubs is superset of subs. Only case where algsubs will not do what subs does is, according to help:

The algsubs command goes recursively through the expression . Unlike the subs command it does not substitute inside indexed names, and function calls are applied to the result of a substitution

 

But There is no indexed names here? 

Can someone please explain why algsubs fails to do the substitution in the denominator in this example?

 

 

 

 

First 150 151 152 153 154 155 156 Last Page 152 of 183