## 20474 Reputation

16 years, 70 days

## Solution...

Make it as follows:

A:= `2*(a+b)`:

B:= `2*a+2*b`:

evalb(A = B);

false

## Solution...

Blue color- x = constgreen colory = const:

plots[implicitplot]([seq(u^2-v^2=C, C=-10..10), u^2-v^2=-1/3, u^2-v^2=1/3, seq(2^u*v=C, C=-10..10), 2^u*v=-1/3, 2^u*v=1/3], u=-10..10, v=-10..10, color=[blue\$23, green\$23],numpoints=10000, view=[-1..3, -3..3], thickness=3,scaling=constrained);

## Statistics[NonlinearFit]...

If the parameters C1 and C2 are unknown, then use the command  Statistics[NonlinearFit]

## Why is m not zero? It is natural to...

Why is m not zero? It is natural to assume that m is any none-negative number:

int((x-m^2)/(x+1),x=0..m^2)  assuming m >= 0;

-ln(m^2+1)+m^2-ln(m^2+1)*m^2

## A more general approach...

It can be generalized to the continuous case (integration), but the previous two approaches can't.

int( int(x*y, y=1..piecewise(8-x>6, 6, 8-x)), x=1..6);

1627/12

Compare:

int( int(x*y, y=1..min(6, 8-x)), x=1..6);

## Plot...

A:=plot([seq(50+C*exp(-0.196*t), C=-40..40,20)], t=0..10,0..100, thickness=2, tickmarks=[default, [seq(10*k, k=0..9)]]):

B:=plots[textplot]([seq([0.5,14+20*i, C=-40+20*i], i=0..4)], font=[TIMES,ROMAN,14]):

plots[display](A, B);

L:=[ ]:

for t from 10 by 2 to 100 do

h := solve({x*y*z = 6*t^3, x-y-z = 0, x+y+z = 6*t}, {x, y, z}):

L:= [op(L), rhs(h[1][2])]:

end do:

A:=matrix([L]);

## Improved version of the procedure...

It works much faster.

NumberOfTriangles1:=proc(G)

local L, M, N, i, j;

uses GraphTheory;

L:=Edges(G);

M:=Vertices(G);

N:=0;

for i in L do

for j in M do

if evalb({i[1],j} in L) and evalb({i[2],j} in L) then N:=N+1; fi;

od; od;

N/3;

end proc:

An example:

G:=GraphTheory[RandomGraphs][RandomGraph](200, 1000):

st := time(): NumberOfTriangles1(G); time()-st;

171

1.045

## Procedure...

It's quite simple. For clarity, the procedure draws a graph G . If it is not necessary, you just remove the line  print(DrawGraph(G));  from the text of the procedure.

NumberOfTriangles:=proc(n, m)

local G, N, i, j, k, G1;

uses GraphTheory;

G:=RandomGraphs[RandomGraph](n, m);

N:=0:

for i to n-2 do

for j from i+1 to n-1 do

for k from j+1 to n do

G1:=InducedSubgraph(G,[i,j,k]);

if NumberOfEdges(G1)=3 then N:=N+1; fi;

od; od; od;

print(DrawGraph(G));

N;

end proc;

Example:

NumberOfTriangles(8,14);

## Re...

combine(r^2 * Sum(A(j)*r^(n+j), j));

## Try to swap...

In the code try to swap   c = 0 .. 4  and  xT = .8 .. 1 .

## Solution...

assume(a+b>c,  a+c>b,  b+c>a):

p:=(a+b+c)/2:

S:=sqrt(p*(p-a)*(p-b)*(p-c)):

`cos(A)`:=(b^2+c^2-a^2)/2/b/c:

`cos(B)`:=(a^2+c^2-b^2)/2/a/c:

`cos(C)`:=(b^2+a^2-c^2)/2/b/a:

`tan(A/2)`:=sqrt((1-`cos(A)`)/(1+`cos(A)`)):

`tan(B/2)`:=sqrt((1-`cos(B)`)/(1+`cos(B)`)):

`tan(C/2)`:=sqrt((1-`cos(C)`)/(1+`cos(C)`)):

r:=S/p:  R:=a*b*c/4/S:

is(p*(`tan(A/2)`+`tan(B/2)`+`tan(C/2)`)=r+4*R);

true

## If you use Bonnet's recursion formula fr...

If you use Bonnet's recursion formula from wiki, the program can be obtained very simple:

LegPol:=proc(n)

local P, i, f;

P[0]:=1: P[1]:=x:

if n>=2 then for i to n-1 do

P[i+1]:=((2*i+1)*x*P[i]-i*P[i-1])/(i+1);

od; fi;

f:=expand(P[n]);

f/lcoeff(f);

end proc;

Example:

for k from 0 to 9 do

LegPol(k);

od;

You get the same polynomials as above.

## One line...

Your problem can be solved in one line. However, my previous comment fully applies and to this decision:

extrema(sqrt((X-x)^2+(Y-y)^2+(Z-z)^2),{x^2 + y^2 + z^2-2*x+4*y+2*z-3=0, 2*X-Y+2*Z-14=0},{X,Y,Z,x,y,z},'s'),  s;

 First 275 276 277 278 279 280 281 Page 277 of 283
﻿