## 17135 Reputation

13 years, 18 days

## Procedure...

Procedure  P  returns the list of  N  pairs of such numbers  [p, q] :

 > restart; P:=proc(N::posint) local k, n, p, m, q, u; uses NumberTheory; k:=0; for n from 1 do p:=ithprime(n); for m from 1 to n do q:=ithprime(m); if pi(p)=q-pi(q) then k:=k+1; u[k]:=[p,q]; break fi; od; if k=N then return convert(u,list) fi; od; end proc:
 > # Example of use P(100);
 (1)
 >

Edit.

## Procedure...

In fact, we have a nonlinear inequality with the parameter . Maple usually cannot solve such inequality in a closed form. But it is easy to write a procedure  (named  F  below) that, for each value of the parameter , finds the corresponding range for  r . Now you can use this procedure by specifying values for c:

```restart;
F:=c->solve({-r+c+1 + sqrt(r^2 - 2*r*c -r +2*c )<1, 0<r, r<1}, r):
```

Examples of use:

`F(0.1), F(0.5), F(0.9);`

{r <= .2000000000, .1900000000 < r}, {.7500000000 < r, r < 1.}, {.9900000000 < r, r < 1.}

## rand...

Using the  rand  command, we give your parameters some random values from the appropriate ranges:

 > restart; with(DETools): randomize(): a_1:=rand(1..5)(): b_1:=rand(2..7)(): c:=rand(1..8)(): d:=rand(0..4)(): e:=rand(0..10)(): A := a_1*c^3-b_1; B := 3*a_1*c^2-3*b_1/c; C := c*d-e; sys := {diff(x(t), t) = y(t), diff(y(t), t) = (B*x(t)^2+C*x(t)-e)/A}; initialdataset:={seq(seq([x(0) = f, y(0) = g], f = -5 .. 5), g = -5 .. 5)}: DEplot(sys, [x, y], t = -3 .. 3, initialdataset, x = -6 .. 6, y = -6 .. 6, colour = black, thickness = 2, style = line, linestyle = 1, axes = boxed, linecolor = red, scaling = constrained, arrows = medium);
 >

If you want your initial parameters to take not only integers, but also fractional values in float format, then write  a_1:=rand(1...5.)() and so on. I have not set values for  f  and  g  parameters, so Maple builds not one, but a whole family of curves. Of course, you yourself can set these parameters in the same way.

## parse...

Example:

```A:=<1,"2"; "3","4">;
map(t->`if`(type(t,string),parse(t),t), A);
```

Edit.

## How plots:-implicitplot works...

