vv

12453 Reputation

19 Badges

9 years, 278 days

MaplePrimes Activity


These are answers submitted by vv

restart;

f:= (n,x) -> piecewise(x <-1/n, -1, x<1/n,n*x, 1);
plot([f(3,x), f(7,x)], x=-2..2, color=[red,blue]);

f := proc (n, x) options operator, arrow; piecewise(x < -1/n, -1, x < 1/n, n*x, 1) end proc

 

 

simplify(int( abs(f(n,x)-f(m,x)), x=-1..1)) assuming 1<=m, m<n;
# Unfortunately, Maple cannot do it directly

int(abs(-piecewise(x*n < -1, -1, x*n < 1, x*n, 1)+piecewise(x*m < -1, -1, x*m < 1, x*m, 1)), x = -1 .. 1)

(1)

ans:=simplify(2*int(f(n,x)-f(m,x), x=0..1)) assuming m>1,n>m;
# Using that x->f(n,x) is odd and f(m,x)<=f(n,x) for x>=0

(n-m)/(n*m)

(2)

map(evalf@eval, Int(abs(f(n,x)-f(m,x)), x=-1..1) = ans, [m=3,n=7] ); # numeric check

.1904761905 = .1904761905

(3)

 

 

There are several problems with your code:

--  x is used both as a table (indexed) and as a real number. Use another name for one of them.

-- The arguments of piecewise are in a wrong order

--  You must use unapply when defining phi (otherwise the arguments of piecewise are not evaluated).

You may define (inside or outside the mpl)

Dy := t -> eval(diff(y(t_),t_), t_=t);
D2y := t -> eval(diff(y(t_),t_$2), t_=t);

and then 

ode:=D2y(x)+Dy(x)=sin(x);
ic:=y(0)=1,Dy(0)=0;
dsolve([ode,ic],y(x));

 

For n=4, we may take the points O(0,0), A(3,0), B(3,4), C(0,4); I don't know whether the radius (5/2 here) is minimal.
For a general n, Erdos and Anning have a construction (1945), see Erdős–Anning theorem - Wikipedia

Edit. The minimal radius is 8/sqrt(15) = 2.06...  and corresponds to a cyclic quadrilateral having the lengths of the edges: 2, 3, 2, 4.

A 3d line is determined by a point P and a direction V. 
We need a necessary and sufficient condition for the concurrency of two (non-parallel)  lines.
Let's represent P and V as lists.

restart;
conc:=(P1,V1,P2,V2) -> LinearAlgebra:-Determinant(Matrix([P1-P2,V1,V2])):
A:= [1,-2,3]:    # Your data
d1:= [1,0,-3], [2,1,-2]:
d2:= [1,0, 3], [-1,1,2]:
solve( [ conc(A, [p,q,r], d1), conc(A, [p,q,r], d2) ], [p,q,r] );
#                 [[p = 6/5*q, q = q, r = -12/5*q]]
TheLine = A, eval([p,q,r], %[]); # the wanted line
#               TheLine = [1, -2, 3], [6/5*q, q, -12/5*q]
eval(%,q=5); #Or,
#               TheLine = [1, -2, 3], [6, 5, -12]

So, you may write it as:  (x-1)/6 = (y+2)/5 = (z-3)/(-12)

- If you want just the plot:

plots:-intersectplot(f - z, g - z, x = 0 .. 1, y = 0 .. 2, z = -0.01 .. 0.01, thickness = 3)

- If you want its projection, use Ruben's approach or

plots:-implicitplot(f-g, x=0..1,y=0..2)

- For a numeric parametrization see above, or use a system of ODEs.  

Your sum can be written as

The numerator represents the finite difference of order 2*k+2 of a monic polynomial of degree 2*k+4.
So, it's a polynomial of degree 2, the coefficients depending on k. The leading coefficient is (2*k+4)!/2.
The remaining two coefficients can be computed by recurrence Δⁿ⁺¹ = Δ(Δⁿ).

