acer

32333 Reputation

29 Badges

19 years, 322 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

I tried to use the Search facility in the Online Help to look up the help-page for the Maple command use. (Such a help-page exists inside Maple itself.)

But instead of showing a link to the appropriate online help, it showed a page saying,"Your search term contained only ignored words. Please enter a different keyword."

acer

The syntax I wrote might work in Maple 12 but not Maple 11, sorry.

Try it like this, in Maple 11 (or earlier),

> M:=ImportMatrix("foo.txt",source=Matlab):

> for i from 1 to 3 do
> p[i],n[i] := M[i,1..3]^%T, M[i,4..-1]^%T;
> od:
> p[1],n[1],p[2],n[2],p[3],n[3];
                        [1]  [4]  [2]  [ 8]  [3]  [12]
                        [ ]  [ ]  [ ]  [  ]  [ ]  [  ]
                        [2], [5], [4], [10], [6], [15]
                        [ ]  [ ]  [ ]  [  ]  [ ]  [  ]
                        [3]  [6]  [6]  [12]  [9]  [18]

> kernelopts(version);
           Maple 11.00, IBM INTEL LINUX, Feb 16 2007 Build ID 277223

The difference is between M[i][1..3] and M[i,1..3].

In Maple 12, M[1] yanks out the first row, but that was syntax new to that release. I ought to have remembered, sorry. (And the syntax M[i,1..3] would also be more efficient, as avoids an intermediary Vector construction.)

acer

The syntax I wrote might work in Maple 12 but not Maple 11, sorry.

Try it like this, in Maple 11 (or earlier),

> M:=ImportMatrix("foo.txt",source=Matlab):

> for i from 1 to 3 do
> p[i],n[i] := M[i,1..3]^%T, M[i,4..-1]^%T;
> od:
> p[1],n[1],p[2],n[2],p[3],n[3];
                        [1]  [4]  [2]  [ 8]  [3]  [12]
                        [ ]  [ ]  [ ]  [  ]  [ ]  [  ]
                        [2], [5], [4], [10], [6], [15]
                        [ ]  [ ]  [ ]  [  ]  [ ]  [  ]
                        [3]  [6]  [6]  [12]  [9]  [18]

> kernelopts(version);
           Maple 11.00, IBM INTEL LINUX, Feb 16 2007 Build ID 277223

The difference is between M[i][1..3] and M[i,1..3].

In Maple 12, M[1] yanks out the first row, but that was syntax new to that release. I ought to have remembered, sorry. (And the syntax M[i,1..3] would also be more efficient, as avoids an intermediary Vector construction.)

acer

Interesting suggestions.

Just for fun, the first can (sort of) be kludged.

> `&+=` := proc(x::uneval,y)
> x := eval(x)+y; # or maybe eval(x,2)
> end proc:

> x:=11: y:=13:

> x &+= y;
                                      24
> x;
                                      24

> x &+= x;
                                      48

> x;
                                      48

> X:=<6>: Y:=<a>:

> X &+= Y;
                                    [6 + a]

> X;
                                    [6 + a]

However, with such operations inside procs some protection against recursive assignment is removed.

> `4`:=`4`+11;
Error, recursive assignment

> `4` &+= 11; # shoort self in foot
                                    4 + 11

> `4`; # don't do this! crash session or OS

acer

The ssystem command does not work properly in the Standard GUI. I will submit an SCR.

A few examples, that work in both the commandline interface and the Classic GUI.

> interface(version);

  Classic Worksheet Interface, Maple 12.00, IBM INTEL LINUX, Apr 1\
        0 2008 Build ID 347164

