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 + i3 i5 + i4 i5) + (8 i1^2 + 4 i1^3) (i2 + i3 + 
     i4 + i5) (i2 i3 + i2 i4 + i3 i4 + i2 i5 + i3 i5 + 
     i4 i5) + (4 i1 + 2 i1^2) (i2 + i3 + i4 + i5)^2 (i2 i3 + i2 i4 + 
     i3 i4 + i2 i5 + i3 i5 + i4 i5) + (8 i1 + 4 i1^2 + 
     2 (-4 i1 - 2 i1^2)) (i2 i3 + i2 i4 + i3 i4 + i2 i5 + i3 i5 + 
     i4 i5)^2 + (4 i1 + 12 i1^2 + 6 i1^3 + 
     3 (-8 i1^2 - 4 i1^3)) (i2 i3 i4 + i2 i3 i5 + i2 i4 i5 + 
     i3 i4 i5) + (4 + 12 i1 + 6 i1^2 + 5 (-4 i1 - 2 i1^2) + 
     2 (-8 i1 - 4 i1^2 - 2 (-4 i1 - 2 i1^2))) (i2 + i3 + i4 + 
     i5) (i2 i3 i4 + i2 i3 i5 + i2 i4 i5 + i3 i4 i5) + (4 + 
     2 i1) (i2 + i3 + i4 + i5)^2 (i2 i3 i4 + i2 i3 i5 + i2 i4 i5 + 
     i3 i4 i5) + (8 + 2 (-4 - 2 i1) + 4 i1) (i2 i3 + i2 i4 + i3 i4 + 
     i2 i5 + i3 i5 + i4 i5) (i2 i3 i4 + i2 i3 i5 + i2 i4 i5 + 
     i3 i4 i5), 0}


Check in Maple:

P:=i1^4 + (48*i1 + 24*i1^2 + 12*(-4*i1 - 2*i1^2) + 
     6*(-8*i1 - 4*i1^2 - 2*(-4*i1 - 2*i1^2)) + 
     4*(-4 - 12*i1 - 6*i1^2 - 5*(-4*i1 - 2*i1^2) - 
        2*(-8*i1 - 4*i1^2 - 2*(-4*i1 - 2*i1^2))))*i2*i3*i4*i5 + 
  3*i1^3*(i2 + i3 + i4 + i5) + (12 + 3*(-8 - 2*(-4 - 2*i1) - 4*i1) + 
     7*(-4 - 2*i1) + 6*i1)*i2*i3*i4*i5*(i2 + i3 + i4 + i5) + 
  3*i1^2*(i2 + i3 + i4 + i5)^2 + 
  i1*(i2 + i3 + i4 + i5)^3 + (4*i1^3 + 2*i1^4)*(i2*i3 + i2*i4 + 
     i3*i4 + i2*i5 + i3*i5 + i4*i5) + (8*i1^2 + 4*i1^3)*(i2 + i3 + 
     i4 + i5)*(i2*i3 + i2*i4 + i3*i4 + i2*i5 + i3*i5 + 
     i4*i5) + (4*i1 + 2*i1^2)*(i2 + i3 + i4 + i5)^2*(i2*i3 + i2*i4 + 
     i3*i4 + i2*i5 + i3*i5 + i4*i5) + (8*i1 + 4*i1^2 + 
     2*(-4*i1 - 2*i1^2))*(i2*i3 + i2*i4 + i3*i4 + i2*i5 + i3*i5 + 
     i4*i5)^2 + (4*i1 + 12*i1^2 + 6*i1^3 + 
     3*(-8*i1^2 - 4*i1^3))*(i2*i3*i4 + i2*i3*i5 + i2*i4*i5 + 
     i3*i4*i5) + (4 + 12*i1 + 6*i1^2 + 5*(-4*i1 - 2*i1^2) + 
     2*(-8*i1 - 4*i1^2 - 2*(-4*i1 - 2*i1^2)))*(i2 + i3 + i4 + 
     i5)*(i2*i3*i4 + i2*i3*i5 + i2*i4*i5 + i3*i4*i5) + (4 + 
     2*i1)*(i2 + i3 + i4 + i5)^2*(i2*i3*i4 + i2*i3*i5 + i2*i4*i5 + 
     i3*i4*i5) + (8 + 2*(-4 - 2*i1) + 4*i1)*(i2*i3 + i2*i4 + i3*i4 + 
     i2*i5 + i3*i5 + i4*i5)*(i2*i3*i4 + i2*i3*i5 + i2*i4*i5 + 
     i3*i4*i5);

expand(P) - Teller;
length(Teller);
length(P);


                                              0
                                           4308
                                            969
 

All the plotting for the first curve. For the second curve everything is done similarly.

f:=x->sqrt(abs(x-1));
y:=f(a)+D(f)(a)*(x-a);
plots:-animate(plot,[ [y, [[a,f(a)]] ], x=a-2..a+2, -1..3, style=[line,point], color=red, thickness=2, symbolsize=15, scaling=constrained], a=3..1.00001, background=plot(f, -1..5, color=blue), frames=90);

                       

The  Sol  procedure for Newton method.
Formal parameters: eta  (should be >1) and eps (positive number specifying an accuracy).

restart;
Sol:=proc(eta,eps::positive)
local y, n, k;
global F;
k:=-ilog10(eps);
Digits:=k+2;
if eta<=1 then error "Should be eta>1" fi;
F:=(y,eta)->eta*(2+9*exp(-eta*y))-22*eta*y;
y[0]:=0.;
for n from 1 do
y[n]:=y[n-1]-F(y[n-1],eta)/D[1](F)(y[n-1],eta);
if abs(y[n]-y[n-1])<eps then break fi;
od;
evalf[max(k,1)](y[n]);
end proc:

Example of use and check:

y0:=Sol(2, 0.0001);
y01:=fsolve(F(y,2), y=0..1);
abs(y0-y01);
plot(F(y,2), y=0..1);


The  Bis  procedure for the bisection method.

restart;
Bis:=proc(eta,eps::positive)
local a, b, c, n, k;
global F;
k:=-ilog10(eps);
Digits:=k+2;
if eta<=1 then error "Should be eta>1" fi;
F:=(y,eta)->eta*(2+9*exp(-eta*y))-22*eta*y;
a:=0.;  b:=1.;
for n from 1 do
c:=(a+b)/2;
if F(a,eta)*F(c,eta)<0 then b:=c else a:=c fi;
if abs(a-b)<eps then break fi;
od;
evalf[max(k,1)](c);
end proc:


Example of use:

y0:=Bis(2, 0.0001);


Edit.

You do not need  isolve  command. (j-1)/m<=t<j/m  is equivalent to  (j-1)<=t*m<j , therefore
j-1=floor(t*m) ,   j=floor(t*m) + 1


Addition. If you still want to use  isolve  command, then it's easy to do as some procedure:

F:=(m,t)->isolve({t>=(j-1)/m, t<j/m}):


Example of use:

F(2.5, 0.7);
                                         
 {j = 2}

You have a second-order equation, so for each solution you need two initial conditions:

ode1 := diff(x(t), t, t) = (5*9.80665)*sin((1/6)*Pi)-(10*(10-sqrt(x(t)^2+25)))*x(t)/sqrt(x(t)^2+25)-diff(x(t),t);
DEtools:-DEplot(ode1, x(t), t = -2 .. 2, x = -8 .. 8, color = blue, stepsize = 0.5e-1, [seq([x(0) = (1/4)*k, D(x)(0)=0], k = -20 .. 20, 4)], linecolor=red);

              

Arrows are plotted only for first-order equations.

restart:  with(linalg):
S:=matrix(3,3,[s11,s12,s13,s21,s22,s23,s31,s32,s33]):
X:=matrix(3,1,[x1,x2,x3]):
A:=matrix(3,3, (i,j)->S[i,j]/X[j,1]);

Xm:=evalm(transpose(h)&*transpose(X));
S/~Xm;
 # memberwise division: S / Xm

Xd:=diag(x1,x2,x3);  # make X the diagonal of a square matrix
A:=evalm(S&*inverse(Xd));
 

Example:

P_X:=Vector(10, symbol=v);

seq(P_X[i]<1, i=1..10);


Addition for beginners. The command  seq  is one of the most powerful and frequently used commands in Maple. It can often substitute for loops, both simple and nested (in the latter case, nested sequences are used). Here are 2 more examples of using this command:

seq(ithprime(n), n=1..50);   # First 50 prime numbers

n:=50:
seq(seq(seq(`if`(a^2+b^2=c^2, a^`2`+b^`2`=c^`2`, NULL), b=a+1..n-1), a=1..n-2), c=3..n);   
# All Pythagorean triangles with hypotenuse not exceeding 50


Edit.

I do not think that this sum can be found in closed form for any  . But for integer positive  r  the solution can be written as a procedure:

restart;
S:=r->simplify(sum((a+k*d)^r, k=1..n));


Examples of use:

S(2);
S(3);
S(6);

See  wiki  for details.

Example of calculation (norm in the space  C[-1,1]):

restart;
f:=x->x^3-x:
maximize(abs(f(x)), x=-1..1);
                                                       
 2*sqrt(3)*(1/9)

 

NumberTheory:-Totient(n)  returns the number of positive integers coprime to   and not greater than  . See help for details.
 

Addition. Another way:

restart;
with(Physics):
phi:=n->add(KroneckerDelta[igcd(n,k),1], k=1..abs(n)-1);
NumberTheory:-Totient(14);
phi(14);

 


Edit.
 

See  here  about this.

Of cause you can just write  3+1/7 .

Here is an example of the 2 ways to calculate the value of the derivative of a function at a point. Your function can be specified as a procedure or as some expression. In the first case, it is convenient to use the differential operator  , in the second case  eval  command:

restart;
f:=(x,y)->x^2+x*y^3: 
# The function is given as a procedure
g:=x^2+x*y^3:   # The function is given as an expression
D[1](f)(0.5, 1);   # The value of the partial derivative with respect to x at the point
eval(diff(g, x), [x=0.5, y=1]);  # The same
                                                     2.0
                                                     2.0


Below the example of the same error that you have. You can not differentiate by number:

x:=0.5:  y:=1:
diff(g, x);
   
Error, invalid input: diff received .5, which is not valid for its 2nd argument
 

 

I just reduced the domain of the function:

with(plots):

animate(plot3d,[sin(Pi*(t-x))*sin(Pi*y)*Heaviside(t-x)-sin(Pi*(t+x))*sin(Pi*y)*Heaviside(t+x),x=0..4,y=piecewise(x>=0 and x<2,1/2-x/4,0)..piecewise(x>=0 and x<2,1/2+x/4,1)],t=-2*Pi..2*Pi, frames=90);
 

You can do something similar to this simple example:

restart;
for y from 1 to -1 by -0.1 do
sol:=fsolve(exp(x)=y);
if type(sol,numeric)=false then break fi;
od;
y;


As soon as y = 0 the calculation is interrupted.

restart;
f := (x,y)->sin(x)*cos(y):
plot3d(f, 0..2*Pi, 0..2*Pi);
plots:-contourplot(f, 0..2*Pi, 0..2*Pi);


PS. If you want contours with numeric labels, then see this post

First 126 127 128 129 130 131 132 Last Page 128 of 289