You are making a mess by using two kinds of variables such as T[1] and T__1.
They are displayed almost the same, and you are usind 2D input and document mode (a good choice only for presentations).

Execute indets(equation_set);   to see the variables. Then correct your equations.

It's a bad idea to use floats in symbolic computations. The discriminant B^2-4*A*C  is very close to 0, but not 0, so the conic will not be recognized as a parabola.
Try G:=convert(G, rational)  to see this.

Hence, use rational coefficients as above; you may use evalf at the end.

Let S1 and S2 be two spheres of radii r1 and r2  and centers O1 and O2. Denote by d the distance between their centers.

If A is in the intersection of S1 and S2, the angle O1AO2 equals 

arccos((r1^2 + r2^2 - d^2)/(2*r1*r2)).      [1]

Of course this makes sense only if S1 and S2 intersects (so, abs(r1-r2) <= d <= r1 + r2).

In your case d=0.  Applying blindly [1] it results a complex number (if r1 <> r2). This is not unexpected, and I don't consider it a bug; however a warning would be nice.

Note that Maple uses some equations instead of [1].
It is strange that for r1=2, r2=3, O1=O2=[-1.-1.-1],   FindAngle gives arccos(31/12) and [1] gives arccos(13/12).
Both are complex, but are not the same. However, when O1=O2=[0,0,0] (which should not matter), FindAngle gives  arccos(13/12) too!

plot(1/x, x=0.1..0.9, tickmarks=[[seq(i/10=i/`10`,i=1..9)], default]);

It is very simple to generate all the algebras (but only for a very small set).
Note that the number of algebras on a set with n elements is combinat:-bell(n)

restart

ALG := proc (X::set, C::(set(set)))
  local A, S, T, ok; A := C union {{}}; ok := false;
  if not `union`(C[]) subset X then error "C must contain subsets of X" fi;
while not ok do
  ok := true;
  for S in A do
    if not X minus S in A then A := A union {X minus S}; ok := false fi;
    for T in A do
      if not S union T in A then A := A union {S union T}; ok := false fi
  od od
od;
A
end proc:

with(combinat):

X:={1,2,3}:

ALGS:={seq}(ALG(X,A), A in (powerset@@2)(X)):

nops(ALGS) = combinat:-bell(nops(X));

5 = 5

(1)

ALGS