> ssystem("echo hello; ls .bashrc");

  [0, "hello
        .bashrc

        "]

ssystem("ls | wc");
  [0, "   1377    1382   19267

        "]

while,

> interface(version);
Standard Worksheet Interface, Maple 12.0, Linux, April 10 2008 Build ID 347164

> ssystem("echo hello; ls .bashrc");
                          [0, "hello; ls .bashrc"]

> ssystem("ls | wc");
                                   [2, ""]

> system("ls | wc");
ls: |: No such file or directory
ls: wc: No such file or directory

The behaviour in Maple 13 seems the same.

Note that the shell escape with bang (!) is only supposed to work in the commandline interface.

acer

The ssystem command does not work properly in the Standard GUI. I will submit an SCR.

A few examples, that work in both the commandline interface and the Classic GUI.

> interface(version);

  Classic Worksheet Interface, Maple 12.00, IBM INTEL LINUX, Apr 1\
        0 2008 Build ID 347164

> ssystem("echo hello; ls .bashrc");

  [0, "hello
        .bashrc

        "]

ssystem("ls | wc");
  [0, "   1377    1382   19267

        "]

while,

> interface(version);
Standard Worksheet Interface, Maple 12.0, Linux, April 10 2008 Build ID 347164

> ssystem("echo hello; ls .bashrc");
                          [0, "hello; ls .bashrc"]

> ssystem("ls | wc");
                                   [2, ""]

> system("ls | wc");
ls: |: No such file or directory
ls: wc: No such file or directory

The behaviour in Maple 13 seems the same.

Note that the shell escape with bang (!) is only supposed to work in the commandline interface.

acer

> kernelopts(version);
            Maple 12.01, X86 64 LINUX, Sep 23 2008 Build ID 363216
 
> ! echo "obase=12;scale=1100;sqrt(2)"|bc
1.4B79170A07B85737704B085486853504563650B559B8B79A401387B342380A998A\
173A951303434821B55419A068816958B64282342A358A8947369B97237B9B04B656\
A0723349328A219013A8B21AB42844A5758BA27B3A14317B17B28A4354B796260136\
269A55A79598A4619BA2352A310A3373251B0598676B4537681A191A6901560B1336\
2953A3B373054251593693051410425656527080871A620766432B006383A2728764\
09AB56025015471365346AA731A9248B86B009972A5059115A10537765A3727300B7\
1615798551101BB025B5A119781083699746484A9A0A5807960910B945AB250B74A6\
594723624594035156BB3A6A96559A453899500B6BB8811032B2332A74BB8070401B\
50A8A15BA2096184636714AB8894749356151A36BA8AA424B6511A6AA35635A55848\
B5B4A9953B96478B317223B62700B284559B59A0AA34B6724497A247B53B82568819\
93B18A90A575862342586554334ABAB283AA091186977782BB99734B16373A27B60A\
882935333325A1167A98A42B053831634948A444A7572A993929440A412296997B29\
7AA1810B79145B39974988B968B673134353226914236833678A02694B9A563B1017\
B953268692960AB384B15488A8B26808164413967B011056BA0A08BBAB3022935A1B\
6A096AA9A044836568294400477129BAA80481024829112B4B434A6189B4817322B9\
25
!

What seems lacking, is the reverse (or generalized) operation to convert(<string>,decimal,b) where the string represents a floating-point quantity.

> system("echo \"obase=12;scale=11;sqrt(2)\"|bc");
1.4B79170A079
                                       0
 
> ssystem("echo \"obase=12;scale=11;sqrt(2)\"|bc");
[0, "1.4B79170A079
 
    "]

I just noticed that the bc result for 11 dozenal digits above is not accurate to within 1 ulp. It is off by at least 1 1/2 ulps. Good behaviour would be accuracy to less than 1/2 an ulp.

acer

> kernelopts(version);
            Maple 12.01, X86 64 LINUX, Sep 23 2008 Build ID 363216
 
> ! echo "obase=12;scale=1100;sqrt(2)"|bc
1.4B79170A07B85737704B085486853504563650B559B8B79A401387B342380A998A\
173A951303434821B55419A068816958B64282342A358A8947369B97237B9B04B656\
A0723349328A219013A8B21AB42844A5758BA27B3A14317B17B28A4354B796260136\
269A55A79598A4619BA2352A310A3373251B0598676B4537681A191A6901560B1336\
2953A3B373054251593693051410425656527080871A620766432B006383A2728764\
09AB56025015471365346AA731A9248B86B009972A5059115A10537765A3727300B7\
1615798551101BB025B5A119781083699746484A9A0A5807960910B945AB250B74A6\
594723624594035156BB3A6A96559A453899500B6BB8811032B2332A74BB8070401B\
50A8A15BA2096184636714AB8894749356151A36BA8AA424B6511A6AA35635A55848\
B5B4A9953B96478B317223B62700B284559B59A0AA34B6724497A247B53B82568819\
93B18A90A575862342586554334ABAB283AA091186977782BB99734B16373A27B60A\
882935333325A1167A98A42B053831634948A444A7572A993929440A412296997B29\
7AA1810B79145B39974988B968B673134353226914236833678A02694B9A563B1017\
B953268692960AB384B15488A8B26808164413967B011056BA0A08BBAB3022935A1B\
6A096AA9A044836568294400477129BAA80481024829112B4B434A6189B4817322B9\
25
!

What seems lacking, is the reverse (or generalized) operation to convert(<string>,decimal,b) where the string represents a floating-point quantity.

> system("echo \"obase=12;scale=11;sqrt(2)\"|bc");
1.4B79170A079
                                       0
 
> ssystem("echo \"obase=12;scale=11;sqrt(2)\"|bc");
[0, "1.4B79170A079
 
    "]

I just noticed that the bc result for 11 dozenal digits above is not accurate to within 1 ulp. It is off by at least 1 1/2 ulps. Good behaviour would be accuracy to less than 1/2 an ulp.

acer

I wonder whether common subexpression management in printed output would have also allowed you to "see" the expression's structure. That is a feature of the Classic GUI and the comandline interface, but does not work (automatically, or even properly) in the Standard GUI.

Do you have an example where the simple suggestion to use subs([a^(-1)=1/g,a=g],expression) or its eval version would not suffice, and where none of the other suggestions in the recent thread would work either?

There may be some expense to using numer and denom and redividing.

acer

I wonder whether common subexpression management in printed output would have also allowed you to "see" the expression's structure. That is a feature of the Classic GUI and the comandline interface, but does not work (automatically, or even properly) in the Standard GUI.

Do you have an example where the simple suggestion to use subs([a^(-1)=1/g,a=g],expression) or its eval version would not suffice, and where none of the other suggestions in the recent thread would work either?

There may be some expense to using numer and denom and redividing.

acer

There was a recent thread on that question.

acer

There was a recent thread on that question.

acer

You have a syntax error.

The round-brackets in the following don't match,

{seq(seq([op(i),op(j)], j=fsolve(subs(i,sys)),i=S)};

acer

You have a syntax error.

The round-brackets in the following don't match,

{seq(seq([op(i),op(j)], j=fsolve(subs(i,sys)),i=S)};

acer

Only one result gets returned at a time from fsolve, for multivariate problems.

To attempt to get a different solution point, try calling fsolve again, but with its avoid option. That should prevent it from returning the same point as before. See the fsolve,details help-page.

acer

First 493 494 495 496 497 498 499 Last Page 495 of 591