Carl Love

Carl Love

28110 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@J4James I am not getting that error with M17, but I do get it with M16. I don't know what it means. The error appears related to the call to dsolve and not to the looping structure. Here is the matrix that I end up with in M17:

Are you using _Z as a variable? If yes, then change it. If no, then this error message is a sign of a serious bug in solve.

Trying to restrict solve to real solutions is unreliable, IMO. If you want to try, then do

with(RealDomain);

which loads a different version of solve.

@John Fredsted The with command is needed to overload operators. But I don't see why you have any issue with with. It works regardless of these GUI issues.

@micahdavid I don't see how deleting a group of strictly print and lprint statements could make a difference with the error. There must be something else going on.

@brian bovril I don't know anything about that.

@brian bovril The labeling with non-unique data can be done like this:

restart:
S:= [3, 4, 5, 6, 9, 9, 28, 30, 35]:
SL:= ["A","B","C","D","E","F","G","H","I"]:
assign(Labels ~ (SL) =~ S); #Create remember table.
AllP:= combinat:-setpartition(SL,3):
lnp:= evalf(ln((`*`(S[]))^(1/3))):

Var:= (P::{list,set}({list,set}))->
     evalf(`+`(map(b-> abs(ln(`*`(Labels~(b)[]))-lnp), P)[]))
:

Min:= proc(S::{list,set}, P::procedure)
local M:= infinity, X:= (), x, v;
     for x in S do
          v:= P(x);
          if v < M then  M:= v;  X:= x  end if
     end do;
     X
end proc:

ans:= Min(AllP, Var);
      [["A", "E", "I"], ["B", "F", "G"], ["C", "D", "H"]]
subsindets(ans, string, Labels);
              [[3, 9, 35], [4, 9, 28], [5, 6, 30]]

@Carl Love This is probably faster:

not has(L, false)

@fluff The answer to all six of your questions is yes. I handle the n-door case in the next Answer.

@brian bovril Labeling the entries is trivial. Just create a remember table at the beginning and apply it at the end. Like this:

restart:
S:= {3, 4, 5, 6, 8, 9, 28, 30, 35}:
SL:= [A,B,C,D,E,F,G,H,I]:
assign(Labels ~ (S) =~ SL); #Create remember table.
AllP:= [seq(P, P= Iterator:-SetPartitions(S, [[3,3]], compile= false))]:
lnp:= evalf(ln((`*`(S[]))^(1/3))):

Var:= proc(P::({list,set}(set)))
local r:= evalf(`+`(map(b-> abs(ln(`*`(b[]))-lnp), P)[]));
end proc:

Min:= proc(S::{list,set}, P::procedure)
local M:= infinity, X:= (), x, v;
     for x in S do
          v:= P(x);
          if v < M then  M:= v;  X:= x  end if
     end do;
     X
end proc:

ans:= Min(AllP, Var);
              [{3, 9, 35}, {4, 8, 28}, {5, 6, 30}]
subsindets(ans, posint, Labels);
               [{I, A, F}, {B, E, G}, {C, D, H}]

 

@Kitonum The vast, vast majority of the extra time in my code was because I used sort rather than min. Here's a version where I coded my own Min.

restart:
ts := time():

S:= {$1..15}:
AllP:= [seq(P, P= Iterator:-SetPartitions(S, [[5,3]], compile= false))]:
lnp:= evalf(ln((`*`(S[]))^(1/3))):

Var:= proc(P::({list,set}(set)))
local r:= evalf(`+`(map(b-> abs(ln(`*`(b[]))-lnp), P)[]));
end proc:

Min:= proc(S::{list,set}, P::procedure)
local M:= infinity, X:= (), x, v;
     for x in S do
          v:= P(x);
          if v < M then  M:= v;  X:= x  end if
     end do;
     X
end proc:

Min(AllP, Var);

time()-ts;

   [{1, 8, 9, 11, 14}, {2, 3, 10, 12, 15}, {4, 5, 6, 7, 13}]
                             27.547

The ln and evalf still take a significant percentage of the time. I'm using 15 Digits, and some of the ln differences are only in the last of those digits.

I'm still waiting for Joe to show me how to use attributes for this.

I also have no problem using the END key. I'm using Windows 8, Maple 17.02/64-bit, Standard, Worksheet, 1D input.

We have a worse situation with is and floor:

is(floor(x)=0) assuming x>0, x<1;
                             false

@saysics 

The first problem is solved. Note that the error message is different. The problem now is that your system has a parameter T1 whose numeric value is not supplied in params.

Note that a listprocedure, as that term is used by dsolve(..., numeric), is not quite a list of procedures. It is a list of equations whose right sides are procedures. Specifically, it satisfies type list({name, function} = procedure).

Interesting that it will get it immediately if you replace sec(x)^2 with 1+tan(x)^2.

Another weirdness is

int(tan(x)^(1/3)*sec(x)^2, x= a..b, AllSolutions);

The answer is the same if I use 1+tan(x)^2.

First 579 580 581 582 583 584 585 Last Page 581 of 710