Carl Love

Carl Love

28100 Reputation

25 Badges

13 years, 104 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@rstellian Please see my update to the Answer above. After reading your Grid-related Question, I anticipated that my original Answer probably wouldn't work for you and I upated the Answer. And, considering the size, you'll definitely want to use the .m format.

@Matt C Anderson I'm glad that you figured it out on your own: In earlier Maple, you can't include an initializer in a local declaration. It helps a lot if you include your Maple version in the Question header. I already edited it in this case.

@Earl I have some experimental and preliminary results. By treating the problem as a BVP whose upper boundary is that critical value of t (I called the upper boundary T), using theta(T) = Pi as the boundary condition, I get that T = 10.38172 is the value at which D(theta)(T) = 0. Then using this value for T, I get that DthetaZero = 1.034385*Pi, which confirms your findng.

However, if I then try to solve the problem as an IVP using this value as the initial condition for D(theta)(0), nothing special happens at t = T! The problem seems to be unstable near that value of DthetaZero. Minute changes in this value (like 1e-5) make big changes in the plots.

Please explain to me how the following plot suggests the existence of such a value of t for your proposed value of D(theta)(0)? One would expect the two curves to intersect on the horizontal axis at that t. But there's no point where they are even close to crossing on the horizontal axis. Furthermore, the plot suggests that theta(t) is a periodic function whose value will never be Pi.

sol:=
     dsolve(
          {
               4*sin(theta(t))*cos(theta(t))-9.8100*sin(theta(t)) = diff(theta(t),t$2),
               theta(0) = 2*Pi/3, D(theta)(0) = 1.03425*Pi
          },
          numeric
):

plots:-odeplot(sol, [[t,theta(t)-Pi], [t,diff(theta(t),t)]], t= 0..5);

Most of these commands for inquiring about an object have a corresponding command for altering or reconstructing objects. Usually, these don't literally alter the object, but instead create a new object.

Inquiry                                                            Construction
-----------------------------------------------------   ------------------------------------------------------
about                                                                                  assume
attributes                                                                          setattribute
indets                                                                                 subs, subsindets
ToInert                                                                              FromInert
dismantle                                                                         
none
disassemble                                                                     assemble
addressof                                                                         pointto
eval                                                                                    :=, assign
op                                                                                       subsop

