Carl Love

Carl Love

28015 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Traruh Synred There's still no attached file for this Question.

I'm even more interested (and likely more able to contribute) to your memory leaking problem, but there's also no code or attached file there either, despite my requesting it a few times. You've posted a lot of output there, but it's not very meaningful without seeing the code.

@sursumCorda That's an interesting timing comparison that you've made between Python and Maple, each making essentially the same calls to SMTLIB. Please post plaintext of your code so that I don't need to retype it.

*** Pure speculation below. Definitely needs to be verified! Future readers: Don't believe or repeat the next paragraph unless it has been verified!  ***

My first guess as to the slowness of your Maple version is that it's essentially reparsing\recompiling a string version of the problem on each loop iteration. One would hope that one purpose of the object returned by Session would be to avoid such reparsing. Indeed, reading the code showstat(SMTLIB:-Session), I see reentrant mentioned several times, which suggests to me that some sort of "hot active link" to the external code is being maintained. On the other hand, the help page ?SMTLIB,Session says that it's "for working interactively with an SMT solver", which suggests to me that every in-loop call to object methods Assert and/or Satisfiable does some reparsing.

*** End of pure speculation ***

I'm curious about the timing if you use Maple's built-in Python interpreter. See ?Python. 

There is no file attached to your Question.

@zenterix You wrote:

  •  I noticed that if we try to solve for R instead of T, ie solve(expr, R), we get no result.

You can't solve for R directly, but you can solve for %log[10](R):

solve(expr, %log[10](R))

Please give an actual example of two space curves for which you would like this done, using the form

[x(t), y(t), z(t)], t= a..b

For example, an upper semi-circle lying in the xy-plane would be

[cos(t), sin(t), 0], t= 0..Pi

Your 2nd example, 2 + x^2*y, is meaningless to me as a space curve. 

@vv Thank you for testing my procedure.

In all cases, my procedure's time is O(y), where is the y-value of the final output. In the cases that the OP has presented so far, y < < LCM(m). (In other words, the minimal has been quite surprisingly smaIl in the OP's cases that we've seen here.) I don't know whether this is coincidence or whether it has to do with details of the OP's overall problem that we haven't seen yet.

My procedure does not automatically reduce the moduli when it's possible to do so. It could easily do that; I simply didn't implement it. In the cases presented so far, the 3rd and 4th moduli can be reduced to 23^2 and 17^2 (as you noticed in your first Answer). Using these reduced moduli, I get the result for your 6-equation example in about 2 minutes, [X = 5220211473, Y = 10734787609]. I am considering some ways to reduce that time.

@sursumCorda Your code is slow for two reasons:

  1. It's checking every value of y starting from 1.
  2. It's redoing the harder modular arithmetic for every one of those y.

First of all, we can prove that any y solving the equations alone (i.e., irrespective of the inequalities) is a multiple of 91. So 90/91 of your iterations don't find any solution. Second, the vast majority of the modular arithmetic required for this can be done once and for all by a single call to chrem.

I see that the "Product: " in the header of this Question has been changed from "Maple Calculator" to just "Maple". In Maple, the above series can be obtained by

convert(GAMMA(a,z), Sum, z= 0);

and making a few minor (high-school-algebra-level) simplifications to enhance the presentation.

 

@Traruh Synred I meant to just run the memory-measuring procedure 100 times to check whether it itself was contributing to the leak.

To diagnose the potential leak further, we need to see your code. You have thought that you've uploaded code a few times before, but it never seems to have worked. Can you describe what you do, exactly which buttons you press?

If need be, you can email me your worksheet. Use the "More" -> "Contact author" pull-down at the bottom of this message to send me a preliminary email, and then I'll send you an email address to use to send the file.

@C_R The double-arrow from the palette is being treated as an &-operator, which means that it has higher precedence than any other operator in the expression. So its left operand doesn't include the initial not. Both the left and right operands of <=> need to be parenthesized. 

As a completely separate issue, you also need to stop the automatic simplification of the right operand by making it (``(not P) and ``(not Q)) (using your desired palette symbols).

Doing these two things, I get this output for the 1st Law:
 

@Traruh Synred Initializing a variable in the same line that it's declared makes no difference.

Try running it 100 times in a row. Can't draw conclusions from just 2 runs.

I wouldn't call this a "tutorial", but it'll be a useful starting point if you haven't seen it already

help("OpenMaple,Python,API");

@Traruh Synred You wrote:

  • I add the 63-word array that 'kerneloptos(memoryuse)' creates. 'MemoryInUse' doesn't do that. 

What makes you say that? Although it doesn't use an array per se, it does essentially the same thing using a list of lists. See its code via

showstat(MmaTranslator:-Mma:-MemoryInUse);

Local variables do get deleted when they go out of scope. For example,

MemUse:= proc() 
local M:= Array(kernelopts('memusage'))[..,3], x;
    add(x, x= M) 
end proc:

After calling MemUse()is inaccessible and gets deleted by the garbage collector.

Your header says "Maple Calculator". Do you just want to see the series for reference? If so, you could just look it up in an online reference. Or do you want it to do some calculations? I don't think that Maple Calculator is very practical for something that elaborate; not sure. I don't mean that it's incapable, just that entering and manipulating the formulae is awkward.

@vv I think that a reasonable and feasible goal for future Maple would be to give the mimimal exact integer solution to Archimedes's Cattle Problem, which is a famous ancient problem of the type in this Question. The answer has 206,545 digits, which is well within the capability of Maple's GMP integers.

First 36 37 38 39 40 41 42 Last Page 38 of 708