Christopher2222

MaplePrimes Activity


These are replies submitted by Christopher2222

better example

test.txt file contains (b, Einstein once said "Everyone is  genius", in a famous quote.)

a:=readline("c:/test.txt")
                            a:=" (b, Einstein once said "Everyone is  genius", in a famous quote.)"

The reason to use parse is so that I can use assign but the extra quotes foil the attempt.

 

If Maple explicitly knows there is a backslash behind quotes within quotes it will be okay as your example shows.

If I change the test.txt file to read a:="Einstein once said Everyone is a genius, in a famous quote." which is a proper Maple statement it is fine until I add quotes within the quotes.

 



If Maple explicitly knows there is a backslash behind quotes within quotes it will be okay as your example shows.

If I change the test.txt file to read a:="Einstein once said Everyone is a genius, in a famous quote." which is a proper Maple statement it is fine until I add quotes within the quotes.

 



for example

test.txt file contains following text :  Einstein once said "Everyone is a genius", in a famous quote.

a:=readline("c:/test.txt")
                                          a:= "Einstein once said "Everyone is a genius", in a famous quote."

parse(a)

Error, incorrect syntax in parse: missing operator or `;` (14)

for example

test.txt file contains following text :  Einstein once said "Everyone is a genius", in a famous quote.

a:=readline("c:/test.txt")
                                          a:= "Einstein once said "Everyone is a genius", in a famous quote."

parse(a)

Error, incorrect syntax in parse: missing operator or `;` (14)

Copying the params to a simple text and reading it in is the easiest way to do it. 

Suppose we have a Maple .mw file containing only our parameters.  Yes, of course why not just enter the parameters in a text file instead and just read them in as PatrickT mentions.  Well I just wanted to see how hard it would be to extract the variables from the created mw file from maple, just a lot of text manipulation is required. 

Suppose we have our param.mw file containing just these variables.

a := 5;
b := 5*x+3*y^2;
c := cos(x)^2;
d := 7/(3*I);
e := diff(sin(x), x);

Here is a procedure that extracts those parameters

 

restart; gc()

``

readparam := proc (file) local a, b, c, i, j, g, b1, b2, param, data, paramlist; param := Table(); i := 1; do data := readline(file); if data = 0 then break end if; param[i] := data; i := i+1 end do; paramlist := convert(param, list); b1 := StringTools:-SearchAll(

``

readparam(

a

5

(1)

b

5*x+3*y^2

(2)

c

cos(x)^2

(3)

d

-(7/3)*I

(4)

e

cos(x)

(5)

f

f

(6)

``

 

Download param_test_read_6.mw

Copying the params to a simple text and reading it in is the easiest way to do it. 

Suppose we have a Maple .mw file containing only our parameters.  Yes, of course why not just enter the parameters in a text file instead and just read them in as PatrickT mentions.  Well I just wanted to see how hard it would be to extract the variables from the created mw file from maple, just a lot of text manipulation is required. 

Suppose we have our param.mw file containing just these variables.

a := 5;
b := 5*x+3*y^2;
c := cos(x)^2;
d := 7/(3*I);
e := diff(sin(x), x);

Here is a procedure that extracts those parameters

 

restart; gc()

``

readparam := proc (file) local a, b, c, i, j, g, b1, b2, param, data, paramlist; param := Table(); i := 1; do data := readline(file); if data = 0 then break end if; param[i] := data; i := i+1 end do; paramlist := convert(param, list); b1 := StringTools:-SearchAll(

``

readparam(

a

5

(1)

b

5*x+3*y^2

(2)

c

cos(x)^2

(3)

d

-(7/3)*I

(4)

e

cos(x)

(5)

f

f

(6)

``

 

Download param_test_read_6.mw

Exporting as simple text from maple and reading back in.

read "f:/input.txt";
Error, on line 1, syntax error, `>` unexpected:
> a := 5;
^
Error, while reading ``f:/input.txt``

Exporting as simple text from maple and reading back in.

read "f:/input.txt";
Error, on line 1, syntax error, `>` unexpected:
> a := 5;
^
Error, while reading ``f:/input.txt``

a := 5;
b := 5*x+3*y;
c := "Some text";
d := 7/(3*i);

Is translated when viewed by an editor file as

`:=`(a, 5):
`:=`(b, `+`(`*`(5, `*`(x)), `*`(3, `*`(y)))):
`:=`(c, "Some text"):
`:=`(d, `+`(`*`(7, `*`(`/`(`+`(`*`(3, `*`(i)))))))):

locating them and separating them out is what I had in mind in capturing your parameters from another mw file.  Unfortunately one will have to create your own routine for Maple to work with the params / eqs.


a := 5;
b := 5*x+3*y;
c := "Some text";
d := 7/(3*i);

Is translated when viewed by an editor file as

`:=`(a, 5):
`:=`(b, `+`(`*`(5, `*`(x)), `*`(3, `*`(y)))):
`:=`(c, "Some text"):
`:=`(d, `+`(`*`(7, `*`(`/`(`+`(`*`(3, `*`(i)))))))):

locating them and separating them out is what I had in mind in capturing your parameters from another mw file.  Unfortunately one will have to create your own routine for Maple to work with the params / eqs.


Curiously in M12 when I assume x

taylor(f(x), x = 1)assuming x < 0;


       /1                    \   1        /1                   \           1          /1                   \        2
 exp|- I signum(x) Pi| + - exp|- I signum(x) Pi| (x - 1) - - exp|- I signum(x) Pi| (x - 1)
       \2                    /   2        \2                   /           8          \2                   /         
 
      1         /1                   \          3    5         /1                   \          4     7        /1                   \           5   
    + -- exp|- I signum(x) Pi| (x - 1)  - --- exp|- I signum(x) Pi| (x - 1)  + --- exp|- I signum(x) Pi| (x - 1)  +
      16       \2                   /               128      \2                   /                256      \2                   /            

      /       6 \
   O\(x - 1) /




In Maple 16 it just adds I everywhere except in the higher order term.

Curiously in M12 when I assume x

taylor(f(x), x = 1)assuming x < 0;


       /1                    \   1        /1                   \           1          /1                   \        2
 exp|- I signum(x) Pi| + - exp|- I signum(x) Pi| (x - 1) - - exp|- I signum(x) Pi| (x - 1)
       \2                    /   2        \2                   /           8          \2                   /         
 
      1         /1                   \          3    5         /1                   \          4     7        /1                   \           5   
    + -- exp|- I signum(x) Pi| (x - 1)  - --- exp|- I signum(x) Pi| (x - 1)  + --- exp|- I signum(x) Pi| (x - 1)  +
      16       \2                   /               128      \2                   /                256      \2                   /            

      /       6 \
   O\(x - 1) /




In Maple 16 it just adds I everywhere except in the higher order term.

Regarding updates in the past I was only expressing my conclusion I came to about updates.

I see your point, but why should I, not an employee of Maplesoft, care about revenue?

I am not saying new users should buy an old version at all, by all means wait for for the new one to come out in April or May.   Without actually knowing the answer to the update question, I think my conclusion is fairly good.  But I was hoping Maplesoft would prove my conclusion wrong by issuing an update.  Consumers can always wish :)

I have submitted an SCR

First 83 84 85 86 87 88 89 Last Page 85 of 155