## 874 Reputation

15 years, 15 days

## Code:...

```p(x,y); D[2](p)(x,h)=0;```

## This is far from the best solution:...

```  restart;
with(plots);

Plotter:= proc(_a := 10,  _b := 7, _phi := 4/5*Pi)
local O, a, b, P, Q, M, X, Y, phi, c, Ell, vec, F1, F2, F1F2, ELL, Hyp, dF1, dF2, cir1, cir2, asym1, asym2, tp, range0, range1;

P := b*x*cos(phi) + a*y*sin(phi) - a . b = 0;
Q := a*x*sin(phi) - b*y*cos(phi) - c^2*sin(phi)*cos(phi) = 0;
M := op(solve([P, Q], [x, y]));
X := `&-+`((P)/(sqrt(b^2*cos(phi)^2 + a^2*sin(phi)^2)));
Y := `&-+`((Q)/(sqrt(b^2*cos(phi)^2 + a^2*sin(phi)^2)));
a:=_a;
b:=_b;
phi:=_phi;
c := sqrt(a^2 - b^2);
#  (P^2)/(A*(b^2*cos(phi)^2 + a^2*sin(phi)^2)) + (Q^2)/(B*(b^2*cos(phi)^2 + a^2*sin(phi)^2)) - 1 = 0;;
Ell := plots:-implicitplot((x^2)/(a^2) + (y^2)/(b^2) - 1 = 0, x = -11 .. 11,
y = -8 .. 8, color = grey);

O := [0, 0];
M := [a*cos(phi), b*sin(phi)];
vec := plot([O, M], color = black, thickness = 1);

range0 := -20 .. 20, -20 .. 20;
range1 := x = range0[1], y = range0[2];

P := plots:-implicitplot(eval(P), range1, color = aquamarine);
Q := plots:-implicitplot(eval(Q), range1);
F1 := [(a + b)*cos(phi), (a + b)*sin(phi)];
F2 := [2*M[1] - F1[1], 2*M[2] - F1[2]];
F1F2 := plot(eval([F1, F2]), color = green, thickness = 3);
ELL := plots:-implicitplot(eval(((b*x*cos(phi) + a*y*sin(phi) - `.`(a, b))^2)/(
a^2*(b^2*cos(phi)^2 + a^2*sin(phi)^2)) + (
(a*x*sin(phi) - b*y*cos(phi) - c^2*sin(phi)*cos(phi))^2)/(c^2*cos(phi)^2*(
b^2*cos(phi)^2 + a^2*sin(phi)^2)) - 1 = 0), range1,
color = blue, thickness = 3);

Hyp := plots:-implicitplot(((b*x*cos(phi) + a*y*sin(phi) - `.`(a, b))^2)/(
b^2*(b^2*cos(phi)^2 + a^2*sin(phi)^2)) - (
(a*x*sin(phi) - b*y*cos(phi) - c^2*sin(phi)*cos(phi))^2)/(c^2*sin(phi)^2*(
b^2*cos(phi)^2 + a^2*sin(phi)^2)) - 1 = 0, range1,
color = black);
dF1 := plottools[disk](F1, 0.3, color = red);
dF2 := plottools[disk](F2, 0.3, color = red);
cir1 := plots:-implicitplot(x^2 + y^2 = (a + b)^2, x = -20 .. 20,
y = -18 .. 18, color = pink);
cir2 := plots:-implicitplot(x^2 + y^2 = (a - b)^2, x = -10 .. 10,
y = -4 .. 4, color = coral);
asym1 := plots:-implicitplot((b*x*cos(phi) + a*y*sin(phi) - `.`(a, b))/(b)
+ (a*x*sin(phi) - b*y*cos(phi) - c^2*sin(phi)*cos(phi))/(c*sin(phi)) = 0,
x = -20 .. 20, y = -18 .. 18, color = black, linestyle = DOT);
asym2 := plots:-implicitplot((b*x*cos(phi) + a*y*sin(phi) - `.`(a, b))/(b)
- (a*x*sin(phi) - b*y*cos(phi) - c^2*sin(phi)*cos(phi))/(c*sin(phi)) = 0,
x = -20 .. 20, y = -18 .. 18, color = black, linestyle = DOT);
tp := plots:-textplot([[M[1], M[2] + 0.8, "M"], [F1[1] - 0.8, F1[2], "F1"],
[F2[1] + 0.8, F2[2] + 0.3, "F2"], [5, 15, "axe P"], [8, -10, "axe Q"]]);
plots:-display(
[Ell, vec, P, Q, F1F2, cir1, cir2, ELL, Hyp, dF1, dF2, asym1, asym2, tp],
scaling = constrained, axes = normal,
axis = [gridlines = [1, color = blue]], xtickmarks = 0, ytickmarks = 0,
view = [-20 .. 20, -20 .. 20], size = [500, 500]);
end;

plots[display](seq(Plotter(10, 7, alpha), alpha = 0.1 .. evalf(2*Pi), 0.1), insequence = true);
```

