Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

I don't think that this is ever supposed to happen: I get different results from using `assuming` in infix operator form:

int(GAMMA(a,s)*exp(-b*x), s= 0..infinity) assuming b > 0, a > 0

This gives me the simple result that you were expecting. However, the functional form,

`assuming`([int(GAMMA(a, s)*exp(-b*s), s = 0 .. infinity)], [b > 0, a > 0])

returns unevaluated. I believe that assuming commands entered in 2D Input are always converted to the functional form before execution. Note that `assuming` is a Maple-language procedure on which you can run showstat, trace, etc. I've done that, but I can't figure out what's going on.

 

@tomleslie wrote:

  • What you have is a simple substitutional code which converts a supplied integer to a text message. Pretty sure this has nothing to do with any RSA cryptosystem.

The steps for encrypting via RSA (and other cryptosystems based on modular arithmetic) are

  1. Break the plaintext up into string chunks of a length such that when they're converted to numbers, the modular arithmetic will be injective (i.e., one-to-one).
  2. Convert each chunk into an integer. Simply converting the bit pattern into a binary integer is sufficient.
  3. Apply the mathematical part of the algorithm to those integers.
  4. Output the new integers in a suitable format (possibly encoding as characters).

To decrypt, those steps are simply done in reverse (of course with some variation of the mathematical part). The OP's procedure is the second-to-last of those steps.

@dharr I'm saying that the same mechanism does work in a Code Edit Region.

@dharr Thanks, that's helpful. In a Code Edit Region, if you hover over the wavy line, a tooltip appears in a few seconds to say what the error is. But I almost always know what the problem is anyway.

@vv Yes, agreed, there's not much point in doing this for end-use in1D Input. But it's useful to program it in 1D for a 2D end user.

An unevaluated return allows a bit more finesse:

`⨂`:= (A,B)-> 
   `if`([A,B]::[rtable$2], LinearAlgebra:-KroneckerProduct(A,B), 'procname'(A,B))
:

 

@vv Since the symbol in question in ASCII is `⨂`, you might as well just do

`⨂`:= LinearAlgebra:-KroneckerProduct;

In other words, the OP's desired symbol is already a neutral operator.

@acer Thank you, that's useful information. I recall the Question and Answer to which you referred. I wouldn't have intentionally put a blank line at the top, nor was I aware of one being there unintentionally, but I understand how my typing and mousing could lead to a stray one getting there. Also, I didn't intentionally collapse the Region, but I can also see that accidentally happening. From my POV, I was working elsewhere in the worksheet, far enough down that the Region (which was fully expanded) was off-screen. When I scrolled back up, it was gone.

@Kitonum Certainly there are some nontrivial combinations of the parameters Pr, lambda, and s for which Maple can "do" the integral that dsolve returns. One that works is Pr= 1, lambda= 1, s= 1.

@student_md You forgot about making X a Vector. Do something like X:= tau-> Vector(n, i-> xi[i](tau)).

I think that using x for gamma is a bad and confusing choice! How about gamma__0 (the 0 could be anything else)?

I don't think that there's hope for a symbolic solution because of the summation in f. I don't think that there'll be any problem getting a numeric solution (except perhaps if M is singular for some parameter values).

Although it's not an error, in the f definition you should change (i,j)-> to i->. Maple syntax allows unused extra parameters, but clearly in this situation there's no reason, plus it's confusing to the reader.

This is totally not your fault---just an unfortunate aspect of the various languages in use here (English, Maple jargon, and Maple code)---that you cause confusion both for yourself and others by using the word "table". There is perhaps no other word that's commonly used in all three of those languages that has as many different meanings.

Rather than listing the numerous possible meanings, perhaps it'd be easier if I asked you to simply define precisely what you mean by "table". And perhaps it'd be even better if you said precisely what you intend to do with a "table" once I show you how to obtain one from your graph.

@Rohith The following two situations are completely different, and require totally separate treatment:

  1. The function appears as a factor of the denominator, e.g., ln(x)/(a*sin(x))^2
  2. The function appears as a term of the denominator, e.g., 1/(a+2*sin(a)^2)

So, which of these is your situation?

@vv wrote:

  •  If you use the compiler, why do you keep the evalhf part?

The evalhf procedure and the compiled procedure do different things. The evalhf procedure is not used for the Binomial computation. It would be used, for example, for Mul(k^2, k= 1..10) mod 7. Its first argument is a dynamic procedure. I don't think that it's currently possible to pass that to compiled code.

  •  BTW, the compiler does not accept max with >2 arguments, you must change this.

Apparently this varies among compilers, because I had no trouble with it. Nonetheless, I removed it so that it will work for all.

  • without try/catch...

What??? What problem do you have with try/catch? Surely it must be used with any compiled code because it is so easy for it to error.

  • I also don't thing that recursion is useful (I have mentioned this in a previous comment).

And I mentioned in a comment below from about a week ago that I wasn't using recursion. My code does not now, nor did it ever, use recursion. I mentioned recursion before, but I was using the word incorrectly.

@jga I just posted new code and worksheet in the Reply three spaces above to address all the issues that you and VV brought up. Apparently my compiler is different than yours and VV's and mine accepts the three-argument max. Nonetheless, I removed it so that the code will work for all. (Reading ?Compiler,Compile, it certainly seems possible that there are various compilers in use.)

Regarding your time testing: For your time test of Maple's own binomial: Timing values that small are nearly all noise and have no relation to times that you'll experience in actual usage. They are smaller than the finest resolution of the "instrument" used to measure them. Don't believe the three decimal places. To test accurately, you need to repeat the operation many thousands of times using different input. I show an example below.

Regarding your time test of my Binomial: You are effectively only measuring the time required for the compiler to do its thing (returning an error in this case). The time for the Maple-level Binomial code is so small in comparison that it wouldn't change the last decimal place on those times.

Here's how to do realistic timings (this example is also in the worksheet):

(N,K,P):= 
   #3 64 x 64 matrices with roughly 4-digit entries
   rtable((1..2^6)$2, random(0..2^12)),
   rtable((1..2^6)$2, random(0..2^11)),
   nextprime~(rtable((1..2^6)$2, random(0..2^10)))
:
B1:= CodeTools:-Usage(
   Binomial~(N,K) mod~ P
):
memory used=16.22MiB, alloc change=8.00MiB, cpu time=109.00ms, real time=123.00ms, gc time=0ns

B2:= CodeTools:-Usage(
   binomial~(N,K) mod~ P
):
memory used=1.00GiB, alloc change=80.00MiB, cpu time=3.69s, real time=3.19s, gc time=1.33s


LinearAlgebra:-Equal(B1,B2);
              true

 

 

 

 

@vv The ability to diagnose the situation would be improved greatly by a positive case: that is, some input to isolve that returns with _SolutionsMayBeLost set. What it's set to doesn't matter much.

I based what I said largely on the fact that there have been a great many changes to solve since Maple 10, whereas the style of the isolve code suggests that it hasn't been updated in a very long time.

Do (and prepare for disappointment):

showstat(isolve);
showstat(`isolve/isolve`);
trace(solve):
sys:={x+y=10,x^2-y^2+z^2=1};
isolve(sys, n);

So, despite over a 100 lines of code, pretty much all it does is pass the problem to solve and then make a minor adjustment to what solve returns. I think that the setting of _SolutionsMayBeLost is entirely up to solve.

First 294 295 296 297 298 299 300 Last Page 296 of 709