@Soldalma Tables, modules, and procedures (which you're calling functions) have a special feature called last name evaluation. That means that if they are assigned to a name, then that name needs to be evaluated to one level (with eval) before you can "see inside". (The purpose of this feature is, partly, to prevent the display of large objects every time their name is invoked.) So, you just need to do

ToInert(eval(r));

_Inert_PROC(_Inert_PARAMSEQ(_Inert_NAME("x")), _Inert_LOCALSEQ(), _Inert_OPTIONSEQ(_Inert_NAME("operator"), _Inert_NAME("arrow")), _Inert_EXPSEQ(), _Inert_STATSEQ(_Inert_POWER(_Inert_PARAM(1), _Inert_INTPOS(2))), _Inert_DESCRIPTIONSEQ(), _Inert_GLOBALSEQ(), _Inert_LEXICALSEQ(), _Inert_EOP(_Inert_EXPSEQ()))

or

dismantle(eval(r));

PROC(11) #[operator, arrow]
   EXPSEQ(2)
      NAME(4): x
   EXPSEQ(1)
   EXPSEQ(3)
      NAME(5): operator
      NAME(4): arrow
   EXPSEQ(1)
   PROD(3)
      PARAM(2): [1]
      INTPOS(2): 2
   EXPSEQ(1)
   EXPSEQ(1)
   EXPSEQ(1)
   BINARY(2)
      1
   EXPSEQ(1)

The command indets doesn't do much with procedures, as far as I know.

What specific thing about r are you trying to find? You can also take apart expressions (including procedures and modules) with op (short for operand). The reason that I didn't mention this before is that there's no way to completely take apart an expression with a single call to op. It needs to be done piece by piece or level by level.

Every procedure has exactly eight operands, many of which will be NULL for most procedures:

op(1, eval(r)); #parameters (which you called "arguments") with their types
op(2, eval(r)); #locals
op(3, eval(r)); #options
op(4, eval(r)); #remember table
op(5, eval(r)); #description
op(6, eval(r)); #declared globals
op(7, eval(r)); #lexicals
op(8, eval(r)); #declared return type

This list, with (very brief) definitions of those terms, can be found at ?proc. A procedure's statement sequence isn't one of its operands, but, as you can see above, ToInert gives this information.

Parameters have a type only if you declare them to have a type, which you didn't for your r. Likewise for the return type of the procedure. If you want to give these things types, then do something like:

r:= proc(x::algebraic)::algebraic; x^2 end proc;

An argument is what a parameter gets replaced with. So, if you subsequenty issue the command

r(3);

then 3 becomes the argument for parameter x.

@toandhsp Yes, the syntax of add was expanded in Maple 2015 to allow one argument. For Maple 18 and earlier, one-argument add needs to be replaced with (`+`@op) (when the argument is a list or set).

AllDistinctIntegerSquares:= proc(C::[integer,integer,integer], R::posint)
uses LT= ListTools;
local
     L, s, p, V, X, c, S,
     CP:= combinat:-cartprod([seq([$ map(`+`, -R..R, c)], c= C)])
;
     for s in
          combinat:-choose(
               select(
                    X-> nops({X[]}) = 3 and (`+`@op)((X-~C)^~2) = R^2, #on the sphere
                    {'CP[nextvalue]()' $ (2*R+1)^3}
               ),
               3
          )
     do
          if nops(op~(s)) <> 9 then next end if;
          for p in combinat:-permute(s) do
               V:= map(`-`, p[2..3], p[1]); #adjacent sides vectors
               S:= [p[1], p[2], p[2]+V[2], p[3]];                
               if
                    nops({op~(S)[]}) = 12 and  #all distinct integers
                    inner(V[]) = 0 and         #two adjacent sides at right angles
                    `=`((`+`@op@`^`~)~(V,2)[]) #equal-length diagonals
               then
                    L[S[]]:= ();
                    break
               end if
          end do
     end do;
     map(`?[]`, {entries(LT:-Classify(convert, {indices(L)}, 'set'), 'nolist')}, [1])
end proc:

@MrYouMath If you have Maple 16 or later, you can download Iterator for free from the Maple Applications Center, and I highly recommend it.

However, this will work in older Maple:

n:= 4:
CP:= combinat:-cartprod([[0,1]$n]):
subsMatrix:= <seq(<CP[nextvalue]()[]>^+, k= 1..2^n)>;

A:= [seq(a[i], i= 1..n)]:
CP:= combinat:-cartprod([[0,1]$n]): #Need to re-initialize the iterator!
subsEqs:= [seq(select(e-> rhs(e)=0, A=~ CP[nextvalue]()), k= 1..2^n)];

Let me know if that works. You still haven't said your Maple version. Please edit the Question's header.

@gkfighting I'm not sure what you mean by "number each sum", but for numeric evaluation you can do something like this:

eval(%, [k= 100, l= 100, x= .3, y=.4, a= .5, b= .6]);
eval(subs(Sum= add, %));

This'll work regardless of which of the sum expressions that you use.

Here's a version that'll work on older Maple. It uses combinat:-cartprod instead of Iterator:-CartesianProduct. I also added some significant efficiency improvements based on the coordinates being distinct integers.

AllDistinctIntegerSquares:= proc(C::[integer,integer,integer], R::posint)
uses LT= ListTools;
local
     L, s, p, V, X, c, S,
     CP:= combinat:-cartprod([seq([$ map(`+`, -R..R, c)], c= C)])
;
     for s in
          combinat:-choose(
               select(
                    X-> nops({X[]}) = 3 and add((X-~C)^~2) = R^2,
                    {'CP[nextvalue]()' $ (2*R+1)^3}
               ),
               3
          )
     do
          if nops(op~(s)) <> 9 then next end if;
          for p in combinat:-permute(s) do
               V:= map(`-`, p[2..3], p[1]);
               S:= [p[1], p[2], p[2]+V[2], p[3]];                
               if nops({op~(S)[]}) = 12 and inner(V[]) = 0 and `=`((add@`^`~)~(V,2)[]) then
                    L[S[]]:= ();
                    break
               end if
          end do
     end do;
     map(`?[]`, {entries(LT:-Classify(convert, [indices(L)], set), 'nolist')}, [1])
end proc:

@gkfighting I seriously doubt that Maple can put the expression into the form (23) through any mathematically valid simplification/transformation process. Actually, I can't get Maple to even verify that the two forms are equivalent. Maple's ability to manipulate symbolic sums is limited---must less than its ability to manipulate symbolic integrals. Plus, while form (23) may look simpler, in some senses it is not because it's a quadruply nested sum. The form that I put it in has no nested sums.

Regarding your second question: It's beyond my mathematical knowledge. Hopefully someone else with more knowledge will respond.

@toandhsp You can if you download the Iterator package from the Maple Applications Center.

I deleted your immediately prior cruder form of this Question.

@Markiyan Hirnyk Here is the relevant paper directly uploaded to MaplePrimes: NumericMinimalSurfaceAlgorithm.pdf

You're right: It shouldn't return NULL. I'd consider a case where it returns NULL a bug. For a transformation, Maple should return either an expression or an error message. The returned expression may be the same as the input expression (we call it returning unevaluated) if the computation is too complicated to perform. So, would you please show the expression for which you get NULL output? For the example that I tried, I get unevaluated output:

inttrans:-mellin(LerchPhi(z, 1, 2), z, s);

     mellin(LerchPhi(z, 1, 2), z, s)

First 399 400 401 402 403 404 405 Last Page 401 of 709