## 14284 Reputation

11 years, 228 days

## Correction and improvement...

tomleslie's method does not work correctly for  t<0 . Below is a fixed and improved version. We use discont option to remove vertical lines where the function is discontinuous. These places can be identified through a dotted line (second plot). The values of the function at points multiple of  2*Pi  can be shown with small solid circles (third plot) :

 > restart;   Frac:=x->x-floor(x):   p:=piecewise(Frac(t/2/Pi)>0 and Frac(t/2/Pi)<=1/2,Pi, Frac(t/2/Pi)>1/2 and Frac(t/2/Pi)<=1,2*Pi-2*Pi*Frac(t/2/Pi));  plot(p, t=-2*Pi..6*Pi, color=red, thickness=2, scaling=constrained, size=[1000,170], discont);   A:=plot([p,seq([2*Pi*k,s,s=0..Pi],k=-1..2)], t=-2*Pi..6*Pi, linestyle=[1,2\$4], color=red, thickness=2, scaling=constrained, size=[1000,170], discont); plots:-display(A, plots:-pointplot([seq([2*Pi*k,0],k=-1..3)], color=red, symbol=solidcircle, symbolsize=12));
 >

## Another way (without Student package)...

First, we find at what height ( z-value) these surfaces intersect, and then plot them using parametric equations and polar coordinates on the plane:

```# z=sqrt(x^2+y^2)
solve({12-z^2=z,z>0});
A:=plot3d([r*cos(t),r*sin(t),12-r^2],r=0..3,t=0..2*Pi,color=khaki):
B:=plot3d([r*cos(t),r*sin(t),r],r=0..8,t=0..2*Pi,transparency=0.5):
plots:-display(A,B, scaling=constrained, axes=normal, labels=[x,y,``],labelfont=[times,14]);
```

## Or...

```b := 3*(4*x+1)/(diff(f(y),y)*(3*x+1)):
A:=(4*x + 1)/diff(f(y),y) = a:
subs(diff(f(y),y)=solve(A,diff(f(y),y)), b);

```

## showstat...

Execute

showstat(LinearAlgebra:-IsSimilar);

## evalc...

Example:

restart;
N:=3:
z:=x+I*y:
evalc(z^N);

x^3-3*x*y^2+I*(3*x^2*y-y^3)

## 3 ways...

Examples.

Code in 1d math:
A:=<1,2; -1,5>;
LinearAlgebra:-Determinant(A);

Code in 2d math:
A:=<1,2; -1,5>;
|A|;

You probably have 2d math by default. Therefore, use the second example.

Edit. If you are not allowed to use a Maple procedure, here is a user-defined recursive procedure that evaluates the determinant of a matrix:

MyDet:=proc(A::Matrix)
local m,n;
m,n:=op(1,A);
if m<>n then error "The Matrix should be square" fi;
if m=1 then return A[1,1] else
end proc:

Example of use:
A:=<1,2,3;4,5,6;7,8,10>;
MyDet(A);

## Numerical calculation...

You can calculate this integral numerically using a simple procedure as follows:

`Int1 := (b,k,r,R)->evalf(Int(exp(-z*(R^2*k^2 - b^2*z)/(R*b))/(z*HeunB(0, k^2*R^2/(b*sqrt(R*b)), R^3*k^4/(4*b^3), 0, -sqrt(R*b)*z/R)^2), z = R .. r));`

Example of use:

Int1(0.5, 1, 2, 0.9);

1.462594758

## Solution...

 > restart; with(geom3d): with(plots): cA:=[1,2,3]: point(A,cA): v:=[1,2,2]: cC:=[10,11,12]: point(C,cC): point(E,v+cA): line(AB,[A,E]): projection(B,C,AB): cB:=coordinates(B); # Coordinates of B. The angle ABC=90 degrees Curve:=plottools:-curve([cA,cB,cC], color=red,thickness=3): T:=textplot3d([[cA[],"A"],[cB[],"B"],[cC[],"C"]], font=[times,18], align=right): display(Curve,T, axes=normal, labels=[x,y,z], view=[0..14,0..14,0..15], orientation=[-45,75]);
 >

Addition. Below I made an animation of this travel (continuation of the above code). The first frame shows the initially given points  A  and  C  and a green vector that determines the direction of movement:

```Back:=display(textplot3d([cA[],"A"], font=[times,18], align=right),textplot3d([cC[],"C"], font=[times,18], align=right),arrow([1,2,4],v,color=green),pointplot3d([cA,cC],symbol=solidsphere,color=red,symbolsize=17)):
Anim1:=animate((display@plottools:-line),[cA,cA+~t*~(cB-cA), color=red,thickness=3],t=0..1,background=Back,paraminfo=false):
Anim2:=animate(display,[textplot3d([cB[],"B"], font=[times,18], align=right)],a=0..1,frames=5,background=display(Back,pointplot3d(cB,symbol=solidsphere,color=red,symbolsize=17)),paraminfo=false):
Anim3:=animate((display@plottools:-line),[cB,cB+~t*~(cC-cB), color=red,thickness=3],t=0..1,background=display(Back,pointplot3d(cB,symbol=solidsphere,color=red,symbolsize=17)),paraminfo=false):
display([Anim1, display(op([1,-1,1],Anim1),Anim2), display(op([1,-1,1],Anim1),op([1,-1,1],Anim2),Anim3)], insequence, axes=normal, labels=[x,y,z], view=[0..14,0..14,0..15], orientation=[-45,75]);
```

Edit.

## Example...

Below is an example of solving your problem for a set of 10 random vectors:

 > restart; with(LinearAlgebra): n := 10: v:={seq(RandomVector(n),k=1..n)}; for i to n do for j to n do r[i,j] := DotProduct(v[i], v[j]); end do: end do: A:=Matrix(n, (i,j)->r[i,j]); b:={seq(,j=1..n)}; for k from 1 to n do LinearSolve(A,b[k]); od;
 (1)
 >

## Normally ...

by the series command.

Example:

```N:=10:
series(cos(x)^n, x=0, N);```

1-(1/2)*n*x^2+(-(1/12)*n+(1/8)*n^2)*x^4+(-(1/45)*n+(1/24)*n^2-  (1/48)*n^3)*x^6+(-17/2520*n+7/480*(n^2)-(1/96)*n^3+(1/384)*n^4)*x^8+O(x^10)

## Solution...

on a simple example from a help:

```restart;
with(plots):
A := Matrix([[2, 1, 0, 0, 3], [0, 2, 1, 0, 0], [0, 0, 2, 1, 0], [0, 0, 0, 2, 1], [0, 0, 0, 0, 2]]);
S := [([1, 2, 3, 4, 5]=~StringTools:-Char~(96+~[\$1..5]))[]];
sparsematrixplot(A, matrixview, tickmarks = [S, map(t->-lhs(t) = rhs(t) , S)]);```

## Not implemented...

As far as I know, Maple does not implement a step-by-step solution of differential equations. However, you can find out the type of your equation, for example:

`DEtools:-odeadvisor(diff(y(x),x)=(x^2+1)*sin(y(x)), y(x));`

Output:                          [_separable]

For details see help on  ?dsolve,details

## map...

Try the following, where  Expr  is your expression to be simplified. If this does not help, then upload your worksheet here.

map(simplify, Expr);

The  map  command forces the application of the  simplify  command separately to each operand of the expression.

Edit.

## F2=infinity...

We see that the sequence  f1(k)  is the sequence of even numbers, starting with 2. Therefore, the sum of the corresponding series is equal to infinity:

```H := r->piecewise(r < 1, 1, 0);
f1 := k-> sum(2*(1-H(j)), j = 0 .. k);
seq(f1(k), k=1..10);
expand(sum(2*k, k=1..n));
sum(2*k, k=1..infinity);
```

## plots:-implicitplot...

If you need to plot a graph of the dependence of the real roots of the equation on a parameter, then it is not necessary to solve this equation first (this is not always possible explicitly). The easiest way to use the  plots:-implicitplot  command for this.
Below your example is solved in two versions: first in the range a in  0 .. 1 , and then in a wider range  a in  -0.5 .. 2.5. For the range  0 .. 1, we see that there are 2 roots close to 0 and one positive root, significantly superior to the first two:

```restart;

A:=plots:-implicitplot(x^3+(a-3)^3*x^2-x*a^2+a^3 = 0, a=0..1, x=-1..30, color=red, grid=[100,20000], axes=box):
B:=plots:-implicitplot(x^3+(a-3)^3*x^2-x*a^2+a^3 = 0, a=0..1, x=-1..1, color=red, thickness=2, gridrefine=4):
plots:-display(< A | B >);

C:=plots:-implicitplot(x^3+(a-3)^3*x^2-x*a^2+a^3 = 0, a=-0.5..2.5, x=-100..100, color=red, thickness=2, gridrefine=3, axes=box):

plots:-display(C, B, size=[800,400]);
```

Addition. In your problem it is interesting to find values of the parameter a , at which the number of real roots changes. Visually, these are 0 and 1.8 (approximately). Next, we find the exact values using the discriminant:

```d:=discrim(x^3+(a-3)^3*x^2-x*a^2+a^3, x);
solve(d);
select(type, {%}, realcons);
evalf(%);
```

The final results:
{0, -(1/6)*(324+12*sqrt(741))^(1/3)+2/(324+12*sqrt(741))^(1/3)+3}
{0., 1.786588337}

 First 7 8 9 10 11 12 13 Last Page 9 of 223
﻿