Carl Love

Carl Love

26488 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@MANUTTM Obviously you must generalize the loop so that all references to wwtemp, etc., are replaced with and ywtemp and ytemp, etc., like this:

for lambdam in l do
    (wtemp, wnew, ytemp, ynew):= (60, 20, 50, 10);
    while 0.05 <= abs(wtemp - wnew) or 0.05 <= abs(ytemp - ynew) do
        (wtemp, ytemp):= (wnew, ynew);
        Etemp:= eval(eval(E1), [w,y]=~ [wtemp,ytemp]);
        Soln:= NLPSolve(Etemp, p= 5..500, q= 10000..30000, maximize);
        (ptemp, qtemp):= eval([p,q], Soln[2])[];
        `&pi;temp`:= Soln[1];
        Emanf:= eval(eval(E2), [p,q]=~ [ptemp,qtemp]);
        Soln:= NLPSolve(Emanf, w= 30..60, y= 5..50, maximize);
        (wnew, ynew):= eval([w,y], Soln[2])[]
    end do;
    print(lambda, ptemp, qtemp, wtemp, ytemp, `&pi;temp`)
end do:

 

@MANUTTM For the 4-variable problem, the correction of the final loop in very similar to the correction for the 3-variable problem with the addition of y (ytemp - ynew) to the while loop condition. However, I do not understand the difference between Q and q.

@MANUTTM To do what you described, you need to make the final loop something like this:

for lambda in l do
    (wtemp, wnew):= (100, 20);
    while 0.05 <= abs(wtemp - wnew) do
        wtemp:= wnew;
        Etemp:= eval(eval(E1(p,q)), w= wtemp);
        Soln := NLPSolve(Etemp, p= 5..500, q= 10000..30000, maximize);
        (ptemp, qtemp):= eval([p,q], Soln[2])[];
        `&pi;temp`:= Soln[1];
        Emanf:= eval(eval(M1(w)), q= qtemp);
        Soln:= NLPSolve(Emanf, w= 20..100, maximize);
        wnew:= eval(w, Soln[2])
    end do;
    print(lambda, ptemp, qtemp, wtemp, `&pi;temp`)
end do:

The problem with this is that M1(w) is a very simple function of whose maximum will always be achieved at the upper bound of w=100.

Why did you create another username to ask the same question? That behavior won't be tolerated here.

@dharr Getting the indices of vertices does not require member and using it would be inefficient (linear search). You can do this instead: Let Vs be the list of vertices. Then do

V:= table(Vs=~ [$nops(Vs)]);

Then V[v] is the index of v

Getting the indices of the neighbors of v is just as easy because of an undocumented (AFAIK) structure built in to the graph representation. I'm about to write that up in an Answer.

@Agha What you describe could be done with JPEG images, but it's not the easiest or best way. Two other ways that would use far less memory and effort are

  1. Find a character encoding of the star in an HTML or Unicode character set and plot with textplot.
  2. Construct the star as a filled polygon and plot with plot.

@mmcdara When a function, for example f(x,y,z), is prettyprinted, Maple looks for a procedure named `print/f`. If it exists, then what is actually printed is determined by `print/f`(x,y,z).

@acer Could the 0-bytes files be a separate problem caused by MaplePrimes reaction to the Ç (C-with-cedilla) in the filename?

@zenterix Did you use backquotes (on upper left of standard keyboard) around the that's used as a matrix name? Forward single quotes won't work.

The code can be made much simpler if all you want to do is display the object, not compute with it later.

I need to see more examples of input and your desired output. Why doesn't the output of your example include [a, b+c]? And please show the desired output for {a, b, c, d}.

@sursumCorda Only subs can make changes inside a procedure, and I don't think that there's any reason to make it subs[eval].

@sursumCorda Acer may have some tools to help him trace the path through that tree to the 13th level without getting lost. But here is a completely different way to do the "micro-surgery" on that procedure that doesn't require that meticulous detail. The inequality that we want to change on line 24 is

`is/internal/SMTLIB_max_sys_size`(sys) <= 5

Rather than multiplying the right side by 2 (to change 5 to 10), we can multiply the left side by 1/2. This has the same mathematical effect; alas, it doesn't leave the code looking as nice. The reason that I mention it is that that change can be made with a simple subs command with no need for inert forms. The command is

`is/internal/SMTLIB`:= subs(
    `is/internal/SMTLIB_max_sys_size`= `is/internal/SMTLIB_max_sys_size`/2,
    eval(`is/internal/SMTLIB`)
);
protect(`is/internal/SMTLIB`);

The protect is to prevent you from accidentally doing this multiple times, which wasn't a potential problem with Acer's method.

I think that it's impossible to make the substitution target the whole inequality because it contains the local variable sys. (If it's possible, I'd love to know how.)

@sursumCorda This is an explanation of 

subsop([5,7,1,2,5,1,1,2,1,2,1,2,1]=10, ToInert(eval(`is/internal/SMTLIB`)))

Use showstat to view procedure `is/internal/SMTLIB`:

showstat(`is/internal/SMTLIB`);

Look for the inequality towards the end of line 24. It specifies some sort of resource-usage limitation with an upper limit of 5. Acer decided to change the upper limit to 10. One way to do that is to put the procedure into "inert form" (an extremely verbose tree structure), traverse the tree keeping track of the node numbers until you get to the 5, change it to 10, then reconstruct the "active form" of the procedure. The numbers mean "Starting from the root, take the 5th branch, then take the 7th branch of that, then take 1st branch of that, etc."

Yes, this has been a mysterious, intermittent problem on MaplePrimes for several years. No-one has found conclusive evidence that it's caused by the worksheet's type or contents or the poster's browser or settings. 

@acer You asked:

  •  [have I expressed this correctly?]

The is command is an evaluator for the universal quantifier, and coulditbe is an evaluator for the existential quantifier. The rules for quantifier negation are

  • not forall(x, P(x)) <=> exists(x, not P(x)),
  • not exists(x, P(x)) <=> forall(x, not P(x)).

Therefore, the translation of is(F1 implies F2) into a form that can be evaluated is 

is(F1 implies F2)  <=>  
is(not (not (F1 implies F2)))  <=>  
not coulditbe(not (F1 implies F2))  <=>
not coulditbe(F1 and not F2),

whereas you had not is(F1 and not F2).

First 44 45 46 47 48 49 50 Last Page 46 of 688