Carl Love

Carl Love

28035 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@nm The multiline string is valid Maple syntax; you haven't overlooked anything. But it's okay with me if mint is stricter than regular Maple. I want it to flag anything weird, because they may have been unintentional. I take the output of mint as "advice".

That being said, I do think that what mint says in this particular case and the interaction between the string and the if statement are very weird.

@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.

 

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