Carl Love

Carl Love

28020 Reputation

25 Badges

12 years, 300 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

The functions of x are just dead weight in your computation because there are no differential operations with respect to x. You might as well just make your equation

fracdiff(u(t), t, 1/2) = sqrt(t)/GAMMA(3/2)

That'll make it easier to solve regardless of the method you use (Maple, other CAS, by hand).

Of course, although this equation is in a sense trivial, it's still beyond the documented capabilities of intsolve.

@Kitonum That's a good and interesting example. Note also that add('1,2,3') works, showing that the issue is specifically evaluation, not directly the presence of a variable.

@acer Thanks for the tip. I was refining the whole code anyway, and I had already added option 'real' to the solve command, although I'm not completely confident that that'd eliminate the nonreal problem. To be safer, I'll also filter the floats for nonreals. What do you think?

@janhardo Before I expend too much effort trying to explain the procedures, I need to know whether you understand the math behind this, So, please describe in your own words the method of classifying critical points of multivariate functions known as the "Second-Derivative Test".

Re finding good plot ranges: We have a list of critical points, each with x, y, and z values. Let's say we want the x range. Extract the first coordinate from each point in C. Let m be the minimum of these, and let be the maximum. We don't quite want to make the range just m to M; we want some margin on each side of that. So, we make the range (m - r*(M-m)) .. (M + r*(M-m)) where 2*r is the desired fraction of the overall width that should be margin.

@tomleslie Both sqrt(a) and a^b are uniquely defined and positive for any a > 0b::real. The "cannot determine" issue isn't due to ambiguity; it's due to Maple avoiding floating-point evaluation of symbolic constant expressions unless the user forces it to with is or by some other means.

@bmartin Given that the OP wishes to access the posted procedure from a library, the with command (used at the top level) wouldn't be appropriate, and it doesn't work correctly if used within the procedure (as explained at ?with).

@nryq I put my code for the plot of #2 under my earlier Answer.

@nryq To plot #2, the sphere-capped cone, you need to know that the sphere's center is [0, 0, 1/2] and its radius is 1/2. This Answer doesn't cover the steps (completeing the square) to do that. It's just simple algebra that I find easier to do in my head than with Maple.

Cone:= z=sqrt(x^2+y^2):
Sphere:= z=x^2+y^2+z^2:
simplify(
    changecoords([Cone, Sphere], [x,y,z], cylindrical, [rho, phi, z]),
    symbolic
);
                    [                2    2]
                    [z = rho, z = rho  + z ]
plots:-display(
    plot3d~(
        [[z, phi, z], [sqrt(z-z^2), phi, z]],
        z=~ [0..1/2, 1/2..1], phi= -Pi..Pi, coords= cylindrical,
        scaling= constrained
    )
);

MaplePrimes isn't letting me copy-and-paste plots anymore! You'll need to run the above to see the plot. It looks like a squat ice cream cone.

@dharr The significant difference, which is obscured by your use of 2D Input, is that you've used t__1 instead of the OP's t[1].

@acer Thanks for finding the error. It's now fixed in the Answer above.

@Jennzy26 You've asked many Questions over the past few days, and you've received several Answers with Maple code. But I haven't seen you try to write any. Can you try to write some, even if it's completely wrong? Then I'd be willing to help you correct it.

And, before you can code a solution, you need to understand the math. So, do you understand that my hint implies solving the extremely simple equations {f '(p) = tan(Pi/3), f '(q) = tan(-Pi/3)} where f(x) = 1-x^2, and then the points are P = (p, f(p)), Q = (q, f(q))?

@nm I understand the problem, but I have no workaround at this point. From my experiments so far, it seems that in the declaration

option object(parentclass);

the name parentclass must be global and already defined as an object module. There are still many things in Maple that need global names (such as procedures named `<some command>/...`).

Nonetheless, if you're willing to use a global name for the parent, it seems like inheritance, overriding, and polymorphism work as described in my Answer above.

Using Maple's object-oriented facility, you can create objects that will display (or print) in the ways that we've already discussed in this thread but can still be treated as ordinary Maple mathematical expressions. You can redefine what any of the arithmetic operators (such as +^) do when used with these objects. You can define what happens when the object is applied as a function to an argument or argument sequence. You can define what happens when the object is given an index or index sequence (such as the [i,j] in A[i,j]).

