Carl Love

Carl Love

28150 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@janhardo The issue is not the language (English, etc.) in which the books are written; rather it's the mathematical level. In textbooks of mathematics below the calculus level, log usually does mean the base-10 logarithm, even in English. Elementary calculus textbooks (say, the first three courses), usually use ln for the natural logarithm, use log[b] for base-b logarithms, and don't use unsubscripted log at all. In even higher-level mathematics texts (such as any text on complex analysis), unsubscripted log simply means the natural logarithm.

@janhardo I'll go through the code line-by-line (except for things that I think you already understand):

J1:= subs((SUB:= t= alpha+beta*I), J);

I'll guess that you can figure out the meaning of the embedded assignment (SUB:= t = alpha+beta*I). The syntax requires that embedded assignments always be placed in their own parentheses, even when those parentheses seem totally redundant.

J2:= evalc([Re,Im](J1));

If S is any operator (function) or sequence of operators, and x is any argument or sequence of arguments, then [S](x) is the list of all members of S applied to x (and the analogous thing works for {S}). So, [Re,Im](J1) is the same as [Re(J1), Im(J1)]. The evalc automatically maps over lists, so the end result of this command is a list with the real and imaginary parts of the integral J1.

J3:= J2 =~ simplify(value(J2));

The value causes the inert integrals Int to be evaluated, as if they were int. The value is specifically for converting inert functions to their non-inert form. 

If A and B are lists of equal length, then A =~ B is the list of equations of the form a=b for a in A, b in B. For example, [x,y] =~ [1,2] is the same as [x=1, y=2].

print~(J3):

The purpose of the ~ is so that the print is applied individually to the elements of the list J3 so that the results appear on separate lines and without square brackets.

simplify(
    convert(diff(evalc(Complex(rhs~(J3)[])), x), exp),
    {rhs=lhs}(SUB)
);

rhs stands for right-hand side. It's a command that extracts the right sides of equations. By using ~, it gets applied to each each element of list J3. The [] converts the resulting list into its underlying sequence, i.e., it removes the square brackets.

Complex(a,b) is the same as a+b*I except that it remains unevaluated until it's known that a and b are real; so, evalc thus forces that evaluation by temporarily assuming that all variables are real.

convert(..., exp) converts functions such as sin and cos into exp form.

{rhs=lhs}(SUB) switches the sides of the equation SUB and puts the result in a set.

simplify(..., {...}) is a form of simplify known as simplify with side relations. The second argument is a set of equations. The first argument is simplified using the information from the equations. The purpose of this in this case is to convert alpha+beta*I back to t.

@janhardo No, absolutely not. Where your book says log, it means the natural logarithm (using base e), the same thing as ln. Maple knows this also:

log(100.);
         
4.605170186 

In calculus, logarithms are always natural logarithms unless it's explicitly stated elsewise, and angles are always measured in radians.

I would guess that deleted material is stored somewhere; however, the Moderators who delete it have no access to it nor any knowledge of where it's stored.

@nm Okay, I thought that your main issue was timelimit not working since you've written about that many times before, and it is the point most emphasized in your Question.

If you add assuming x > 0 to the dsolve command, it returns the explicit solution in half a second. For x < 0, I guess that there are a countable infinity of branched solutions, and this may be confusing dsolve.

@janhardo There is no log10 in formal abstract calculus, where log (no subscript) means the natural logarithm and can also be denoted ln.

@janhardo If I post a plaintext transcription of a Maple session, the red text is the input and the blue text is the output. You generally can't copy-and-paste the output for reuse as input, which is what you did with my last line exp(x t).

If you differentiate an indefinite integral (both operations being performed with respect to the same variable), you get back the integrand not the integral. The integrand is exp(x t).

Try this:

restart; 	
J:= Int(exp(t*x), x);
J1:= subs((SUB:= t= alpha+beta*I), J);
J2:= evalc([Re,Im](J1));
J3:= J2 =~ simplify(value(J2));
print~(J3):
 
