## 15534 Reputation

12 years, 140 days

## `if`...

```f:=(i,j)->``((x-GaußKnoten[j])/(GaußKnoten[i]-GaußKnoten[j]));
n:=3;
`*`(seq(seq(`if`(i<>j,f(i,j),NULL), j=1..n), i=1..n));
```

Edit. In order to explicitly multiply all this, use the  expand  command (code continuation):

`expand(%);`

## Plot and animation...

Using the  plots:-odeplot  command, we can easily not only plot the curve, but also animate it:

`plots:-odeplot(F, [x(t), y(t), z(t)], t = 0 .. 0.7, color = red, thickness = 2, axes = normal, scaling = constrained)`

`plots:-odeplot(F, [x(t), y(t), z(t)], t = 0 .. 0.7, color = red, thickness = 2, axes = normal, scaling = constrained, frames = 15);`

## convert(... , diff)...

Maybe the following more detailed form of writing will be clearer:

```diff(w(y(t), t), t);
convert(%, diff);```

## plots:-inequal...

This is easy to do if you use the plots:-inequal  command and Cartesian coordinates:

```with(plots):
P1 := plot([-sin(t), t, t = 0 .. 2*Pi], coords = polar, color = red):
P2 := plot([cos(t), t, t = 0 .. 2*Pi], coords = polar, color = blue):
Shade := inequal({(x-1/2)^2+y^2<1/4,x^2+(y+1/2)^2<1/4}, x=-0.5..1, y=-1..0.5, color=yellow, nolines):
display(P1, P2, Shade, scaling = constrained);
```

Below is another method based on approximating a region on the plane by a polygon:

```with(plots): with(plottools):
P1 := plot(-sin(t), t = 0 .. 2*Pi, coords = polar, color = red):
P2 := plot(cos(t), t = 0 .. 2*Pi, coords = polar, color = blue):
P:=polygon([seq([-sin(t)*cos(t),-sin(t)*sin(t)],t=-evalf(Pi/4)..0,0.1),seq([cos(t)*cos(t),cos(t)*sin(t)],t=-evalf(Pi/2)..-evalf(Pi/4),0.1)],color=yellow,style=surface):
display(P1, P2, P, scaling = constrained);
```

This method is automated in my post  https://www.mapleprimes.com/posts/145922-Perimeter-Area-And-Visualization-Of-A-Plane-Figure-  and is applicable to any flat region bounded by a piecewise smooth non-selfintersecting curve (the curve can be specified in Cartesian or polar coordinates or parametrically).

Edit.

## eval, alias...

As alternatives to  subs , you can also use  eval  or  alias :

```restart;
s1 := RootOf(D1*D2*D6*_Z^2+(-D1*D4*D6-D2*D6*S-D4)*_Z+D4*D6*S):

s2 := -(D1*RootOf(D1*D2*D6*_Z^2+(-D1*D4*D6-D2*D6*S-D4)*_Z+D4*D6*S)*D6-S*D6+RootOf(D1*D2*D6*_Z^2+(-D1*D4*D6-D2*D6*S-D4)*_Z+D4*D6*S))/D2/D6/RootOf(D1*D2*D6*_Z^2+(-D1*D4*D6-D2*D6*S-D4)*_Z+D4*D6*S):

eval(s2, s1=s);
alias(s=s1):
s2;
```

If  subs  and  eval  are fairly close commands, then  alias  is essentially different from them. If in the first two cases  s  is just a symbol, then as for  alias  Maple remembers what  s  means. This may be more convenient in subsequent calculations. See help on these commands.

## Plotting...

```restart;
lambda:=x+I*y:
evalc(abs(1+1/3*lambda+1/18*lambda^2-1/324*lambda^3+1/1944*lambda^4)-1);
plots:-implicitplot(%, x=-15..15, y=-15..15, gridrefine=5, scaling=constrained, size=[550,550]);```

Edit. It would be interesting to show that the curves on the right (bottom and top) are exact circles (this is my assumption) and learn their equations.

The following is working:

 > restart; P1:=(r,R)->(2/Pi)*(arccos(r/(2*R))-(r/(2*R))*sqrt(1-(r/(2*R))^2)); J0:=(r,shk)->BesselJ(0, 2*Pi*r*shk); Jhk:=unapply(evalf((1/s)*Int(P1(r,R)*J0(r,shk)*sin(2*Pi*r*s), r=0..2*R)),s,shk,R); plot(Jhk(s,2.14,38), s=0..5, numpoints=200, size=[1000,300]);
 >

 (1)

 (2)

 (3)

 (4)

## The order of arguments...

You have mixed up the order of arguments for  Normal(mu, sigma) . The first argument  mu  is the mean, and the second one  sigma  is the standard deviation.

Solution:

```restart;
with(Statistics):
X := RandomVariable(Normal(mu, 10));
dummy := int(PDF(X,u), u = -infinity .. 500);
fsolve(dummy = 0.05, mu=500..infinity);
```

516.4485363

Within the meaning of the task for the probability to be <=0.05 ,  should be  mu >= 516.4485363

Temperature over 24hr period

 (1)

plot(y);

It corrected in Maple 2018.2:

 (1)

 (2)

 (3)

 (4)

 (5)

 (6)

 (7)

 (8)

 (9)

 (10)

 (11)

 (12)

## 2020...

Such a year will be only one. This is the year  2020 .

```restart;
with(LinearAlgebra):
k:=0: T:=table():
for i from 2001 to 2100 do
L:=convert(i,base,10);
R,A,E,Y:=L[];
M:=<Y,E,A,R; E,A,R,Y; A,R,Y,E; R,Y,E,A>;
N:=<M | <2,0,2,0>>;
m:=Rank(M); n:=Rank(N);
if m<4 then if m=n then k:=k+1; T[k]:=Y*10^3+E*10^2+A*10+R fi;fi;
od:
YEARs:=convert(T,list); ```

YEARs := [2020]

Edit. As Thomas Dean pointed out in his comment, replacing the vector  <2,0,2,0>  in the code with the vector  <Y,E,A,R>  allows you to get a larger number of solutions.

## Comparisons...

Compare these options:

```restart;
data:=[\$1..10^6]:
CodeTools:-Usage(is(numelems(data)<>0));
CodeTools:-Usage(is(data<>[]));
CodeTools:-Usage(is(nops(data)<>0));
CodeTools:-Usage(is(not (data::[])));
```

I usually use the  nops  command.

## expand, assuming...

`expand(exp(k*(ln(t)+ln(a)))-(exp(ln(t)+ln(a)))^k) assuming t > 0, a > 0;`

0

1. Maple often calculates the sum of divergent series in a special sense. For instance

```evalf(sum((-1)^(n+1),n=1..infinity));
```

0.5000000000

See help on  sum,details  and  wiki  https://en.wikipedia.org/wiki/Divergent_series  for details.

2. When you calculate  limit((-1)^n, n=infinity) , then n is not necessarily an integer, for example

`(-1)^2.7;`

-0.5877852523 + 0.8090169944*I

 First 16 17 18 19 20 21 22 Last Page 18 of 242
﻿