Christopher2222

MaplePrimes Activity


These are replies submitted by Christopher2222

It will run on Windows XP in compatability mode.

Actually there is a copy of MapleV r 4 on the web somewhere.  I came across it last week.  Can't find it now though. 

It will run on Windows XP in compatability mode.

Actually there is a copy of MapleV r 4 on the web somewhere.  I came across it last week.  Can't find it now though. 

Thanks for the help

Thanks for the help

It would be advantageous to point here where some example data is located.

http://www.unidata.ucar.edu/software/netcdf/examples/files.html

I need to assign after I read it in.

I need to assign after I read it in.

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.

 

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

First 89 90 91 92 93 94 95 Last Page 91 of 162