Carl Love

Carl Love

28025 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@janhardo I agree that there are some weaknesses in VV's proof, which can be easily corrected:

  1. It should be verified that the original series converges.
  2. The indefinite integration should include a constant of integration.
  3. The integrand rather than the intgeral should be converted to a formal power series.

This is not a proof by induction.

Why do you want a workaround? In other words, why do you want the absurd multiline string to pass through mint? I think that mint should be stricter than regular Maple. Personally, I would never use a multiline string.

Here is a procedure for computing orbits under modular matrix multiplication:

Orbit:= proc(L::Vector, M::Matrix, m::posint)
uses LA= LinearAlgebra, LAM= LinearAlgebra:-Modular;
local 
    Mm:= LAM:-Mod(m, M, integer), L0:= LAM:-Mod(m, L, integer),
    Orb:= Array(1..1, [L0]), L1:= LAM:-Copy(m,L0), k, x
;
    for k from 2 do
        L1:= LAM:-Multiply(m, Mm, L1);
        if LA:-Equal(L1,L0) then return [seq](x, x= Orb) fi;
        Orb(k):= L1
    od
end proc
:
L:= <3, 4>: M:= <3, 4*168; 4, 3>:
Orbit(L, M, 5);

 

Your code doesn't work. If it did work, the answer to your question would be

plot(eval(Am, x= 0), kt= -1..1)

 

@janhardo The FPS stands for Formal Power Series, so the command convert(F, FPS) is essentially expanding the integral as a series.

If you changed the integral from x= 1..42 to x= 0..42, then you could use as the integrand value at x=0 (because sin(0)=0). Then you'd have an odd number of nodes.

With any number of nodes at least two, you can use the trapezoid rule, but assuming the underlying function is smooth, Simpson's will be far more accurate if you can get an odd number of evenly spaced nodes.

@miasene Please post a worksheet. The issue may be related to version and may be easily fixable.

@666 jvbasha You'll need to describe how the contour plot that you want is different from the contour plot that you show.

@acer Perhaps incorrect was the wrong term; I didn't mean syntactically. Perhaps logically incorrect or stylistically incorrect would be better. What I mean is that it was more-or-less merely a coincidence that it wasn't syntactically incorrect---even in 2020---the coincidence being that the procedure has no usesoptions, or description.

As you've pointed out, the "naked" semicolon terminates a NULL statement, and any statement marks the end of the procedure's header.

The reason that I bring it up is that I think that the OP and many other readers misunderstand both the semicolon and what exactly constitutes a statement.

@janhardo The problem of plotting the tread-riser pattern is complicated by these two issues:

  1. There is always one more x-value than there are y-values.
  2. It's not clear whether the "extra" x-value is the left extreme or right extreme; that somewhat depends on whether it's a left, right, or midpoint sum.

I thought about a simple way to handle those issues for a long time (about three hours while drifting in and out of sleep (I sleep with my computer with Maple open.)) before I posted my Answer. I think that you're struggling with these same two issues. My solution is to have lists rather than 2: EF, and X. Lists are like simplified arrays, and it's often better to use them when they'll do the job. is the x-values of the partition (including the left and right extremes of the interval). is the x-values where evaluations occur (either the left, middle, or right of each subinterval). is the y-values, and it's equivalent to applying f to all the values in E. The seq in my plot,

