nm

11353 Reputation

20 Badges

13 years, 14 days

MaplePrimes Activity


These are questions asked by nm

http://www.maplesoft.com/applications/view.aspx?SID=1526&view=html

near the middle, it says

I just tried in Maple 2016 and that is not what it did. It says this was in Maple 8. It seems this was "fixed" in Maple 2015.

My question: How could Maple 8 have simplified rand()/rand() to 1 before evaluating rand()?  i.e. why was not rand() evaluated first, before the simplification was made? it seems to have worked as if one typed x/x , but rand() would have been a function, and it should be evaluated before?

Just wondering why Maple 8 did the above, that is all.

 

 

newbie here. When I give Maple 2016.2  a boundary value ODE with an eigenvalue in it, it returns the trivial solution. I was wondering if Maple supports finding non-trivial solution and also give the eigenvalue values associated with the non-trivial solution?

restart;
ode:=diff(y(x),x$2)+lambda*y(x)=0;
bc:=y(0)=0,y(L)=0:
assume(L>0,L,'real'):
sol:=dsolve({ode,bc},y(x));

The outtput is `y(x)=0`

In Mathematica, it gives both trivial and non-trivial solution:

Clear[L0, lam, x, y, r]
ode = y''[x] + lam y[x] == 0;
bc = {y[0] == 0, y[L0] == 0};
sol = Assuming[Element[L0, Reals] && L0 > 0, 
  DSolveValue[{ode, bc}, y[x], x]]

And the answer is

If Maple does not currently support this, any one knows if this will added to Maple 2017?

 

Is it possible to capture and convert the output of dismantle to one (long) string?

For example, if I do

r:=dismantle(x+sin(x));

SUM(5)
   NAME(4): x
   INTPOS(2): 1
   FUNCTION(3)
      NAME(4): sin #[protected, _syslib]
      EXPSEQ(2)
         NAME(4): x
   INTPOS(2): 1

I'd like to first capture the output in "r", which now it does not, it just goes to screen and "r" is left empty, and then convert the result to long string. (using convert()) So the result of the above will becomes

r:="SUM(5) NAME(4): x INTPOS(2): 1 FUNCTION(3) NAME(4): sin #[protected, _syslib]..."

The reason I need to capture the output, is so I can more easily look for some specific name/content inside the expression. which is now in a string, using string tools later on, which I think will be easier. For example, if I want to look for "sin" I can now search the above string and see if "sin" is there. Context is not important, just need to see if a name happens to be in the string.  The problem I do not know how to convert output of dismantle to string.

Maple 2016.2 on windows

 

Maple ended up corrupting all my files.

I did

data:=ImportMatrix("foo.txt", source=csv);
ExportMatrix("foo.txt",data,target=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:

current_line:=readline("foo.txt");

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

sscanf(current_line,"%d,%d,%d,%d,%f,%d,%s,%s,%d,%d,%s,%s");

The result is

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

The fields are

[integer,integer,integer,integer,float,integer,string,string,integer,integer,string,string]

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

First 168 169 170 171 172 173 174 Last Page 170 of 199