Carl Love

Carl Love

28070 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Axel Vogt Hmm. You save first, then kill; I kill first, then save. If you run into another situation where you can't save first, give my method a try. Anyway, I think that's it's faster in all cases, but especially if the mserver is consuming most of your memory.

@Markiyan Hirnyk I edited the Answer, including more explanation. It's very frustrating to me that people would risk losing their unsaved work by killing the Java process. That's totally unnecessary.

@alisha shaikh NB is a standard abbreviation for "note well". The letters come from the Latin phrase meaning the same thing.

If there's any place where f is negative, complex numbers will enter the solution due the fractional exponent of f. It might be beneficial to include an initial approximate solution with f nonnegative.

@Christopher2222 Can you give me an example of what you mean by an attribute? Do you mean a type, like integer, string, etc.?

When you say "call the full list of the Record", do you mean that you want to see the contents of the fields without the field names?

@Vee The % refers to the output of the previous command (even if that output was suppressed). There's also %% and %%%: the former refers to the output of the command previous to the previous command, and the latter refers to the command before that. That's as fas back as you can go.

@Scot Gould Moderators can and do change Posts to Questions and vice versa.

  1. I don't see any boundary or initial conditions. Without these, a complete solution isn't possible.
  2. You should post your code as plaintext or a worksheet so that we don't have to retype it.
  3. Your system seems suitable for Maple's numeric PDE solver. See ?pdsolve,numeric for the syntax.

@Robert Israel Thank you, Robert. It's nice to see you on MaplePrimes. I've missed you, although I do occasionally see your posts on StackExchange.

This distinction between the probabilities in the continuous and discrete cases is what I was trying to capture with the word "infintesimal". Perhaps that word has a more-precise mathematical definition and I'm using it incorrectly.

 

@Christopher2222 

I converted it back to a Post.

It's an interesting question. I'd be impressed to see an algorithmic solution. Here's an ad hoc solution that gives 6": Your first fold essentially marks off a 2-1/2 x 8-1/2 rectangle of paper. If you fold down a corner of this, it marks off a 2-1/2 x 6 rectangle.

Doing it again reduces it to 2-1/2 x 3-1/2; and then again reduces it to 2-1/2 x 1. Now that we have 1", we can get any multiple of 1, although not necessarily by folds.

The general pattern is that if it's an a x b rectangle, a diagonal fold-down of a corner can produce a min(a,b) x (max(a,b) - min(a,b)) rectangle. Here's a procedure:

FoldRectangle:= proc(a::numeric, b::numeric, maxfolds::posint:= 9)
local r:= [min(a,b), max(a,b)-min(a,b)];
   if a=b then NULL 
   elif maxfolds=1 then r
   else r, thisproc(r[], maxfolds-1)
   end if
end proc:

FoldRectangle(17/2, 11);

   [17/2, 5/2], [5/2, 6], [5/2, 7/2], [5/2, 1], [1, 3/2], [1, 1/2], [1/2, 1/2]

These are just the sizes possible by a sequence of diagonal fold-downs of corners. If we allow folding in half, there are many more.

My procedure above is akin to a primitive subtraction-only form of Euclid's GCD algorithm. Compare with finding the GCD of 17 and 22.

 

This reads like it was intended to be a Post instead of a Question. If it's a Question, I don't see what exactly the question is.

@Earl If you feel that way, then you should give Kitonum's Answer a Vote Up, as I have.

@vv Brian wrote:

  • I modified the objective using this methodology:.... I'd like to make a procedure out of it....

I understood the challenge to be to take the StackExchange post and make a procedure of it. That is, a procedure that takes an objective that contains abs but is otherwise linear and converts it into a new linear objective plus additional constraints. The procedure that I wrote is generally useful could easily be made a part of Optimization; it isn't just ad hoc this problem.

Regarding the integer option: Solving this as an LP produces the correct integer results. This often happens with an ILP. It is interesting that this problem when solved as an ILP by Optimization:-LPSolve actually uses significantly fewer iterations. This may just be because of the "toy" size of the problem.

@Lali_miani Your worksheet only contains the output of your expression, and for reasons that I don't understand, I can't copy-and-paste it to an input region to work with it. Would you please edit it so that it contains your input, and upload it again?

You said that you want the "sign" of this expression as well as its simplification. "Sign" has many meanings in Maple, so could you be more precise? Its principal meaning in Maple is the sign of the leading coefficient of a polynomial; however, this isn't usually what people want when they say "sign".

@brian bovril Your challenge is solved in a new Answer below.

@neek 

a) The procedure ifactor has something called a "remember table". It remembers whatever results it has computed up until the next garbage collection. The procedure ifactors simply calls ifactor and reformats its output. So the factorization isn't being redone.

b) You generally want to suppress the implicit printing of the output of the interiors of loops, and explicitly print just the output that you want. The suppression is done by ending the whole loop with a colon rather than a semicolon. The printing is done by one of Maple's four explicit printing statements: print, printf, lprint, and userinfo.

c) Yeah, that center-justified thing is a nuisance! Formatted printing is a bit awkward in Maple 11. It's a little bit easier with the modern Typesetting package. Here's one option that generates 1D ASCII output, which means that the exponents won't be raised:

ifactor_sorted:= (n::integer)-> 
   sort(ifactor(n), map(``, sort(map2(op, 1, ifactors(n)[2]))))
:
f:= n-> n!:

for j to 23 do
   printf(
      "%-5d %s\n", 
      j, 
      StringTools:-Remove(
         c-> evalb(c in {"`", "(", ")"}),
         sprintf("%a", ifactor_sorted(f(j)))
      )
   )
end do: #Remember the colon!

1     1
2     2
3     2*3
4     2^3*3
5     2^3*3*5
6     2^4*3^2*5
7     2^4*3^2*5*7
8     2^7*3^2*5*7
9     2^7*3^4*5*7
10    2^8*3^4*5^2*7
11    2^8*3^4*5^2*7*11
12    2^10*3^5*5^2*7*11
13    2^10*3^5*5^2*7*11*13
14    2^11*3^5*5^2*7^2*11*13
15    2^11*3^6*5^3*7^2*11*13
16    2^15*3^6*5^3*7^2*11*13
17    2^15*3^6*5^3*7^2*11*13*17
18    2^16*3^8*5^3*7^2*11*13*17
19    2^16*3^8*5^3*7^2*11*13*17*19
20    2^18*3^8*5^4*7^2*11*13*17*19
21    2^18*3^9*5^4*7^3*11*13*17*19
22    2^19*3^9*5^4*7^3*11^2*13*17*19
23    2^19*3^9*5^4*7^3*11^2*13*17*19*23

 

First 368 369 370 371 372 373 374 Last Page 370 of 709