Kitonum

13559 Reputation

24 Badges

11 years, 123 days

MaplePrimes Activity


These are replies submitted by Kitonum

@Subhan331  As soon as the condition  abs(x[k]-x[k-1]) < tol  was fulfilled (for  k=6), the loop was interrupted due to the keyword  break .

Changing the width of the airfoil is controlled by r0- parameter:

restart;
r0:=1.124: x0:=1-r0: y0:=0.1:
z:=x+I*y:
f:=unapply(evalc~([(Re,Im)(z+1/z)]), x,y);
F:=plottools:-transform(f):
C:=r0->plots:-implicitplot((x-x0)^2+(y-y0)^2=r0^2, x=-2..2, y=-2..2, color=red, thickness=2) :
plots:-animate(plots:-display,[ 'F(C(r0))', scaling=constrained], 'r0'=1.124..1.224, frames=101, size=[800,350]);
                       

@acer 

restart;
A := <b,1,3 | 4,b,6>:
B := <b,1,3 | 4,b+1,6>:
GE1 := LinearAlgebra:-GaussianElimination(A);
GE2 := LinearAlgebra:-GaussianElimination(B);
solve({`*`(seq(GE1[i,i], i=1..2))<>0}, b);
solve({`*`(seq(GE2[i,i], i=1..2))<>0}, b);


In the first example, one answer, and in the second example both answers are incorrect.

Probably in the examples with parameters, in general, a full search of all square submatrices of maximum rank is required.

@acer This method can lead to erroneous results. Here is a simple example with 2 vectors:

restart;
A := <b,1,3 | 4,2,6>;
GE := LinearAlgebra:-GaussianElimination(A);
solve({seq(GE[i,i]<>0, i=1..2)}, b);

Output is  {b <> 0, b <> 2} . But if  b=0 , then both vectors are also linearly independent. 

 

@Joe Riel  The useful comment. I'm sure for a smaller number of vectors, the corresponding condition should be imposed on the rank. 

Now I don’t have time to understand your code in detail (maybe this evening), but two errors immediately catch my eye:

1. Vertices must be specified in a single list (not a sequence), that is should be  [[2.5, 21], [6, 13.5], [8, 10], [11, 24.5], [14.3, 19.4], [16.8, 26], [22, 21.5], [22, 17], [22.2, 12.5], [26.8, 23], [28, 20.5], [30, 25.5], [32, 21], [29.5, 16]].

2. Distance  command does not do what you want.

3. I do not see where  GraphTheory package is called. This is usually done using  uses  option in the procedure body.


Earlier, I solved your problem. See this thread

 

@bliengme After your response, I, like Joe, also stopped understanding what you want.

I saw acer's answer already after I sent my own. For positive numbers, our answers are the same, but for negative non-integer numbers, the answers are different, as  trunc  command rounds in the direction to  0 . But OP wrote "How to find the integer that is less than and closest to a real number" .

@JSalisbury  If you want to get a plot of dependence  t  against  thetabn  given by the equation  s , just use  plots:-implicitplot  command:

restart;
v := 145000;
thetavn := (1/6)*Pi;
omegac := 1/10;
s := v*cos(thetavn)*t*(cos(2*thetabn)*tan(thetabn)+sin(2*thetabn)*sin(omegac*t)/(omegac*t));
plots:-implicitplot(s=0, thetabn=0..88*Pi*(1/180), t=-200..200, tickmarks=["piticks", "decimalticks"], gridrefine=4, size=[800,600]
);

Your code does not work because  solve  command simply cannot solve this transcendental equation  s=0  explicitly.

I did not find any options in  Optimization  package  that would allow to find more than one solution. But with one solution can meet problems. There is a bug in  Optimization:-LPSolve  (with  integer  option)  that is still not fixed. Here is a toy example (in Maple 2018.2):

restart;
Optimization:-LPSolve(x+y, {x+y<= 1}, assume = {integer, nonnegative}, maximize);
 
Warning, problem appears to be unbounded
                         [0, [x = 0, y = 0]]


But there is a workaround:
restart;
Digits:=20:
Optimization:-LPSolve(x+y, {x+y<= 1}, assume = {integer, nonnegative},maximize);
                           
 [1, [x = 1, y = 0]]


Submit your specific problem here in text form (not in the form of a picture). Maybe someone will be able to find another solution method that allows you to find all the solutions.

@vv  Thanks for this - vote up. A recursion here is more effective than a direct reproduction of lists using the method of branches and borders (in my procedure).

However, these two procedures ( Partition  and  P ) are not equivalent. The procedure  Partition  solves a larger range of tasks due to the presence of additional options.

@Carl Love  Thanks for the useful information. I previously just did not have to use ListTools:-Classify command.

@Carl Love We can use the  Partition  procedure from  here  instead.

Example:

Partition(7, 3);
                         
  [[1, 1, 5], [1, 2, 4], [1, 3, 3], [2, 2, 3]]


Edit.  Partition procedure is quite effective. For example,

Partition(100, 5); 

will be significantly faster than

sort~(combinat:-composition(100, 5));
 

@bliengme   Copy  ?simplify/siderels  into your worksheet, and press enter key .

@mehdi jafari 

ListTools:-Collect([1,1,5]);
                                             
 [[1, 2], [5, 1]]

First 7 8 9 10 11 12 13 Last Page 9 of 101