Kitonum

21550 Reputation

26 Badges

17 years, 123 days

MaplePrimes Activity


These are replies submitted by Kitonum

@gaurav_rs  You must find the roots of the numerator and denominator of your expression, using  normal  command first, which gives the expression  numerator/denominator .

See the corrected file    polynomial_prime_new.mw

Here is another solution, which ultimately uses  plot3d  command to plot the faces of a tetrahedron. This solution uses  solve  command first, and then  Range  procedure to specify the required domaines for each face.

restart;
Sys:=[2*sqrt(2)*x-2*z+sqrt(2) = 0, 2*sqrt(2)*x+2*z-sqrt(2) = 0, 2*sqrt(2)*y-2*z-sqrt(2) = 0, 2*sqrt(2)*y+2*z+sqrt(2) = 0]:
Cond:=[2*sqrt(2)*x-2*z+sqrt(2) >= 0, 2*sqrt(2)*x+2*z-sqrt(2) <= 0, 2*sqrt(2)*y-2*z-sqrt(2) <= 0, 2*sqrt(2)*y+2*z+sqrt(2) >= 0]:
Sol:=map(solve,[seq([Sys[i],subsop(i=NULL,Cond)[]],i=1..4)], {x,y,z}):
Range:=proc(L::list)
local r;
uses ListTools;
r:=Categorize((a,b)->lhs(a)=rhs(b) or lhs(b)= rhs(a), L);
r:=sort([r], (a,b)->(lhs(a[1])=x and rhs(a[2])=x) or (rhs(a[1])=x and lhs(a[2])=x))[];
x=lhs(select(t->rhs(t)=x,r[1])[])..rhs(select(t->lhs(t)=x,r[1])[]), y=lhs(select(t->rhs(t)=y,r[2])[])..rhs(select(t->lhs(t)=y,r[2])[]);
end proc:
plots:-display(seq(plot3d(rhs(Sol[i,1]), Range(convert(Sol[i],list)[2..-1]), style=surface, color=grey, scaling=constrained, axes=normal, view=[(-1.4..1.4)$3], lightmodel=light2), i=1..nops(Sol)));

     
 

See the adjacent  post , in which is the same error and a workaround for it.

To change a variable in an integral, use  IntegrationTools:-Change  command, and not as you wrote.

@arman  In your file you have the system matrix  A  and the vector of free terms  b . So I think the most reasonable use of  LinearAlgebra:-LinearSolve  command is:

interface(rtablesize = 100): 
Sol := LinearAlgebra:-LinearSolve(A, b);


Sol  is the vector of all solutions.

Here is a solution in which the multiplication sign is not shown:

X:=<1,2,3,4>:
Y:=<5,6,7,8>:
x.X+y.Y:
subs(`.`=`*`, %)=x*X+y*Y;

                                 

 

 

@Hoovernent  The result is NULL, that is, Maple does not return anything.

@Hoovernent  Probably it can be done, but it will not be a fully automatic solution. You need to look in the literature how to solve such equations, and then try to automate it in Maple. Unfortunately, I am not familiar with the theory of such equations and therefore I can not give you a more specific answer.

I can only say that  Typesetting  package is poorly documented.

If you want Maple to print  2 + 2=4  then can do so:

2 %+ 2=2+2;

@assma

seq(-x..x, h)  means the sequence of the numbers from  -x  to  x  with the step  h

For example:

seq(-12..12, 3);
                                 
 -12, -9, -6, -3, 0, 3, 6, 9, 12


You yourself must choose a sequence in order for the curves to look the best. For example, for your example, you can do this:

plots:-contourplot(-3.392318438*exp(-4.264628895*x)*sin(6.285714286*y), x = -1/2 .. 3/2, y = -1/2 .. 3/2, contours=[-12,-9,-6,-3,-1,-0.2,-0.01,0,0.01,0.2,1,3,6,9,12], size=[800,500], numpoints=10000);

     

@Rouben Rostamian  

Compare:

A:=<1,2; 3,4>:
seq(seq(A(i,j), j=1..2), i=1..2);
seq(seq(A[i,j], j=1..2), i=1..2);

 

@Hoovernent

1. This is allowed in the  local  line to use assignment operation,  the code will be more compact.

2. Your option also works if you specify the delimiters correctly. Should be

Do := proc( F::list(procedure) , Q::list(list))
local n, m;
n:=nops(F); m:=nops(Q);
if n<>m then error "Should be nops(F)=nops(Q)" fi;
seq(F[i]~(Q[i]), i=1..n);
end proc:

 

@Preben Alsholm 

In this case, it may be more appropriate to use  view  option:

restart;
ode:=diff(x(t),t)=x(t)*(0.1-x(t));
res:=dsolve({ode,x(0)=0.1},numeric);
plots:-odeplot(res,[t,x(t)],0..10, view=[0..10,0.09..0.11]);

                     

@jnjn0291  The code for finding all the roots of your polynomial can be written as a procedure with parameters. This procedure is convenient to use both for finding all the roots for given  x  and  y, and for plotting the corresponding graphs.

restart;
AllRoots:=proc(x,y)
local P;
P:=_Z^9-28*_Z^8+328*_Z^7-2088*_Z^6+(-2*cos(y)-2*cos(x)+7852)*_Z^5+(28*cos(y)+28*cos(x)-17768)*_Z^4+(-152*cos(y)-152*cos(x)+23632)*_Z^3+(408*cos(y)+408*cos(x)-17232)*_Z^2+(-12*cos(x)*cos(y)-540*cos(y)-540*cos(x)+5844)*_Z+32*cos(x)*cos(y)+256*cos(y)+256*cos(x)-544:
[fsolve(P, _Z)];
end proc:


Examples of use :

AllRoots(Pi/4, Pi/3);
AllRoots(Pi/6, 3*Pi/4); 

[0.05089860293, 1.023835350, 1.201326046, 1.545691777, 3.227658869, 4.455425609, 4.824850865, 4.977561899, 6.692750982]
[0.1371952453, 0.8165646504, 1.224987212, 1.668481043, 3.169288944, 4.368210397, 4.791342053, 5.189228029, 6.634702427]

The plots of the first 4 eigenvalues:

plot3d([(x,y)->AllRoots(x,y)[1], (x,y)->AllRoots(x,y)[2], (x,y)->AllRoots(x,y)[3], (x,y)->AllRoots(x,y)[4]], 0..2*Pi, 0..2*Pi, color=[yellow,red,blue,green]);
 

       

 

      

@assma 

1. Did you try those options that I suggested?

2. Submit your code here, which leads to the error.

@Hoovernent  It depends on how many variables the function has you want to plot. If the function depends on one variable, then use  plot  command, if on two variables, then  plot3d  command. You can also build several functions on one plot.  See help on these commands

First 55 56 57 58 59 60 61 Last Page 57 of 133