Preben Alsholm

MaplePrimes Activity


These are replies submitted by Preben Alsholm

Since this problem must be solved numerically we need to know the parameters M, R, and alpha, or at least in which ranges they lie.
Even so there is no guarantee of success.

@acer The OP's original code works for me on Windows 10, 64 bit, Maple 2017.3 when using method=interiorpoint.
It doesn't work correctly when using method=activeset.

kernelopts(version);
  Maple 2017.3, X86 64 WINDOWS, Sep 27 2017, Build ID 1265877

interface(version);
    Standard Worksheet Interface, Maple 2017.3, Windows 10, September 27 2017 Build ID 1265877

 

@tomleslie You wrote:
" My original post, and all of my subsequent posts correctly solve the problem on 64-bit Windows (as it happen WIndows 7), using LPSolve(). These correct solutions are obtained for Maple 18.02, Maple2015.2, Maple2016.2 and Maple 2017.3. "

Since I understand that the OP (andreasks) works at a university and has to deal with students having different kinds of computers, he must have a solution that works for all types of computers.

As I have posted (and with the default setting of Digits=10 and UseHardwareFloats), your code:

restart;
Optimization:-LPSolve( 3*x__1+14*x__2+18*x__3+6*x__4+2*x__5,
                       {3*x__1+5*x__2+6*x__3+2*x__4+x__5 <= 10},
                       binaryvariables=[x__1, x__2, x__3, x__4, x__5],
                       maximize = true
                      );
#######

does not work on my Windows 10, 64 bit computer in Maple 18.02, 2015.2, 2016.2, and 2017.3.
But it does work (thanks to Markiyan Hirnyk for pointing this out) if Digits is set to 16, thus forcing Maple to use software floats.
Your code as well as the OP's original code also works with default setting of Digits, if we make the assignment UseHardwareFloats:=false: as in
 

restart;
UseHardwareFloats:=false;
Optimization:-LPSolve( 3*x__1+14*x__2+18*x__3+6*x__4+2*x__5,
                       {3*x__1+5*x__2+6*x__3+2*x__4+x__5 <= 10},
                       binaryvariables=[x__1, x__2, x__3, x__4, x__5],
                       maximize = true
                      );
################
restart;
UseHardwareFloats:=false;
Optimization:-LPSolve( 3*x__1+14*x__2+18*x__3+6*x__4+2*x__5,
                       {3*x__1+5*x__2+6*x__3+2*x__4+x__5 <= 10},
                       x__1=0..1, x__2=0..1, x__3=0..1, x__4= 0..1, x__5=0..1,
                       maximize = true
                      );

##############
NOTE 1: I'm not saying that this problem exists on all computers with recent Maple versions (since 18.02) and with Windows 10, 64 bit. Had this been true, my guess is that acer wouldn't have replied as he did in his "specifics" reply.
NOTE 2: The OP's original code works for me with the option method=interiorpoint and with default settings of Digits and UseHardwareFloats (see acer's first reply).

@faisal We need to know what X is, specifically how it is related to f(eta).
Also we must know the values of A and epsilon[1] .
I'm assuming that S = s?

@Markiyan Hirnyk Thanks for the reference.
You wrote in a reply in that link:
 
"I am glad of the workaround by Mariusz. Every big soft includes bugs. In particular, both Maple and Mathematica are not any exception. However, I don't remember a Mathematica's bug which appears in 32-Bit version of OS only."

Actually my system is 64 bit (Windows 10) and raising Digits to 16 works for me:

 

restart;
Digits := 16: 
Optimization:-LPSolve(2*x+5*y, {3*x-y = 1, x-y <= 5}, assume = {integer, nonnegative});

Futhermore, the OP's original code works too:
 

restart;
Digits:=16:
Optimization:-LPSolve(3*x__1+14*x__2+18*x__3+6*x__4+2*x__5, {3*x__1+5*x__2+6*x__3+2*x__4+x__5 <= 10}, x__1 = 0 .. 1, x__2 = 0 .. 1, x__3 = 0 .. 1, x__4 = 0 .. 1, x__5 = 0 .. 1, maximize = true);

Answer:
[29.59999998353600, [x__1 = 0., x__2 = .3999999988240001, x__3 = 1., x__4 = 1., x__5 = 0.]]

@tomleslie A few hours ago I filed a bug report about the following example from the help page for LPSolve:
 

restart;
Optimization:-LPSolve(2*x+5*y, {3*x-y=1, x-y<=5}, assume={nonnegative, integer});

It produces a crash (loss of kernel connection) on my computer in Maple 18.02, 2015.2, 2016.2, and 2017.3, but NOT in Maple 17.02 where it gives a correct result: [12, [x = 1, y = 2]]

Do you get a the crash on your computer in the Maple versions you have?

@tomleslie For Maple 2015.2 I get

restart;
kernelopts(version);
Optimization:-LPSolve( 3*x__1+14*x__2+18*x__3+6*x__4+2*x__5,
                       {3*x__1+5*x__2+6*x__3+2*x__4+x__5 <= 10},
                       binaryvariables=[x__1, x__2, x__3, x__4, x__5],
                       maximize = true
                      );
  Maple 2015.2, X86 64 WINDOWS, Dec 20 2015, Build ID 1097895
