Carl Love

Carl Love

28130 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@mmcdara I am only stating here what's required by the "envelope" algorithm used by Statistics:-Sample, not any more-liberal requirements that may be used in a mathematical statistics context. In particular, this algorithm requires the PDF, not the CDF. From the evidence that I've seen so far, this envelope algorithm is very efficient, at least in Maple 2018.

Regarding your translation: I think that you've mistranslated inflection point. In general, this means a point where a function is continuous and over which its second derivative changes sign. In other words, it's a point where the function changes from concave to convex or vice versa. So, the stated requirements are that the function be twice diffferentiable at all points in its support (though I don't think that the endpoint behavior actually matters), and that there be at most finitely many of these inflection points.

@Mariusz Iwaniuk It is a general weakness of piecewise, not of inttrans. To avoid these problems, I recommend that whenever piecewise is used to express a function of a single real variable (which is, of course, the most-common situation for using piecewise) that all the conditions be expressed in the form %op V[k] where each %op is <<=, or and V[1] <= V[2] <= ... <= V[n]. This will be possible in the vast majority of practical cases, but perhaps not all. 

Note that each condition can tacitly use the assumption that all conditions to the left of it have been false. Thus junk with and conditons like this is never necessary:

piecewise(t < 1, t, t >= 1 and t < 2, t^2, 0);

I see that junk with and all the time. Usually it works, but it makes me cringe.

@rsweet Yeah, I think that it's too many terms.

As an interesting aside, irrespective of the bug in limit---and at the risk of stating the obvious: If we define the limit function

B:= x-> Sum(s(2^n*x))/2^n, n= 0..infinity),

then this is a Weierstrass type fractal: a continuous nowhere differentiable function. The 2^n in the denominator makes it easy to prove it continuous, and the fact that s'(x) is always 1 or -1 (where defined) makes it easy to prove nowhere differentiable.

@jefryyhalim Note that to get Tom's symbolic solution, it's still essential that the "fudge factor" 1e-10 (which I called epsilon) be removed from your original code and /tan changed to *cot. I don't want you to go away thinking that that effort was for nought. When a problem like that "sticks out like a sore thumb" in the code, my first focus is removing that problem.

@acer Thank you so much for your very helpful comments, Acer!

1. Yeah, I thought that that random matrix took too long to generate. I didn't worry about it fixing it because it was just an example.

2. So, you're saying that my type declaration checks whether the Matrix is actually symmetric if it's not declared symmetric?

3. I realized that I was accessing in C_order, and I tried to adjust the algorithm for that, but it didn't work. I saw a time improvement, but the results were wrong. So, I'm eager to take a look at what you did.

[Later]

Now I've looked at what you did. Seems simple enough. Is there a good reason to convert the output to Fortran_order?

@acer I've traced is as far back as this erroneous result:

limit((frac(x) - 1/2)/(x - 1/2), x= 1/2),

which returns 0 even though it's clearly equal to 1.

@Desruim Yes, you're right that the period is 1/2. Apparently, I didn't follow my own proposition!, which is still correct. I will correct the text and look into that 0.

@Rouben Rostamian  Oh no, I totally missed seeing that 0!! I thought that the OP was asking why the derivative is 3. So, I spent all that effort to write a precise freshman-level explanation of why the derivative is 3... and now the OP is not likely a freshman.

I'll think about that 0.

My code above implements precisely the formulas on Slide #9 from the course notes that you linked: 

https://www.igpm.rwth-aachen.de/Numa/NumaMB/SS17/handouts/Handout20170516.pdf

Apparently, your professor calls this algorithm Cholesky-Verfahren.

Unfortunately, compiled Maple only allows some fairly "primitive" coding style. So, for example, you can't use add to do summation. There are two spots in the code where that would've been nice to have.

@Simwar You wrote:

  • I tried copying your improvements, but I seem to have a problem with the 'relation' in the end.

That was my fault. Sorry. Record needs to be with a capital R; I had record.

  • How exactly is double colon suposed to be understood? Not sure when it is used instead of definitions.

It is not used instead of definitions. When x::T appears as a parameter declaration, it means that the argument that is passed to x will be checked for its type (see ?type), and if it's not type T, an error will be issued. A parameter declaration can include a type, a default value (Is that what you mean by definition?), both, or neither.

  •  I don't quite understand how the satisfies command works and I couldn't find information regarding it.

It is not a command; it's a type (see ?type,satisfies).

  • Is it similar to satisfy or satisfiable?

It has no relation to Satisfy or Satisfiable, which are commands in the Logic package.

  • Why is "n->" needed?

The argument to satisfies must be a procedure that returns true or false. The n-> n >= x means exactly the same thing as proc(n) n >= x end proc, but is easier to type. 

  • Why are the forward quotes needed here on list, integer and range?

They aren't needed; the procedure will work without them. They are there to guard against the possibility that in some other code, perhaps totally unrelated code, you've globally set the value of integerlist, or range.

  •  Is it gonna show both the roll and the counter now? Are they both return values or how do I choose which one it is?

It'll show both. They are both part of the return value. If you want to separate them after calling sim, do

(roll, cnt):= sim(3, 12);

The first pair of parentheses above are not syntactically required; they're just my personal preference.

@Simwar I've added extensive instructional comments to my improved procedure.

Please post your complete code, showing the error message. You can upload a worksheet by using the green up-arrow on the toolbar of the MaplePrimes editor.

What do you intend to happen when you use 3 colors instead of 1?

And what is f0?

@acer I had forgotten that unevaluation quotes could be significant even in the proc line, but only on the right side of :=.

First 313 314 315 316 317 318 319 Last Page 315 of 711