acer

32632 Reputation

29 Badges

20 years, 45 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Markiyan Hirnyk Generating a collection of distinct exact solutions is also easily done with a triple do-loop (or it seems even a double loop, after a preliminary `solve` call).

As there are infinitely many integer-valued solutions then characterizing them in some kind of formulaic way seems like a nice goal.

I have x=1, y=-z-1 (and its symmetric equivalents follow, of course), true for all integer z except z=0 and z=-1.

But I don't see the characterization for all other "fixed" x. It might be nice to have a formulaic result giving y in terms of only z, as a (possibly infinite) union over all valid instances of x.

@Markiyan Hirnyk It now reports {x=1000000,y=1000000,z=1} and {x=1000000,y=3,z=2} as solutions. But these are not exact solutions to (1+1/x)*(1+1/y)*(1+1/z)=2 as the stated equation to satisfy.

@Markiyan Hirnyk It now reports {x=1000000,y=1000000,z=1} and {x=1000000,y=3,z=2} as solutions. But these are not exact solutions to (1+1/x)*(1+1/y)*(1+1/z)=2 as the stated equation to satisfy.

@Markiyan Hirnyk Are some of the more solutions correct only up to floating-point evaluation at a limited precision?

@Markiyan Hirnyk Are some of the more solutions correct only up to floating-point evaluation at a limited precision?

@zook Sorry, I was looking at the bit of your Question where you made two stabs at `define` in order to get phi(x*sigma) to produce phi(x)*sigma. And then I had finger-brain malfunction when querying, and asked you about your intentions for phi(a+b) when I mean to ask about phi(a*b). Sorry.

Note that your followup's solution leaves phi(x*sigma) untouched, for unassigned `x`. It does not produce phi(x)*sigma. And also you mentioned that the following was inadequate for your needs:

restart:
define(phi,linear,phi(sigma)=sigma);
phi(4*sigma);

                                  4 sigma

Hence I took it that you really did want phi(x*sigma) to produce phi(x)*sigma (and not because sigma was stated to be constant... or so it seemed).

So, what I was trying to ask is: what you want from phi(a*b) and phi(a*4*sigma*z)?

@zook Sorry, I was looking at the bit of your Question where you made two stabs at `define` in order to get phi(x*sigma) to produce phi(x)*sigma. And then I had finger-brain malfunction when querying, and asked you about your intentions for phi(a+b) when I mean to ask about phi(a*b). Sorry.

Note that your followup's solution leaves phi(x*sigma) untouched, for unassigned `x`. It does not produce phi(x)*sigma. And also you mentioned that the following was inadequate for your needs:

restart:
define(phi,linear,phi(sigma)=sigma);
phi(4*sigma);

                                  4 sigma

Hence I took it that you really did want phi(x*sigma) to produce phi(x)*sigma (and not because sigma was stated to be constant... or so it seemed).

So, what I was trying to ask is: what you want from phi(a*b) and phi(a*4*sigma*z)?

@jscottelder There is also section 11.3 of the Maple 16 Programming Manual, entitled "Writing Maple Packages By Using Modules", and its paragraph titled, "Custom Libraries".

Note however that once a procedure or module definition is executed it no longer contains comments present in its source. That is to say, comments are stripped off by "execution". This can be seen by using the showstat command on the procedure (or eval or print or dismantle or ToInert). So, naturally, when savelib'ing a procedure or module to a library archive the comments have already been lost.

> f:=proc()
>    # my comment
>    4;
> end proc;

                            f := proc() 4 end proc

> showstat(f);

f := proc()
   1   4
end proc

> print(f);

                               proc() 4 end proc

Retaining comments in procedure bodies would be a useful enhancement of the product, and has been suggested before.

@jscottelder There is also section 11.3 of the Maple 16 Programming Manual, entitled "Writing Maple Packages By Using Modules", and its paragraph titled, "Custom Libraries".

Note however that once a procedure or module definition is executed it no longer contains comments present in its source. That is to say, comments are stripped off by "execution". This can be seen by using the showstat command on the procedure (or eval or print or dismantle or ToInert). So, naturally, when savelib'ing a procedure or module to a library archive the comments have already been lost.

> f:=proc()
>    # my comment
>    4;
> end proc;

                            f := proc() 4 end proc

> showstat(f);

f := proc()
   1   4
end proc

> print(f);

                               proc() 4 end proc

Retaining comments in procedure bodies would be a useful enhancement of the product, and has been suggested before.

@JAnd Raising to %T takes the transpose, just as if you'd wrapped it in a call to the LinearAlgebra:-Transpose command.

@JAnd Raising to %T takes the transpose, just as if you'd wrapped it in a call to the LinearAlgebra:-Transpose command.

@JAnd Give it a whirl (as well as by uncommenting 4x3 example).

By the way, what kind of data is in your Vector? Integers and rationals, or floats, or symbolics?

restart:
with(ArrayTools):

#m,n := 4,3;
m,n := 288,180:

V := Vector[row](m*n,(i)->i):

st:=time():
   m:=Reshape(V,[n,m])^%T;
printf("                             %.3f seconds\n",time()-st);


                             [ 288 x 180 Matrix     ]
                             [ Data Type: anything  ]
                        m := [ Storage: rectangular ]
                             [ Order: Fortran_order ]

                             0.016 seconds

m[1..3,1..3]; # checking top left corner

                               [  1    2    3]
                               [             ]
                               [181  182  183]
                               [             ]
                               [361  362  363]

st:=time():
   p:=FlipDimension(m,1);
printf("                             %.3f seconds\n",time()-st);


                             [ 288 x 180 Matrix     ]
                             [ Data Type: anything  ]
                        p := [ Storage: rectangular ]
                             [ Order: Fortran_order ]

                             0.000 seconds

p[-3..-1,1..3]; # checking bottom left corner

                               [361  362  363]
                               [             ]
                               [181  182  183]
                               [             ]
                               [  1    2    3]

@JAnd Give it a whirl (as well as by uncommenting 4x3 example).

By the way, what kind of data is in your Vector? Integers and rationals, or floats, or symbolics?

restart:
with(ArrayTools):

#m,n := 4,3;
m,n := 288,180:

V := Vector[row](m*n,(i)->i):

st:=time():
   m:=Reshape(V,[n,m])^%T;
printf("                             %.3f seconds\n",time()-st);


                             [ 288 x 180 Matrix     ]
                             [ Data Type: anything  ]
                        m := [ Storage: rectangular ]
                             [ Order: Fortran_order ]

                             0.016 seconds

m[1..3,1..3]; # checking top left corner

                               [  1    2    3]
                               [             ]
                               [181  182  183]
                               [             ]
                               [361  362  363]

st:=time():
   p:=FlipDimension(m,1);
printf("                             %.3f seconds\n",time()-st);


                             [ 288 x 180 Matrix     ]
                             [ Data Type: anything  ]
                        p := [ Storage: rectangular ]
                             [ Order: Fortran_order ]

                             0.000 seconds

p[-3..-1,1..3]; # checking bottom left corner

                               [361  362  363]
                               [             ]
                               [181  182  183]
                               [             ]
                               [  1    2    3]

@JAnd Sorry if I'm being dense, but could you show in plaintext the input and output that you expect (and, some command I gave that wasn't right for that?)? Is this the kind of thing that you need to do many times, or for large size? Thanks.

@JAnd Sorry if I'm being dense, but could you show in plaintext the input and output that you expect (and, some command I gave that wasn't right for that?)? Is this the kind of thing that you need to do many times, or for large size? Thanks.

First 394 395 396 397 398 399 400 Last Page 396 of 597