[seq]([[X[k],0], [X[k],F[k]], [X[k+1],F[k]], [X[k+1],0]][],

draws the left-side vertical, the top horizontal, and the right-side vertical for every rectangle. Although this duplicates the interior verticals, I thought that pedagogically that that was the right choice.

 

Is your Array 1-dimensional? Do its indices start at 1?

You have a one-variable function. I think of contours (aka level curves) as something one plots for two-variable functions. So what do you mean by "contour", and what do you mean by "a" contour?

@mmcdara The reason that your file will not load is that it has a special character in its filename.

@David Sycamore 

I'm glad that you got some use out of the Programming Guide. I hope that you continue to study it.

You wrote:

  •  I wrote a code to find ... k1, k2 for each prime up to a limit.

Please post your proc that finds both k1 and k2. (But I don't care about the one that just finds k1.)

  • I have also looked again at your code and seen that k1,k2 are not the same as K1 and K2.

It disturbs me that you write "k1,k2" (repeatedly) with no space after the comma. I wonder if that is somehow connected to your problems understanding.

  • [O]nly k1,k2 are given initial values.

Not all variables need to be initialized. A variable that counts something iteratively needs to be initialized to 0.

  • [T]he 'name' of the proc is k1k2 and that this is never used (called) again.

There's usually no reason to use a procedure's name within the procedure itself; sometimes, but only rarely, that is needed.

  • I dont know what K2[p] and K1[p] mean but they seem to be assigned (using :=) to the current values of k2 and k1....

Making a direct assignment to an indexed variable, such as A[...]:= ..., causes A to be a table (see ?table). In my procedure, K1 and K2 associate their respective values of (the prime) with the corresponding value or k1 or k2. A table is like a function defined on a finite set, where I mean function in the mathematical sense.

  • [T]he final values of k1,K2 are delivered but now there are no square brkts [ ] following them.

You mean K1 and K2. The procedure's output is the pair of tables K1 and K2 in their entirety. Square brackets would be used to select specific entries.

  • I tried to adapt your code to tell me the values k1,k2 in sequence format....

This doesn't require any modification to the procedure itself; rather, you do it after the procedure is called. Only do this with a small value such as 100 used for the number of primes, or else an overwhelming amount of information will be displayed:

(K1,K2):= k1k2(100):
entries(K1, pairs, indexorder);
  2 = 1, 5 = 2, 11 = 3, 17 = 4, 23 = 5, 29 = 6, 37 = 7, 41 = 8, 
  47 = 9, 53 = 10, 59 = 11, 61 = 12, 67 = 13, 71 = 14, 73 = 15, 
  79 = 16, 83 = 17, 89 = 18, 101 = 19, 107 = 20, 113 = 21, 
  127 = 22, 131 = 23, 137 = 24, 139 = 25, 149 = 26, 163 = 27, 
  167 = 28, 173 = 29, 179 = 30, 191 = 31, 197 = 32, 199 = 33, 
  223 = 34, 227 = 35, 229 = 36, 233 = 37, 239 = 38, 251 = 39, 
  257 = 40, 263 = 41, 269 = 42, 277 = 43, 281 = 44, 283 = 45, 
  293 = 46, 307 = 47, 311 = 48, 313 = 49, 317 = 50, 331 = 51, 
  347 = 52, 353 = 53, 359 = 54, 373 = 55, 379 = 56, 383 = 57, 
  389 = 58, 397 = 59, 401 = 60, 419 = 61, 431 = 62, 433 = 63, 
  443 = 64, 449 = 65, 457 = 66, 461 = 67, 463 = 68, 467 = 69, 
  479 = 70, 491 = 71, 499 = 72, 503 = 73, 509 = 74, 521 = 75, 
  541 = 76

#And likewise:
entries(K2, pairs, indexorder);

You quoted my procedure. At the end, you have

end proc
:
(K1,K2)

This leads me to believe that you mistakenly think that that (K1,K2) at the bottom are part of the procedure. They are not. The procedure ends at end proc.

 

@pik1432 

There are many ways to input a coefficient matrix using Maple's 1D input. I'd guess that there are more ways to do it than there are for inputting any other structure. In the way that I used, the rows are separated by semicolons, and the entries within each row are separated by commas. Adding line breaks and indentation is always syntactically valid, so this can be used to make the input itself look like a matrix. For example, the coefficient matrix above could be input as

C:= < 
    #xl12 xl13 xl23
      1,   1,  -1;
      1,  -1,   1;
     -1,   1,   1
>; 

As always in linear algebra, each matrix column represents the coefficients of a particular varable. 

In Matrix and Vector construction, the angle brackets ... are always used in a left and right matched pair, just like parentheses ... ), square brackets [ ... ], and curly braces ... }. Of course, these angle brackets are the same ASCII keyboard characters as the less-than and greater-than symbols.

column vector is specified in angle brackets with commas separating the entries. In the case above, I could've used

X:= <
    X1,
    X2,
    X3
>;
xl:= < 
    xl12,
    xl13,
    xl23
>;

row vector uses as the separator, for example R:= < 3 | 5 | 7 >. (The code in my Answer above didn't use any row vectors.)

A Matrix or Vector can be multiplied or divided by a scalar coefficient using the familiar and operators; so C/2 divides every entry of my above by 2.

The command LinearAlgebra:-LinearSolve(A, b) solves the matrix equation Ax = b for column vector x(It can also be used if b is a matrix.) 

The elementwise operator can be appended to another operator, such as =~, to indicate that an operation is to be applied to the elements rather than to the vectors as a whole. Scalar multiplication is automatically elementwise, but C/2 could also be written C/~2 if you want.

So, given the input above, your solution can be found as 

xl =~ LinearAlgebra:-LinearSolve(C/2, X)
          

First 188 189 190 191 192 193 194 Last Page 190 of 708