acer

32303 Reputation

29 Badges

19 years, 310 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

It has been suggested in the past that changing the current binding for a name (almost always) doesn't affect routines In Maple's own Library, since those get saved with the binding at their creation time. Sometimes this is a pain, but perhaps in this case it might help.

> myD:=module() option package; export D; end module:
> with(myD): unprotect(D):

> D:=4: 17*D;
                                      68
 
> :-D(sin);
                                      cos
 
> convert(diff(f(x),x),:-D);
                                    D(f)(x)
 
> eval(%,f=tan);
                                            2
                                  1 + tan(x)

Notice that in the above, where it looks like I am assigning to D, I am really just assigning to myD:-D.

Also, regardless of what else you've assigned, or loaded, etc, you should always be able to call :-VectorCalculus:-D. So, continuing from on the above, in the same session,

> V := Vector[row]([sin,ln]);
                                V := [sin, ln]
 
> :-VectorCalculus:-D(V);
                                [cos, z -> 1/z]

acer

Are you looking for a Maple program for this? You should be able to do this simply, with one for..do loop within another, using the isprime routine and a few loop control variables.

Is this for an assignment in an academic course? If so then how far have you gotten so far?

acer

> f:= (m,n) -> Array(1..m,1..n,[seq(combinat:-randperm(n),i=1..m)]):

> f(3,5);
                            [2    4    5    1    3]
                            [                     ]
                            [2    4    3    1    5]
                            [                     ]
                            [5    3    1    2    4]

acer

Who recommends using textplot and the SYMBOL font, when using Maple's Standard GUI?

Can you not simply use the techniques described on the ?plot,typesetting help-page?

See ?plot,device and ?plot,setup if you are not familiar with how to programatically export plots to gif, jpeg, etc.

acer

Could someone please explain the syntax used in stating this problem? Thanks.

[updated] Please ignore the above. I've got it now.

acer

Did you mean something like this, in particular for that limit?

> restart:

> limit(sum(1/exp(1/n),n=1..N),N=infinity);
                                   infinity

> sum(n/(n+1),n=1..infinity);
                                   infinity

acer

> M:= Matrix([[1,2,3],[4,7,9],[5,7,11]]);
                                   [1    2     3]
                                   [            ]
                              M := [4    7     9]
                                   [            ]
                                   [5    7    11]
 
> ArrayTools:-AddAlongDimension(M,2);
                                     [ 6]
                                     [  ]
                                     [20]
                                     [  ]
                                     [23]

acer

Could you not put all the code inside one or more procedures, and have the Components simply contain only the appropriate procedure calls?

You might even put the code which defines those procedures inside the "hidden" StartUp Code region of the worksheet. (See top-menubar's Edit -> StartUp Code choice.)

Then you can call and re-use the same procedures in several different Components, and yet editing could be done in one single location -- wherever you define the procedures.

acer

> eq2 := Int(x^(2*k)/(1+x^(2*k))^2, x = 0 .. 1):
> with(IntegrationTools):
> eq3 := Change(eq2, u = x^(2*k), u) assuming k::posint:

> value(eq3) assuming k::posint;

                                  2 k + 1    4 k + 1
                    hypergeom([2, -------], [-------], -1)
                                    2 k        2 k
                    --------------------------------------
                                   2 k + 1
 
> limit(convert(%,MeijerG), k = infinity) assuming k::posint;
                                       0

> limit(convert(%%,MeijerG), k = infinity);
                                       0

acer

Using a translation of the Mma code here to get Carmichael numbers,

> seq(`if`(modp(n,numtheory[lambda](n))=1 and
>          not isprime(n), n, NULL), n=1..10000);
                    561, 1105, 1729, 2465, 2821, 6601, 8911

See the Comment section at that link.

acer

eqn := Diff(a(x)*b(x),x) = diff(a(x)*b(x),x);

neweqn := isolate(eqn, diff(b(x),x)*a(x));

Now, supose you have an expression, and you wish to use the above identity to substitute,

expr := sin(x)*exp(diff(b(x),x)*a(x));

eval(expr, neweqn);

acer

with(Student:-VectorCalculus):

C := <2*exp(t),exp(2*t)*cos(t),exp(2*t)*sin(t)>;

ArcLength(C, t=0..ln(3));

acer

If you really, really want to,

> F:=proc(L::evaln)
>   L:=subsop(1=NULL,eval(L));
> end proc:

> L:=[x,y,z,d];
                               L := [x, y, z, d]
 
> F(L);
                                   [y, z, d]
 
> F(L);
                                    [z, d]
 
> F(L);
                                      [d]
 
> F(L);
                                      []

Alternatively,

> restart:

> F:=proc(L)
>   L:=subsop(1=NULL,eval(L));
> end proc:

> L:=[x,y,z,d];
                               L := [x, y, z, d]
 
> F('L');
                                   [y, z, d]
 
> F('L');
                                    [z, d]
 
> F('L');
                                      [d]
 
> F('L');
                                      []

Some people think that this sort of thing is evil.

acer

Do the values in Matrix M appear correct, if you run this code below?

A := ExcelTools:-Import("Density.xls");

interface(rtablesize=50):
M:=Matrix(A);

There are several plotting choices available. This is just one such (presuming that I've interpreted the data structure ok),

plots:-pointplot3d([seq(seq([M[i,1],M[3,j],M[i,j]],j=2..6),i=4..11)],
                   axes=boxed,symbol=solidcircle,
                   labels=[Temperature,Pressure,Density]);

acer

Suppose we make the two assignments,

> x := Vector[row]([1,2]);
                                  x := [1, 2]
 
> y := Vector[row]([1,2]);
                                  y := [1, 2]
 

And now we assign to an entry of x,

> x[1]:=17:

> x;
                                    [17, 2]

Most people will usually want that the corresponding entry of y to not get assigned by the above assignment to x. So, Maple has two separate and distinct Vectors [1,2] when x and y are created.

The comparison,

  if foo = bar then

will do a comparison for identity, ie. are they the same object in memory. But as just seen, they are not. They are distinct, so that their respective elements may be changed independently.

So, what's been noticed is that mutable objects (objects whose elements may be changed or altered) are generally distinct in Maple.

The routine is() can do some mathematical inference that evalb(..=..) does not do. Originally, is() was a mechanism for query properties, but perhaps it's been becoming mathematically smarter.  It's not an unreasonable expectation for is() to be able to handle this query. But, as it happens, it hasn't (yet) been taught to do that.

One might ask, why does if foo=bar then.. make the "object identity" query evalb(foo=bar) rather that the LinearAlgebra:-Equal(foo,bar) query? Well, it's consistent with how most all other objects are treated in that operation. And if the implementation were reversed then someone would complain about that, and an alterntive syntax would have to be used in order to force the specific identity query on Matrices/Vectors, etc.

The Maple help system doesn't really make it easy to figure out what the `=` means in if foo=bar then..

acer

First 305 306 307 308 309 310 311 Last Page 307 of 336