acer

32333 Reputation

29 Badges

19 years, 320 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

I believe that you are right on track.

You might alternatively have the givens be entered in a TextArea. And the Equations appear in Math containers. There are all sorts of possible combinations as to layout. You could hide some of the flow control code, or make it visible (your choice). You could put some of the components inside worksheet tables (and keep the borders invisible, your choice).

acer

I believe that you are right on track.

You might alternatively have the givens be entered in a TextArea. And the Equations appear in Math containers. There are all sorts of possible combinations as to layout. You could hide some of the flow control code, or make it visible (your choice). You could put some of the components inside worksheet tables (and keep the borders invisible, your choice).

acer

It is usually not necessary to convert an expression to a procedure (or the other way around) in order to use the Optimization package to find a minimum numerically. That package accepts both expression form and procedure form for both objective and constraints of optimization problems.

Also, if you are simply trying to evaluate an expression at various values of the parameter then you might well not have to use unapply in order first to convert the expression to a procedure. The two-parameter form of the eval command can evaluate expressions at values of the variables. That should be efficient, while repeatedly using unapply for the same task would generally be less efficient.

There are some instances when unapply is unavoidably the easiest thing, but from what you've written so far I don't see that as the case. I could be wrong. Your comment below about a recursion limit while presumably using unapply within loop looks like suspicious usage. Seeing the full code might help.

acer

It is usually not necessary to convert an expression to a procedure (or the other way around) in order to use the Optimization package to find a minimum numerically. That package accepts both expression form and procedure form for both objective and constraints of optimization problems.

Also, if you are simply trying to evaluate an expression at various values of the parameter then you might well not have to use unapply in order first to convert the expression to a procedure. The two-parameter form of the eval command can evaluate expressions at values of the variables. That should be efficient, while repeatedly using unapply for the same task would generally be less efficient.

There are some instances when unapply is unavoidably the easiest thing, but from what you've written so far I don't see that as the case. I could be wrong. Your comment below about a recursion limit while presumably using unapply within loop looks like suspicious usage. Seeing the full code might help.

acer

Maybe there's a problem displaying the output. I haven't looked hard at it. This "3rd party" package seems to have problems. Maybe you could contact the author.

acer

Maybe there's a problem displaying the output. I haven't looked hard at it. This "3rd party" package seems to have problems. Maybe you could contact the author.

acer

Are you sure that you regenerated the package, and also that there is no original problematic version in some .mla archive in your libname? You may be picking up an original saved version.

ps. It now appears that with(plots) might do better than with(plots,display). Before the module definition. After the restart. Or rewrite the whole package with uses.

acer

Are you sure that you regenerated the package, and also that there is no original problematic version in some .mla archive in your libname? You may be picking up an original saved version.

ps. It now appears that with(plots) might do better than with(plots,display). Before the module definition. After the restart. Or rewrite the whole package with uses.

acer

The intpakX package's export init does with(plots). That really shouldn't ever be done inside a procedure. I believe that it all worked in M9.5.1 because at that time the plots package was table-based rather than module-based.

Issuing with inside a proc was never guaranteed to work properly, as far as I know. If that's true, then it's not clear that this is a regression bug. (One should not rely on undocumented features...)

Now that the plots package is a module itself in modern Maple, the intpakX code should be rewritten to either use plots:-diplay explicitly, or to use use or uses.

