Carl Love

Carl Love

28070 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@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.

@brian bovril Are you still restricted to 3 groups of 3, although now the products of the groups may possibly be unequal?

@candy898 Try this.

 

restart:

A:= Matrix([[.7, .3, .3], [.2, .6, .1], [.1, .1, .6]]);

A := Matrix(3, 3, {(1, 1) = .7, (1, 2) = .3, (1, 3) = .3, (2, 1) = .2, (2, 2) = .6, (2, 3) = .1, (3, 1) = .1, (3, 2) = .1, (3, 3) = .6})

macro(LA= LinearAlgebra):

The matrix A is singular, so it doesn't make sense to refer to 1/(I-A). Rather, we solve the system (I-A).X = 0.

Sol:= LA:-LinearSolve(convert~(LA:-IdentityMatrix(3)-A, rational), <0,0,0>);

Sol := Vector(3, {(1) = (5/3)*_t[2], (2) = _t[2], (3) = (2/3)*_t[2]})

solve({Sol[3]=100});

{_t[2] = 150}

eval(Sol, %);

Vector(3, {(1) = 250, (2) = 150, (3) = 100})

 




Download Leontief2.mw

Why are you setting the datalimit to such a small value? Of course it will run out of memory. I'd like to see the output of kernelopts(datalimit) before you make any changes to it. You obscure this information by ending the command with a colon.

I don't understand the question. Is it that you have a surface in a plot structure and you want to find eight points on that surface which are the vertices of a cube?

@candy898 

Replace LA with LinearAlgebra.

@candy898 What version of Maple are you using?

 

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