Kitonum

21860 Reputation

26 Badges

17 years, 239 days

MaplePrimes Activity


These are replies submitted by Kitonum

@Adam Ledger  This does not contradict what I wrote. You have defined the sequence of names explicitly with already known number of members.

@Adam Ledger  Just Maple is so designed that the formal parameters of the procedure can be a name or a sequence of names (specified explicitly) or nothing. If you have a sequence with an undefined number of terms, you can just give it a name and then reference it. You can even not specify formal parameters at all, but in the body of the procedure refer to them using  args  and  nargs  commands. Here is a simple example of these two ways. Two procedures below calculate the arithmetic mean of several numbers:

Mean1:=a->add(a)/nops(a); # First way
Mean2:=()->`+`(args)/nargs; # Second way

Mean1([1,2,3,4]);  # Examples of use
Mean2(1,2,3,4);


 

@Adam Ledger  Of course, I know this wonderful formula for calculating the number of lucky tickets. Maple can calculate by this formula, but it takes 20 times longer than using  NestedSeq  procedure:

t:=time(): 1/Pi*int((sin(10*x)/sin(x))^6, x=0..Pi); time()-t;
t:=time(): `+`(NestedSeq(`if`(i+j+k=l+m+n,1,0), [i,j,k,l,m,n]=~0..9)); time()-t;

                                                                        55252
                                                                        13.828
                                                                        55252
                                                                         0.719

@Muhammad Usman Sorry, I did not notice that degrees are required, not radians. Correct as showed to you by tomleslie.

@tomleslie 

convert(sum(ln(k), k=1..m), factorial)  assuming m::posint;
                                                       
 ln(m!)


 

@acer  1. Thank you for correcting the error in my answer.

2. We can also use  plottools:-curve  command, which is especially useful if you need to plot a broken line in 2D or in 3D with a greater number of links than one link:

A:=[1, 2, 3]: B:=[4, 5, 6]: C:=[3,2,9]:
plots:-display(plottools:-curve([A, B], color=red, thickness=2));
plots:-display(plottools:-curve([A, B, C], color=red, thickness=2));

@minhhieuh2003  See the update to my answer.

@tomleslie  You're right. At first everything worked fine (as in my answer above). But then when I opened the saved document, the correct result appeared not 4, but only 3 times. I repeated these experiments several times and each time the situation worsened. Sometimes from the very beginning there was an incorrect result. All this is very strange.

@tomleslie  It seems my edited version works relatively stable (see above). I repeated the same 4 times.

@denkasyan  1. Yes this is the simplest way to construct three-dimensional graph of the system of  linear  inequalities. See help on PolyhedralSets  package for details.

2. Yes.

@tomleslie  For some unknown reason, your code does not work in my Maple 2017.3 32 bit:

   

@denkasyan In  PolyhedralSets  package, a body must be given by non-strict inequalities. But to build a body it does not matter. Maple simply draws the boundaries of this body as parts of the planes. In your example, the body will be part of the plane  y = -20 .

@denkasyan  You get the set  {x<0, y=-20, z<0}

You got some useful tips, but if you want more specific help, then you need to explain in what the essence of the problem is. And more: what do your functions B, P mean, what is loss and so on?

If I understand correctly,  until "any condition"  is equivalent to  if "any condition" then break fi , but slightly shorter. The latter variant I use very often.

First 48 49 50 51 52 53 54 Last Page 50 of 134