There may well be other plots routines used by intpakX. If that's the case, then issuing only  with(plots,display) done up front, before the module definition, won't fix all those other routine calls. One could instead issue a quick and dirty with(plots) outside and before the module definition, or one could do it properly as outlined above (use, uses, or explicit plots's export calls).

acer

The intpakX package's export init does with(plots). That really shouldn't ever be done inside a procedure. I believe that it all worked in M9.5.1 because at that time the plots package was table-based rather than module-based.

Issuing with inside a proc was never guaranteed to work properly, as far as I know. If that's true, then it's not clear that this is a regression bug. (One should not rely on undocumented features...)

Now that the plots package is a module itself in modern Maple, the intpakX code should be rewritten to either use plots:-diplay explicitly, or to use use or uses.

There may well be other plots routines used by intpakX. If that's the case, then issuing only  with(plots,display) done up front, before the module definition, won't fix all those other routine calls. One could instead issue a quick and dirty with(plots) outside and before the module definition, or one could do it properly as outlined above (use, uses, or explicit plots's export calls).

acer

> y := (-Pi-1/2)*I:

> simplify( y ); evalf(%);

                               -1/2 I (2 Pi + 1)
 
                                -3.641592654 I
 
> simplify( ln(exp( y )) ); evalf(%);

                               1/2 I (2 Pi - 1)
 
                                 2.641592654 I
 
> simplify( ln(exp( x )) ) assuming x::real;
                                       x
See also Alec's response above with simplify(...,symbolic).

acer

> y := (-Pi-1/2)*I:

> simplify( y ); evalf(%);

                               -1/2 I (2 Pi + 1)
 
                                -3.641592654 I
 
> simplify( ln(exp( y )) ); evalf(%);

                               1/2 I (2 Pi - 1)
 
                                 2.641592654 I
 
> simplify( ln(exp( x )) ) assuming x::real;
                                       x
See also Alec's response above with simplify(...,symbolic).

acer

I wish that there were something for Standard that were as useful and as easy to use (without a mouse) as the X11_defaults/Maple file is for Classic.

ps. There's an anti-aliasing toggle under the Tools->Options-Display menutab. (Why is there an entry to that drop-down box labelled "Default", without indicating whether the default is to have anti-aliasing enabled or disabled?)

acer

Come up with another example yourself, and work through it. Otherwise you'll just be copying, and you won't really learn it.

If you want a third equation in two variables, then add a linear combination of the two that you already have. (In the example below, the third equation is just the first minus the second. But you could also do, say, 5 times the first plus 2 times the second.)

> with(LinearAlgebra):

> A,b := GenerateMatrix([2*x-2*y=-2,-x+2*y=3,3*x-4*y=-5],[x,y]):
 
> S := Matrix([A,b]); # augmented Matrix, represents system
                                  [ 2    -2    -2]
                                  [              ]
                             S := [-1     2     3]
                                  [              ]
                                  [ 3    -4    -5]
 
> RowOperation(S,[2,1]); # exchange 1st and 2nd rows
                               [-1     2     3]
                               [              ]
                               [ 2    -2    -2]
                               [              ]
                               [ 3    -4    -5]
 
> RowOperation(%,1,-1); # scale 1st row by -1
                                [1    -2    -3]
                                [             ]
                                [2    -2    -2]
                                [             ]
                                [3    -4    -5]
 
> RowOperation(%,[2,1],-2); # add -2 times 1st row to 2nd row
                                [1    -2    -3]
                                [             ]
                                [0     2     4]
                                [             ]
                                [3    -4    -5]
 
> RowOperation(%,[3,1],-3);
                                [1    -2    -3]
                                [             ]
                                [0     2     4]
                                [             ]
                                [0     2     4]
 
> RowOperation(%,2,1/2);
                                [1    -2    -3]
                                [             ]
                                [0     1     2]
                                [             ]
                                [0     2     4]
 
> RowOperation(%,[3,2],-2);
                                [1    -2    -3]
                                [             ]
                                [0     1     2]
                                [             ]
                                [0     0     0]
 
> RowOperation(%,[1,2],2);
                                 [1    0    1]
                                 [           ]
                                 [0    1    2]
                                 [           ]
                                 [0    0    0]
 
> %[1..2,3];
                                      [1]
                                      [ ]
                                      [2]
 
> LinearSolve(A,b);
                                      [1]
                                      [ ]
                                      [2]

acer

Come up with another example yourself, and work through it. Otherwise you'll just be copying, and you won't really learn it.

If you want a third equation in two variables, then add a linear combination of the two that you already have. (In the example below, the third equation is just the first minus the second. But you could also do, say, 5 times the first plus 2 times the second.)

> with(LinearAlgebra):

> A,b := GenerateMatrix([2*x-2*y=-2,-x+2*y=3,3*x-4*y=-5],[x,y]):
 
> S := Matrix([A,b]); # augmented Matrix, represents system
                                  [ 2    -2    -2]
                                  [              ]
                             S := [-1     2     3]
                                  [              ]
                                  [ 3    -4    -5]
 
> RowOperation(S,[2,1]); # exchange 1st and 2nd rows
                               [-1     2     3]
                               [              ]
                               [ 2    -2    -2]
                               [              ]
                               [ 3    -4    -5]
 
> RowOperation(%,1,-1); # scale 1st row by -1
                                [1    -2    -3]
                                [             ]
                                [2    -2    -2]
                                [             ]
                                [3    -4    -5]
 
> RowOperation(%,[2,1],-2); # add -2 times 1st row to 2nd row
                                [1    -2    -3]
                                [             ]
                                [0     2     4]
                                [             ]
                                [3    -4    -5]
 
> RowOperation(%,[3,1],-3);
                                [1    -2    -3]
                                [             ]
                                [0     2     4]
                                [             ]
                                [0     2     4]
 
> RowOperation(%,2,1/2);
                                [1    -2    -3]
                                [             ]
                                [0     1     2]
                                [             ]
                                [0     2     4]
 
> RowOperation(%,[3,2],-2);
                                [1    -2    -3]
                                [             ]
                                [0     1     2]
                                [             ]
                                [0     0     0]
 
> RowOperation(%,[1,2],2);
                                 [1    0    1]
                                 [           ]
                                 [0    1    2]
                                 [           ]
                                 [0    0    0]
 
> %[1..2,3];
                                      [1]
                                      [ ]
                                      [2]
 
> LinearSolve(A,b);
                                      [1]
                                      [ ]
                                      [2]

acer

First 504 505 506 507 508 509 510 Last Page 506 of 591