Warning, problem appears to be unbounded
    [0, [x__1 = 0, x__2 = 0, x__3 = 0, x__4 = 0, x__5 = 0]]

#########
Maple 18.02:

restart;
kernelopts(version);
Optimization:-LPSolve( 3*x__1+14*x__2+18*x__3+6*x__4+2*x__5,
                       {3*x__1+5*x__2+6*x__3+2*x__4+x__5 <= 10},
                       binaryvariables=[x__1, x__2, x__3, x__4, x__5],
                       maximize = true
                      );
   Maple 18.02, X86 64 WINDOWS, Oct 20 2014, Build ID 991181
Warning, problem appears to be unbounded
    [0, [x__1 = 0, x__2 = 0, x__3 = 0, x__4 = 0, x__5 = 0]]

#############
But in Maple 17.02:

restart;
kernelopts(version);
Optimization:-LPSolve( 3*x__1+14*x__2+18*x__3+6*x__4+2*x__5,
                       {3*x__1+5*x__2+6*x__3+2*x__4+x__5 <= 10},
                       binaryvariables=[x__1, x__2, x__3, x__4, x__5],
                       maximize = true
                      );
    Maple 17.02, X86 64 WINDOWS, Sep 5 2013, Build ID 872941
    [26, [x__1 = 0, x__2 = 0, x__3 = 1, x__4 = 1, x__5 = 1]]

##########################################
NOTE ADDED:
I thought that the build ID number would be the same for the same final release for (say) Windows 64 bit. By "final" I exclude beta versions.

@tomleslie I tried your code in Maple 2017.3 and in Maple 2016.2 and got the warning about unboundedness and the result
[0, [x__1 = 0, x__2 = 0, x__3 = 0, x__4 = 0, x__5 = 0]]

For Maple 2017.3:

kernelopts(version);
  Maple 2017.3, X86 64 WINDOWS, Sep 27 2017, Build ID 1265877

For Maple 2016.2:

kernelopts(version);
  Maple 2016.2, X86 64 WINDOWS, Oct 21 2016, Build ID 1174570

###############

But in Maple 17.02 I got the result you report.
The same goes for Maple 12, 15, and 16.

################
In Maple 18 and Maple 2015 it is the same as in Maple 2017.3.

The problem as formulated can be solved by NLPSolve.
 

f:=3*x__1+14*x__2+18*x__3+6*x__4+2*x__5;
cstr:={3*x__1+5*x__2+6*x__3+2*x__4+x__5 <= 10};
res:=Optimization:-NLPSolve(f,cstr, x__1 = 0 .. 1, x__2 = 0 .. 1, x__3 = 0 .. 1, x__4 = 0 .. 1, x__5 = 0 .. 1, maximize = true);
eval([f,cstr],res[2]); #Check

This doesn't solve the binary problem, but neither would the command you are using (if it had worked).

Although I tried many times before I wrote the question above and had no success, I finally had success after taking a short break.
This is being written using Firefox.

In previous days I had run into the same problem with the new Firefox, but trying once or twice more got me in.
I'm still wondering what is going on. I have no problems with other websites that I visit.

This could happen e.g. in the following circumstance:
 

seq(diff(f(x),x$i),i=1..3); #OK
seq(diff(f(x),x$i),i=0..3); # Your error
seq(diff(f(x),[x$i]),i=0..3); # OK with list
diff(f(x),[]); # OK just f(x)

 

@mrmusic1994 Besides what Kitonum has already replied, notice that if k < 0 then the "terminal velocity" is infinity.
Using the notation from my answer we would find that Vfinal is infinity. Thus no negative k can solve you problem!

Vfinal:=limit(V,t=infinity) assuming k<0;

It is equally easy to see that k = 0 won't solve your problem either. Do a separate calculation:
 

de0 := 100*diff(v(t),t)=100*9.81;     
dsolve({de0,v(0)=0});

Again the "terminal velocity" is infinity.

@edmundac I tried your worksheet in Maple 2017.3 as well as in Maple 17.02 on my Windows 10 64-bit computer.

I ran the code once. Then I ran the same worksheet once more from the very beginning, i.e. starting with restart. I didn't find any problem. So I wonder what you did?
Did you do something differently the second time?

@killercrew You can change the outer loop to
 

for i from 0 to N-1 do

and still keep the inner as I wrote. The change in the outer loop just means a renumbering, so that if X and Y are defined as Arrays then without the outer loop change they would be
 

X:=Array(1..M,0..N,datatype=float);
Y:=Array(1..M,0..N,datatype=float);

whereas with the outer loop changed they would be
 

X:=Array(0..M-1,0..N,datatype=float);
Y:=Array(0..M-1,0..N,datatype=float);

The datatype option I added. That has nothing to do with the numbering.

@vv Since y' = sqrt(2-2*ln(y^2))*y  it follows that as long as y > 0 we have y' >=0. Thus y(x) is nondecreasing for all x for which the solution is defined and y(x) > 0. The ode has another problem at y = 0, but that is of no concern here.

But I agree that there is no bug. No claim is made by the help page that a maximal solution is given.
 

First 53 54 55 56 57 58 59 Last Page 55 of 231