Thumb if You like.

## ?...

Please post code in text or worksheet form, rather than printouts.

```  restart;
P := -lambda*exp(-Phi(xi)) - mu*exp(Phi(xi));
u[0] := A[0] + A[1]*exp(-Phi(xi)) + A[2]*exp(-Phi(xi))*exp(-Phi(xi));
u[1] := diff(u[0], xi);
d[1] := -A[1]*P*exp(-Phi(xi)) - 2*A[2]*(exp(-Phi(xi)))^2*P;
u[2] := diff(d[1], xi);
d[2] := -A[1]*(lambda*P*exp(-Phi(xi)) - mu*P*exp(Phi(xi)))*exp(-Phi(xi))
+ A[1]*(-lambda*exp(-Phi(xi)) - mu*exp(Phi(xi)))*P*exp(-Phi(xi))
+ 4*A[2]*(exp(-Phi(xi)))^2*(-lambda*exp(-Phi(xi)) - mu*exp(Phi(xi)))*P
- 2*A[2]*(exp(-Phi(xi)))^2*(lambda*P*exp(-Phi(xi)) - mu*P*exp(Phi(xi)));
collect(
expand(2*k*k*w*beta*d[2] - 2*alpha*k*k*d[1] - 2*w*u[0] + k*u[0]*u[0]),
exp(Phi(xi)));

restart;
solve({12*beta*k^2*lambda^2*w*A[2] + k*A[2]^2,
4*beta*k^2*lambda^2*w*A[1] - 4*alpha*k^2*lambda*A[2] + 2*k*A[1]*A[2],
4*beta*k^2*mu^2*w*A[2] - 2*alpha*k^2*mu*A[1] + k*A[0]^2 - 2*w*A[0],
4*beta*k^2*lambda*mu*w*A[1] - 4*alpha*k^2*mu*A[2] + 2*k*A[0]*A[1] - 2*w*A[1], 16*beta*
k^2*lambda*mu*w*A[2] - 2*alpha*k^2*lambda*A[1] + 2*k*A[0]*A[2] + k*A[1]^2
- 2*w*A[2]}, {A[0], A[1], A[2], k, w});
set__1;
{A[0] = (RootOf(100*_Z^2*lambda*mu + 1)*alpha)/(2*beta*RootOf(24*_Z^2*beta*
lambda*mu - 1)),
A[1] = (alpha)/(10*beta*mu*RootOf(24*_Z^2*beta*lambda*mu - 1)), A[2] = -12*
RootOf(24*_Z^2*beta*lambda*mu - 1)*lambda^2*RootOf(100*_Z^2*lambda*mu + 1)*
alpha, k = RootOf(24*_Z^2*beta*lambda*mu - 1),
w = (RootOf(100*_Z^2*lambda*mu + 1)*alpha)/(beta)};

restart;
solve({24*Z^2*beta*lambda*mu - 1}, {Z});
solve({100*Z^2*lambda*mu + 1}, {Z});

restart;
k := (sqrt(6))/(12*sqrt(beta*lambda*mu));
w := - (alpha)/(10*sqrt(-lambda*mu)*beta);
A[0] := - (3*alpha*sqrt(beta*lambda*mu))/(5*sqrt(-lambda*mu)*beta*sqrt(6));
A[1] := (6*alpha*sqrt(beta*lambda*mu))/(5*beta*mu*sqrt(6));
A[2] := (sqrt(6)*lambda^2*alpha)/(10*sqrt(beta*lambda*mu)*sqrt(-lambda*mu));
lambda := 3;
mu := 2;
H := -ln(sqrt((lambda)/(mu))*tan(sqrt(lambda*mu)*(xi + C)));
u[0] := A[0] + A[1]*exp(-H) + A[2]*exp(-H)*exp(-H);
f := diff(u[0], xi);
S := diff(f, xi);
eq := 2*k*k*w*beta*S - 2*alpha*k*k*f - 2*w*u[0] + k*u[0]*u[0];
value(%);
simplify(%);
```