The command  plots:-implicitplot  for plotting an implicit curve  F(x,y)=0  works by calculating the values ​​of a function of two variables  F(x,y)  on a rectangular grid  x = a .. b , y = c .. d . It is based on the property of a continuous function: if at points  A(x1,y1)  and  B(x2,y2)  the function  F(x,y)  takes values ​​of different signs, then on the segment  AB  there is a point  (x0,y0)  at which F(x0,y0)=0 . Typically, the curve  F(x,y)=0  separates the plane  R^2  into 2 regions in which  F(x,y)<0  and  F(x,y)>0  . The grid should be small enough (by default  grid=[26,26]. This can be achieved either by decreasing the ranges (as dharr does) or by reducing the grid cells (see an example below). In those rare examples where the function  F(x,y)  does not change sign, the command  plots:-implicitplot  fails even with a very small grid (example below):

Examples:

 > restart;
 > with(plots, implicitplot): eqn := (1 + ln(x))/x = 0; implicitplot(eqn, x = -10 .. 10, y = -10 .. 10, grid=[50,50]); # OK
 > # abs(x-y)=0 is equivalent to x-y=0, but for abs(x-y) there is no sign change   implicitplot(abs(x-y)=0, x = -10 .. 10, y = -10 .. 10, grid=[100,100]); # it fails - no any plot implicitplot(x-y, x = -10 .. 10, y = -10 .. 10); # OK
 >

## simplify with side relations...

```restart;
A:=int(diff(u(x,t),x),x=-infinity..infinity,continuous);

simplify(A, {Limit(u(_X, t),_X=infinity)=0,Limit(u(_X, t),_X=-infinity)=0});

# Or

simplify(A, {Limit(u(_X, t),_X=infinity)=Limit(u(_X, t),_X=-infinity)});

```

Of course the shortest solution would be:

```restart;
A:=int(diff(u(x,t),x),x=-infinity..infinity, continuous);
simplify(A, {%});
```

Edit.

## A way...

 > restart;
 > eq9_13_m3 := 2*R__R*s*omega__s*L__sigma_S/(s^2*L__sigma_S^2*omega__s^2 + R__R^2);
 (1)
 > aux2 := s_hat = R__R/(L__sigma_S*omega__s*s); simplify(eq9_13_m3, {R__R/(L__sigma_S*omega__s*s)=s_hat}); numer(%)/s_hat^2/``(expand(denom(%)/s_hat^2));
 (2)
 >

IWe see that your desired expression is independent of s.

## Maple syntax for integrals...

I don't know what Maple Learn means. Use standard syntax to evaluate multiple integrals. Below is an example in which the double integral is reduced to an iterated integral and calculated in two ways:

 > restart; plots:-inequal({y>=x^2,y<=1}, x=0..1, y=0..1); # The integration region A:=Int(x*y^2, [y = x^2 .. 1, x = 0 .. 1]); # The first way value(A); B:=Int(x*y^2, [x = 0 .. sqrt(y), y = 0 .. 1]); # The second way value(B);
 (1)
 >

## Solution...

If  n = 1  then you get  0  in the denominator of  c(n) , so I chose  n = 2 .. infinity . The method you use to find the convergence region is guaranteed to only give an open interval. Therefore, we must separately investigate the convergence at the ends of this interval:

```restart;
c:=n-> 1/(n^2-1);
u:=n->c(n)*(x-2)^n; # The function of the general term of the series
S:=Sum(u(n), n=2..infinity);
limit(abs(u(n+1)/u(n)), n=infinity); # We use the ratio test (d'Alembert test) for a series of absolute values
solve(%<1); # We get the (open) convergence interval
x1,x2:=op(op(1,%)),op(op(2,%)); # The left and right ends of the convergence interval

value(eval(S, x=x1)); # The series converges at the left end
value(eval(S, x=x2)); # The series converges at the right end```

Edit.

## Solution...

We will denote  U[n]=u(x[n])  for all  n=1..N

 > restart; h:=0.01: r:=0.02: N:=10: f:=y->y^5: K:=(x,y)->sin(x)*y^5: assign(seq(x[n]=sin(h*n), n=1..N)); assign(seq(y[m]=cos(r*m), m=1..N)); Sys:={seq(add(K(x[n],y[m])*U[n],n=1..N)=f(y[m]), m=1..N)}; solve(Sys); assign(%); plot([seq([x[n],U[n]], n=1..N)]);
 >

## A way...

Of course, the indefinite integral is calculated up to an additive constant. Here's a way to get the desired result.

 >
 >
 >
 >
 (1)
 >
 >
 (2)
 >
 (3)
 >
 (4)
 >
 >
 (5)
 >
 >
 >
 (6)
 >
 (7)

subs(g(v)=f, PR);

 (8)

## combinat:-permute...

You can use  combinat:-permute  for this:

```restart;
S:=[1,2,3]:
combinat:-permute(map(`\$`,S, 2), 2);```

[[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]

or a little shorter

`combinat:-permute(`\$`~(S, 2), 2);`

Edit. If you use  the  Iterator  package then the  CartesianProduct  command can be used.

## simplify...

 > restart; V1 := Vector(8, [1, 2, 2, 1, 3, A, B, 1/(A + B)^2]); V2 := Vector(8, [1, 2, 2, 1, 3, A, B, 1/(A^2 + 2*A*B + B^2)]); V2:=simplify(V2); LinearAlgebra:-Equal(V1[6 .. 8], V2[6 .. 8]);
 (1)
 >

## RootFinding:-Analytic...

 (1)

 (2)

 (3)

```restart;