1275 Reputation

13 Badges

4 years, 250 days

MaplePrimes Activity

These are questions asked by nm

Maple ended up corrupting all my files.

I did

data:=ImportMatrix("foo.txt", source=csv);

Expecting the same file not to change.  But on input the file was like this

1,2,3,4,0.1,5,"int(x^2,x)","\frac{x^3}{3}",6,7,"(2*x + 1)^(3/2)/3","A"
1,2,3,4,0.1,5,"\cos(x)","\sin(x)",6,7,"(2*x + 1)^(3/2)/3","A"

After ExportMatrix the file because like this

1,2,3,4,.1,5,"int(x^2,x)","\\frac{x^3}{3}",6,7,"(2*x + 1)^(3/2)/3","A"
1,2,3,4,.1,5,"\\cos(x)","\\sin(x)",6,7,"(2*x + 1)^(3/2)/3","A"

It added an extra "\" each time it saw "\" in the string. I did not want it to do this. This ended up corrupting all my Latex code, which means I have to recreate all the files now. (did not notice this first time I tested it). So each time I run this code, this file becomes

1,2,3,4,.1,5,"int(x^2,x)","\\\\\\\\\frac{x^3}{3}",6,7,"(2*x + 1)^(3/2)/3","A"
1,2,3,4,.1,5,"\\\\\\\\cos(x)","\\\\\\\\\sin(x)",6,7,"(2*x + 1)^(3/2)/3","A"

and so on.

I looked at all options, and so far, not able to see option to tell it not to do this. With so many options I am not sure what to try now.

Any one knows how to tell ExportMatrix not to add "\" ?  Maple 2016.2

I simply wanted to read the file, and make one change in field, and write the file back to same format it was.

After 3 hrs trying I give up.  I am a Maple newbie.

I need to read a plain text file, where each line contains 12 fields in it.

The fields are comma separated.  But some of the fields are quoted strings. Here is an example of one line below. I can read the line OK, as a string, using readline(), but I do not know how to split it correctly into 12 fields inside Maple once read, so I can access each field easily and make any changes I want.

The problem is that, once I read the line using readline(), it comes in as string. But it has string embeded in it allready, since the line in the file, allready has quoted string as fields.

Here is one line in file foo.txt

1,2,3,4,0.1,5,"int(x^2,x)","\frac{x^3}{3}",6,7,"(2*x + 1)^(3/2)/3","A"

Each line has the same number of fields. 12.  Now I do this:


And now current_line is

"1,2,3,4,0.1,5,"int(x^2,x)","\frac{x^3}{3}",6,7,"(2*x + 1)^(3/2)/3","A""

And here I am stuck. I tried StringTools[Split], I tried sscanf, tried readata, and nothing worked. For example, if I do


The result is

[1, 2, 3, 4, .1, 5, ""int(x^2,x)","\frac{x^3}{3}",6,7,"(2*x"]

The fields are


The problem is the embeded string. I am sure there is a Maple function to do this easily, I just can't find it.

What is the correct way to read these lines, and split them into a Matlab list (of lists) so I can access them easily inside Maple?

Using Maple 2016.2

Is there a problem with MaplePrime web site?   All my questions for the last 4 years, and answers are no longer available. All gone. I posted a question early today about sin(x) calling. one hr after that, I noticed all my questions and answers gone.

When I go to my user profile, it says I have zero questions, zero answer and zero post for the last 4 years. All the answers to my questions also got deleted, which is a shame if this happened. They have many useful information.

Any one else affected by this?

I found 4 ways so far to call a Maple sin function (to return numerical value).

Can you find more ways?







One of the things I like about Maple, is that I am able to look at most of the source code, and learn from it. But since I am newbie in Maple, sometimes I find it hard to know which next call I need to showstat() in order to see what happens next and follow the code.

Sometimes I do not know how to find the proc() being called in the listing shown by showstat().

For an example, I wanted to see how Maple implements AiryAi(x).

So I did  showstat(`AiryAi`) and I see the listing of AiryAi. The top level of the function. But then I see it calling, which must be some other level of `AiryAi` function? For example, at line 16, it says

     res := ('AiryAi')(x)

Since I am looking at AiryAi itself, this must be either recursive call or calling other internal AiryAi?

But if it recursive, then I do not see where the actual implementation is? I wanted to see if it uses the integral form of AiryAi or series form (not likely, uses GAMMA). I see the same recursive call in many places, such as line 35 and line 37 and othere places.

But looking at all the 42 lines, I do not see where the actual calculation of AiryAi(x) is done. Did I miss it?

There is a lot of error checking and looking at special cases and such. But how does one know from looking at this listing, which other function they need to showstat() in order to see the actual implementation? There must be more to it than those 42 lines?

This is on Maple 2016.2


1 2 3 4 5 6 7 Last Page 1 of 30