@Sradharam The presence of fractional powers of lambda makes the coefficient extraction a little bit tricky. I suggest replacing lambda with 1/L^2 from the start and then substituting L= 1/sqrt(lambda) after the coefficients are extracted, like this:

restart:
ODE:= ... your original

#new f, using L instead of lambda:
f:= x-> f__0(x) + L*f__w*f__1(x) + L^2*f__2(x):
 
Coeffs:= proc(
    e::{`=`, thistype}(algebraic), x::{thistype, list, set}(name)
)
local 
    t, 
    C:= coeffs(
        collect(`if`(e::`=`, (lhs-rhs)(e), e), x, 'distributed'), 
        x, t
    )
; 
    table([t]=~[C])
end proc
:
C:= table(subs(L= 1/sqrt(lambda), op(2, Coeffs(ODE, [L, f__w])))):

#List all appearing lambda^a*f__w^b combos ("1" is terms with no
#lambda, no f__w):
[indices](C, nolist);
[                            2                   3              
[     1        f__w      f__w       1        f__w         1     
[1, ------, -----------, ------, -------, -----------, -------, 
[   lambda        (3/2)  lambda        2        (3/2)        3  
[           lambda               lambda   lambda       lambda   

                                 2 ]
     f__w         f__w       f__w  ]
  -----------, -----------, -------]
        (5/2)        (1/2)        2]
  lambda       lambda       lambda ]

#Extract a coefficient:
C[1/lambda];
         /  3         \ /  2         \ /  2         \
         | d          | | d          | | d          |
    36 K |---- f__0(x)| |---- f__0(x)| |---- f__2(x)|
         |   3        | |   2        | |   2        |
         \ dx         / \ dx         / \ dx         /

                                           2
              /  3         \ /  2         \ 
              | d          | | d          | 
       + 18 K |---- f__2(x)| |---- f__0(x)| 
              |   3        | |   2        | 
              \ dx         / \ dx         / 

           /  3         \             /  3         \        
           | d          |             | d          |        
       + 2 |---- f__0(x)| f__2(x) + 2 |---- f__2(x)| f__0(x)
           |   3        |             |   3        |        
           \ dx         /             \ dx         /        

                                           /  3         \
           / d         \ / d         \     | d          |
       - 2 |--- f__0(x)| |--- f__2(x)| + 3 |---- f__2(x)|
           \ dx        / \ dx        /     |   3        |
                                           \ dx         /

#Extract another:
C[f__w/sqrt(lambda)];
         /  3         \ /  2         \ /  2         \
         | d          | | d          | | d          |
    36 K |---- f__0(x)| |---- f__0(x)| |---- f__1(x)|
         |   3        | |   2        | |   2        |
         \ dx         / \ dx         / \ dx         /

                                           2
              /  3         \ /  2         \ 
              | d          | | d          | 
       + 18 K |---- f__1(x)| |---- f__0(x)| 
              |   3        | |   2        | 
              \ dx         / \ dx         / 

           /  3         \             /  3         \        
           | d          |             | d          |        
       + 2 |---- f__0(x)| f__1(x) + 2 |---- f__1(x)| f__0(x)
           |   3        |             |   3        |        
           \ dx         /             \ dx         /        

                                           /  3         \
           / d         \ / d         \     | d          |
       - 2 |--- f__0(x)| |--- f__1(x)| + 3 |---- f__1(x)|
           \ dx        / \ dx        /     |   3        |
                                           \ dx         /
#etc.

 

@janhardo The last line in my code box is an example that runs all three procedures on the same input, producing the same output. Sorry for not posting the output, but MaplePrimes makes that difficult for Vector/Matrix output, which I often prefer because it's columnar. 

@Rouben Rostamian Certainly that output is okay for many purposes, and this Reply is not meant as criticism. Rather, I want to point out a surprising tiny detail that most people who read typeset mathematics are likely not consciously aware of but which will become subconsciously bothersome if it's changed: The space between operands in implied multiplication is larger than the space between the operator and the left parenthesis of the arguments in a function application. Simply compare the prettyprinted output of f(x) and f*``(x).

First 108 109 110 111 112 113 114 Last Page 110 of 708