## Idea....

I think you can identify the tick values yourself. Instead of using integer values maybe convert them to string first?

## Dsolve issue....

This is not a problem with seq, but a problem with dsolve result. It is apparent it contains the original variable t, which is later affected. Use this for fix:
`my_x:=subs(t=_t, eval(x, dsol));`

Thumb if You like.

## No restriction....

The condition is always satisifed.

```vars:=[x,y,z];
for invars in vars do
[cat(invars, 1..nops(vars))]
end do;
```

or

```for invars in vars do
[(n->n||(1..nops(vars)))(invars)]
end do;```

or

`(n->n||(1..nops(vars)))~(vars) `

Thumb if You like.

## Code:...

I think you want to do this:

```map(proc(P, V)
local c, C, v;
coeffs(P, V, 'c');
[seq([seq(type(C, dependent(v)), v = V)], C = [c])];
end proc, eq, incog);
subs([true = 1, false = 0], %);

#also
Matrix(map(op, %));
```

Thumb if You like.

## That should bef:=unapply(3*x+2, x);g:=D(...

That should be

```f:=unapply(3*x+2, x);
g:=D(f);
g(3);
```

Thumb if You like.

## Always dependent....

Your vectors are always linearly dependent:

```Matrix([[cos+I*sin, 1], [1, cos-I*sin]](t));
map(expand@convert, %, exp);
simplify(LinearAlgebra:-Determinant(%));
```

Thumb if You like.

## ?plot, options...

Look under
?plot, options
?plot3d, options

Search for transparency

## Second problem....

I wonder if the following is correct. This is the second formula:

```T0 := proc(a, d) 1 - exp(-d*a^2) + 1/3*d*(2*a^3 - 3*a^2 + 1) end proc;
T1 := proc(d) if d <= 0 then 1 - exp(-d) else 1/3*d end if; end proc;
T2 := proc(d)
if evalf(d < 3 + LambertW(-3*exp(-3))) then 1/3*d else 1 - exp(-d) end if;
end proc;
T3 := proc(d)
map(T0, [Re(evalf(RootOf(exp(-d*_Z^2) + _Z - 1, (1)/(d) .. (2*LambertW(-1, - 1/2*exp((-1)/2)) + 1)/(2*LambertW(-1, - 1/2*exp((-1)/2)))
))), Re(evalf(RootOf(exp(-d*_Z^2) + _Z - 1, (2*LambertW(-1, - 1/2*exp((-1)/2)) + 1)/(2*LambertW(-1, - 1/2*exp((-1)/2))) ..
1)))], d);
min(op(%));
end proc;
T4 := proc(d)
if evalf(d < - (2*LambertW(-1, - 1/2*exp((-1)/2))^2)/(2*LambertW(-1, - 1/2*exp((-1)/2)) + 1)
) then
T1(d)
else
min(T2(d), T3(d))
end if;
end proc;

plot(T4,  2..5);
plot(T4,  -2..3);

#The above is
expr := exp(-d*a^2) - 1/3*d*(2*a^3 - 3*a^2 + 1);
sought := 1 - max(expr);
expr := 1 - expr;
sought := min(expr);
#where 0<=a<=1

```

Thumb if You like

## See ?minimize....

For infinum you can use minimize:

minimize(exp(a*(d-1)), a = 0..1);
convert(1-minimize(exp(d*(a-1)), a = 0..1), piecewise, d);
plot(%, d = -2..2, thickness = 2);

Thumb if You like.

## Digits....

@mschneider What you've found is not a fix. The correct response in this situation is to use fnormal. For example:

```a := exp(2);
b := (exp(1))^2;

for i to 25 do
precision := 10+i:
a-b=fnormal(evalf(a-b));
end do;
```

or

```K:=2;
response := subs(a = exp(1), 5*a^(7.5*t));
a := evalf(subs(t = Pi, answer),Digits+K);
b := evalf(subs(t = Pi, response), Digits+K);
fnormal(a-b, Digits);
```

Thumb if You like.

## Digits....

Your low Digits settings is incurring this significant error. Increase it to 25.

 3 4 5 6 7 8 9 Last Page 5 of 15
﻿