{{{}, {1, 2, 3}}, {{}, {1}, {2, 3}, {1, 2, 3}}, {{}, {2}, {1, 3}, {1, 2, 3}}, {{}, {3}, {1, 2}, {1, 2, 3}}, {{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}}

(2)

 

DS:=proc(X::set, C::set(set)) # Dynkin system
local D:=C union {X}, S, T, ok:=false;
if not `union`(C[]) subset X then error "C must contain subsets of X" fi;
while not ok do
  ok:=true;
  for S in D do for T in D do
    if S subset T and not (T minus S) in D then D:= D union {T minus S}; ok:=false fi;
  od od
od;
D
end proc:

DS({1,2,3}, {{1},{2}});nops(%);
     {{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}

                                8

DS({1,2,3,4,5}, {{1,4},{2,4}, {1}}); nops(%);
{{}, {1}, {2}, {4}, {1, 2}, {1, 4}, {2, 4}, {3, 5}, {1, 2, 4},  {1, 3, 5}, {2, 3, 5}, {3, 4, 5}, {1, 2, 3, 5}, {1, 3, 4, 5},  {2, 3, 4, 5}, {1, 2, 3, 4, 5}}

                               16

DS({1,2,3,4,5}, {{2,4,5},{1,4,5}}); nops(%);
     {{}, {1, 3}, {2, 3}, {1, 4, 5}, {2, 4, 5}, {1, 2, 3, 4, 5}}

                               6

restart

Q := 4*x^2 - 4*x*y + y^2 + 10*x - 6*y + 6

4*x^2-4*x*y+y^2+10*x-6*y+6

(1)

with(geometry):

_EnvHorizontalName := 'x': _EnvVerticalName := 'y':

conic(co,Q,[x,y]):

#detail(co);

coordinates(vertex(co));

[-71/50, -6/25]

(2)

coordinates(focus(co));

[-7/5, -1/5]

(3)

Equation( line(axisP, [focus(co), vertex(co)]) );  # axis

13/250+(1/25)*x-(1/50)*y = 0

(4)

draw([co, axisP, focus(co)], color=[red, blue, black])

 

 


Download geometry-parab.mw

You probably want non-collinear vectors.

restart;
P:=(p,q,r) -> [p^2-q^2-r^2 ,2*p*q, 2*p*r]:
n:=13:
pyt:=[seq](seq(seq(P(p,q,r), p=floor(sqrt(q^2+r^2))+1..n), q=1..n),r=1..n):
pyt:=select( u -> evalb(igcd(u[])=1), pyt):
for i to nops(pyt) do for j from i+1 to nops(pyt) do
 A:=pyt[i]; B:=pyt[j];
 N2:=(A[2]*B[3]-A[3]*B[2])^2+(A[1]*B[3]-A[3]*B[1])^2+(A[1]*B[2]-A[2]*B[1])^2;
 if issqr(N2) then lprint(A,B) fi
od od:

[31, 24, 12], [3, 24, 16]
[19, 48, 12], [3, 16, 24]
[19, 48, 12], [3, 96, 80]
[27, 96, 16], [13, 144, 36]
[63, 120, 20], [115, 120, 48]
[63, 120, 20], [7, 24, 60]
[107, 144, 24], [3, 16, 24]
[31, 12, 24], [3, 16, 24]
[3, 24, 16], [19, 12, 48]
[3, 24, 16], [107, 24, 144]
[131, 72, 48], [7, 24, 60]
[61, 72, 36], [83, 120, 144]
[7, 60, 24], [9, 84, 28]
[7, 60, 24], [131, 48, 72]
[7, 60, 24], [103, 96, 120]
[7, 60, 24], [63, 20, 120]
[47, 140, 40], [5, 260, 208]
[13, 144, 36], [3, 80, 96]
[11, 48, 36], [39, 64, 48]
[11, 48, 36], [119, 96, 72]
[11, 48, 36], [21, 176, 132]
[11, 48, 36], [69, 208, 156]
[39, 64, 48], [119, 96, 72]
[39, 64, 48], [21, 176, 132]
[39, 64, 48], [69, 208, 156]
[119, 96, 72], [21, 176, 132]
[119, 96, 72], [69, 208, 156]
[27, 160, 60], [3, 96, 80]
[19, 12, 48], [3, 80, 96]
[61, 36, 72], [83, 144, 120]
[11, 36, 48], [39, 48, 64]
[11, 36, 48], [119, 72, 96]
[11, 36, 48], [21, 132, 176]
[11, 36, 48], [69, 156, 208]
[39, 48, 64], [119, 72, 96]
[39, 48, 64], [21, 132, 176]
[39, 48, 64], [69, 156, 208]
[119, 72, 96], [21, 132, 176]
[119, 72, 96], [69, 156, 208]
[49, 72, 72], [83, 144, 120]
[49, 72, 72], [83, 120, 144]
[103, 120, 96], [7, 24, 60]
[103, 120, 96], [3, 80, 96]
[69, 132, 88], [33, 260, 156]
[7, 24, 60], [9, 28, 84]
[115, 48, 120], [63, 20, 120]
[103, 96, 120], [3, 96, 80]
[3, 96, 80], [13, 36, 144]
[27, 16, 96], [13, 36, 144]
[69, 88, 132], [33, 156, 260]
[3, 80, 96], [27, 60, 160]
[21, 176, 132], [69, 208, 156]
[47, 40, 140], [5, 208, 260]
[21, 132, 176], [69, 156, 208]
 

First 9 10 11 12 13 14 15 Last Page 11 of 111