## 19919 Reputation

15 years, 228 days

 (1)

 (2)

 (3)

 >
 >
 >
 >
 >

## Recursive procedure...

```restart;
solve({2*(k+1)*X(k+1)+(k+1)*Y(k+1)-X(k)-Y(k)+(1)/k!,(k+1)*X(k+1)+(k+1)*Y(k+1)+2*X(k)+Y(k)+(1)/k!},{X(k+1),Y(k+1)});
sol:=subs(k=k-1,eval([X(k+1),Y(k+1)],%));

Sol:=proc(n)
option remember;
if n=0 then return [2,1] else eval(sol,[X(k-1)=Sol(n-1)[1],Y(k-1)=Sol(n-1)[2],k=n]) fi;
end proc:

seq(Sol(k), k=0..5); # Example
```

The output in the example above  was corrected.

## evalc, normal...

The  evalc  command performs operations on complex expressions, assuming all parameters are real numbers. The  normal  command brings the sum (difference) of fractions to a common denominator:

```restart;
Zin := Rin + omega*L*I + (omega*L)^2/(RL + omega*L*I);
evalc(Zin);
normal(Re(%))+normal(Im(%))*I assuming real;
```

## Numerical solution...

If we solve your equation for the derivative, we see that the original equation splits into two equations. We can solve any of them numerically by giving an initial condition. We solve the first equation below:

 > restart; Eq:=eval(h(u)^2 + 2*a*h(u)/sqrt(1 + diff(h(u), u)^2) = b^2,[a=3,b=1]); sol:=solve(Eq,  diff(h(u), u)); Eq1:=diff(h(u), u)=sol[1]; Sol:=dsolve( {Eq1,h(0)=2}, numeric); plots:-odeplot(Sol,[u,h(u)], u=0..5, view=0..7);
 >

## Procedure and examples...

```restart;
Unimodal:=proc(L::list)
local n, b, i;
n:=nops(L); b:=false;
for i from 1 to n do
if `and`(seq(L[k]<=L[k+1],k=1..i-1)) and `and`(seq(L[k]>=L[k+1],k=i..n-1)) then b:=true; break fi;
od;
b;
end proc:

L1:=[1, 1, 1, 1, 1]:
L2:=[1,2,3,4,5,4,3,2,1]:
L3:=[1, 2, 2, 3, 4, 5, 5, 5]:
L4:=[5, 5, 4, 4, 3, 3, 1]:
Unimodal~([L1,L2,L3,L4]);

L5:=[1, 0, 1, 0]: L6:=[1, 1, 2, 2, 3, 4, 5, 2, 2, 6, 4, 2, 2, 1, 0]:
Unimodal~([L5,L6]);

seq(Unimodal([seq(binomial(n,k), k=0..n)]), n=10..15);
```

[true, true, true, true]
[false, false]
true, true, true, true, true, true

## Solution of a)...

At the points of local minimum and local maximum, the derivative of the function  f  is equal to zero:

```restart;
f:=x->x^3+a*x^2+b*x;
Sys:={D(f)(-1)=0,D(f)(3)=0};
solve(Sys);
plot(eval(f(x),%), x=-3.5..5.5);  # A visual check
```

## Student:-NumericalAnalysis:-Secant...

You can use the  Student:-NumericalAnalysis:-Secant  command if, from the first equation, simply express  in terms of  x  and substitute it into the second equation. From the plot, 3 roots are clearly visible (this is easy to justify strictly using the derivative). We find a sequence of successive approximations to the root on the segment  [2, 3]  with a given accuracy:

```restart;
f1 := x^2 - x*y + 2:
f2 := x^2*y^2 - y - 43:
f:=unapply(solve(f1, y), x);
Eq:=eval(f2, y=f(x));
plot(Eq, x=-3..3, -50..20, color=red, size=[700,300]);
L:=[Student:-NumericalAnalysis:-Secant(Eq, [2,3], tolerance = 10^(-2), output = sequence)];
f(L[-1]); # The value y for x=2.188564229
fsolve({f1,f2}, {x=2,y=3}); # Check
```

## explicit...

The  explicit  option allows you to get the values of all roots at once. A total of 5 roots were found. Explicit expressions for the roots from the second to the fifth are very cumbersome:

```restart;

eq1 := alpha + beta*r[c] - d*n[c] - Upsilon*n[c]*(n[r] + r[c]) - n[r]*(alpha - d*n[c] - b*(n[r] + r[c]));
eq2 := `e&Upsi;`*n[c]*(n[r] + r[c]) - mu*n[r] + d*n[c]*n[r] + b*n[c]*n[r] - alpha*n[r];
eq3 := b*n[c]*n[r] + d*n[c]*n[r] - alpha*n[r] - beta*r[c] + mu*n[r];

Sol:=[solve({eq1, eq2, eq3}, {n[c], n[r], r[c]}, explicit)];
m:=nops(Sol);
for k from 1 to m do
Sol||k:=Sol[k];
od;
```

## The Physics package...

See help  ?examples,Physics .

```restart;
T[e]:=1.2: T[i]:=0.01: delta[p]:=0.2:
V:=n(x)^2*((T[e]+T[i])/T[e])*((((n(x)-1)*(1+1/(2*delta[p]))))-ln(n(x))-ln(n(x))+ln(2*delta[p]));
Eq:=diff(n(x),x)=sqrt(-2*V);
dsolve({Eq, n(0)=1}, n(x), numeric);
plots:-odeplot(%,[x,n(x)], x=0..1);
```

## gcdex...

Example:

```d:=gcdex(x^3-1, x^5-1, x, 's', 't');
s, t;
is(d=s*(x^3-1)+t*(x^5-1));```

## A way...

```restart;
`&I;` = (1/64)*(`&D;`^4-d^4)*Pi;
```

## Example 1) :geometry:-conic(c, x^2+x*y+y...

Example 1) :

```geometry:-conic(c, x^2+x*y+y^2+2*x-2*y, [x, y]):
geometry:-detail(c);```

Knowing the lengths of the major and minor semiaxes and the center, you can easily write down the standard equation of this ellipse.

## plot...

```restart;
ina := proc (n) false end :
a := proc (n) option remember; local k;
if n < 5 then k := 2*n-1
else for k from 2 while ina(k) or igcd(k, a(n-1)) <> 1 or igcd(k, a(n-2)) <> 1 or igcd(k, a(n-3)) <> 1
do  od;
fi; ina(k) := true; k;
end proc:

m:=40:
L:=[seq([n,a(n)], n = 1 .. m)];
plot(L, view=[0..m,0..a(m)], size=[800,500]);```

 First 9 10 11 12 13 14 15 Last Page 11 of 279
﻿