Kitonum

21550 Reputation

26 Badges

17 years, 124 days

MaplePrimes Activity


These are replies submitted by Kitonum

@Carl Love  Vote up.  Two questions:

1) What is the significance  R:= Vector() .  Why can not we just take the indexed variable  R ?

2) What is  _rest ?

 

The next version works  like your one:

SplitScan:= proc(f, L::list)

local R, k:= 0, j, last:= 1;

     for j from 2 to nops(L) do

          if f(L[j-1], L[j]) then

               k:= k+1;

               R(k):= L[last..j-1];

               last:= j

          end if

     end do;

     [seq(R(i), i= 1..k), L[last..]]

end proc:

 

@Markiyan Hirnyk  I know it. This is a feature of the solution.

 

For example (equation for  tan(x) ) we get the same warning:

sol:=dsolve({diff(y(x),x)=1/cos(x)^2, y(0)=0}, numeric);

plots[odeplot](sol, [x, y(x)], x = 0 .. 2, view=[0..2,0..10]);

@Carl Love  convenient for a large number of plots.

plot([seq(`[]`~(x,y||i), i=1..2)]);

@Rouben Rostamian   Here is a shorter version of the same plotting without  plots  package:

x := [0., .20, .40, .60, .80, 1.0]:
y1 := [0., .20, .40, .60, .80, 1.0]:
y2 := [0., .64, .96, .96, .64, 0.]:

plot([`[]`~(x,y1),`[]`~(x,y2)]);

 

I think I misunderstood the meaning of the original question in my answer.

 

 

 

See the same question

@toandhsp 

restart:

k:=combine((sin(x+Pi/3))^2);

sol:=solve(k=1/4, x, AllSolutions = true, explicit);

sol1, sol2:=subs({_B1=0,_Z1=n},sol), subs({_B1=1,_Z1=n},sol);

@Carl Love  Unfortunately I have the right to put only 1 vote up.

@Carl Love  for a very useful remark. I fixed this defect in code.

Please provide explicitly your system  V . Probably needed extra options in  solve  command.

@Carl Love  Of course, in the original example, there is no problem, because determinant of the system at any   is not equal to 0, and it has a unique solution for any b. In other cases (if first we use solve) there may be a wrong solution.

Example:

restart;

solve({b*x+y=1, x+b*y=1}, {x,y});

eval(%, b=1);

     

The solution is erroneous because for b = 1, there are infinitely many solutions.

The correct solution

solve(eval({b*x+y=1,x+b*y=1}, b=1), {x,y});

                   {x = 1-y, y = y}

 

Another example:

eval(solve(sqrt(x+b)>x, x), b=1);

Warning, solutions may have been lost

 

The correct solution:

solve(eval(sqrt(x+b)>x, b=1), x);

               RealRange(-1,Open(1/2*5^(1/2)+1/2))

 

Thus, variant  solve(eval...)  is more reliable than  eval(solve...)

 

@Carl Love  for clarifying the situation.

@Carl Love 

Q:=evalf[20](P);

L:=[fsolve(Q, complex)];

seq(abs(subs(x=t, P)), t=L);

 

What does  HFloat(undefined)  mean?

@acer  Thank you for your helpful advice. Unfortunately, the situation is complicated by the fact that in the case where the points lie on parallel faces, pagan's way and accordingly, my procedure may give incorrect results.

Here is an example where the shortest path passes through four faces:

A:=plottools[cuboid]([0,0,0], [1,1,1],style=wireframe, color=black):
B:=plottools[curve]([[1/2,1/10,0],[5/12,0,0],[0,0,1/2],[0,5/12,1],[1/10,1/2,1]], color=red, thickness=3):
C:=plots[textplot3d]([[1/2,1/10,0,"A"],[1/10,1/2,1,"B"]], color=black, align=right, font=[TIMES,ROMAN,18]):
plots[display](A,B,C, orientation=[20,70], axes=normal);

                           

 

 

I found an error in my solution (Pagan's approach also wrong). If two points lie on the adjacent faces, the shortest path is not necessarily passes only through these faces (it may pass through the 3 faces).

Here is the example:

A:=plottools[cuboid]([0,0,0], [1,1,1],style=wireframe, color=black):
B:=plottools[curve]([[1,1/2,1/10],[1,3/5,0],[3/5,1,0],[1/2,1,1/10]], color=red, thickness=3):
C:=plots[textplot3d]([[1,1/2,1/10,"A"],[1/2,1,1/10,"B"]], color=black, align=left, font=[TIMES,ROMAN,18]):
plots[display](A,B,C);

                

 

 

I will think how to fix this situation.

@Preben Alsholm  I just wanted to remind that the conversion a list to a set - a convenient way of getting rid of duplicate elements. Simultaneously, Maple automatically sorts the remaining elements (lexicographically).  If the original order is irrelevant, you can save this set without turning it back to the list:

u:=[x,y,z]; v:=[a,b,x];

{op(u), op(v)};

              {a,b,x,y,z}

First 89 90 91 92 93 94 95 Last Page 91 of 133