#reversion to original integrand:
simplify(
    convert(diff(evalc(Complex(rhs~(J3)[])), x), exp),
    {rhs=lhs}(SUB)
);
                            exp(t x)

 The output of print~(J3): should be exactly the integral formulas that you're looking for.

@mmcdara The Iterator package (I think it's from Maple 2016) is for high-speed, low-memory generation of combinatorial objects; it's not for arithmetic and can't help with this. The above computation can be speeded up substantially with evalhf, which I'm thinking about now.

@jennierubyjane You can include fixedparameter in the eval call in the dsolve call by replacing Pr= L[k] with

{Pr= L[k], fixedparameter[]}

But you can't use Nb=0 because Nb is a denominator in one of the ODEs.

Here's an interesting fractalish plot:

A:= Iterate(x-> 3.7*x*(1-x), 0.23, 10^7): #using same Iterate defined above
T:= Statistics:-TallyInto(A, 0..1, bins= 1000):
PlotIt:= proc(T::list(range(realcons)= nonnegint))
local r:= op~(1,T), L:= lhs~(r), R:= rhs~(r), F:= op~(2,T);
    plot(
        `[]`~(`[]`~(L,0), `[]`~(L,F), `[]`~(R,F), `[]`~(R,0)),
        color= black, thickness= 0
    )
end proc
:
PlotIt(T);

@janhardo After differentiating the evaluated integral, you can get back to the original integrand like this:

J:= Int(exp(t*x), x);
J1:= subs(t= a+b*I, J);
evalc(J1);
value(%);
simplify(convert(diff(%, x), exp), {a+b*I= t});
                            exp(x t)

The order of applying evalc and value doesn't matter.

@janhardo When you use the notation x+I*y, you're likely assuming, perhaps subconsciously, that x and y are real; however, Maple doesn't automatically assume this. It assumes that all variables are complex unless told otherwise, and regardless of the presence of I. The command evalc will temporarily assume that variables are real so that expressions can be separated into their real and imaginary parts. So, compare Re(x+I*y) with evalc(Re(x+I*y)).

It's not needed to explicitly have an I for complex operations to be used. They're simply used by default. For example, the derivative of sin(x) is cos(x) regardless of whether x is real. Unless told otherwise Maple is not assuming that it's real.

@Pepini The code that you showed doesn't actually use TallyInto; it uses Histogram instead. That's a fine alternative if you don't need programmatic access to the actual counts for some future purpose.

Here's complete code for your problem:

Iterate:= proc(f, x0::complexcons, N::posint)
local A:= Array(1..N, [x0], datatype= hfloat);
    evalhf(
        proc(f, A, N)
            for local k from 2 to N do
                A[k]:= f(A[k-1])
            od
        end proc
        (f, A, N)
    );
    A
end proc
:
A:= CodeTools:-Usage(Iterate(x-> 3.7*x*(1-x), 0.2, 10^7)):
memory used=76.30MiB, alloc change=76.30MiB, 
cpu time=2.83s, real time=2.85s, gc time=0ns

T:= Statistics:-TallyInto(A, 0..1, bins= 40);
PlotIt:= proc(T::list(range(realcons)= nonnegint))
local x;
    plot(
        [seq]([
            [op([1,1],x),0], [op([1,1],x),op(2,x)], 
            [op([1,2],x),op(2,x)], [op([1,2],x),0]
        ], x= T
        ), color= black, thickness= 0
    )
end proc
:
PlotIt(T);

It takes about 3 seconds to generate the 10 million points. The time for the tallying and plotting is too small to even measure.

@nm Please let me know if you find any cases where the identity method doesn't work, either false positive or false negative. I'd be surprised if there was a false positive (an incorrect p value returned), but not surprised at a false negative (no p found when the function is indeed isobaric). For any false negative, I wonder if any other general technique can find the p.

The documentation for solve(identity(...)) says that the syntax allows for the declaration of one free variable. I chose a to be the declared free variable, but x and y are also free. Thus, my confidence in this technique is not as high as it could be.  

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