11691 Reputation

19 Badges

7 years, 125 days

MaplePrimes Activity

These are answers submitted by vv

Adding to what user acer said:

Gcd in Algebraic has a distinct syntax; it is not inert any more.
If you want the result mod 3 then use

 Gcd(f, g, characteristic=3);

Note that without characteristic=3, the gcd is computed in the ring Z[x]; if mod 3 is included (as you did), the mod 3 is applied to this polynomial.

It depends on what the procedure actually does.E.g., p could be a local variable.

local p;
answer = p[i]
eq1 := f(1);

                      eq1 := answer = p[1]
rhs(eq1): is(%=p[1]);

If you comment out the local declaration, ==> true.

Any procedure P can be called "indexed" P[abc](arguments), instead of the usual P(arguments)
In the body of the procedure, the index can be retrieved and used as an extra argument, or can be simply ignored. Most library procedures ignore the index (mainly if it is not expected).
See a simple standard example with  showstat(log);


sin[xxx](Pi/2); # ignored

max[abc](22,33,11); # not ignored, for obvious reasons
Error, invalid input: unrecognized max/min[option] abc

It would be convenient to have always warnings when calling an indexed procedure which ignores the index, but it would be inefficient; anyway, this "feature" is as old as Maple I think.

Some commands have option remember, so these are not re-executed next time.

@Johan159 You should be aware that W(x) is not a regular variable, and it is not a good idea to use it this way.

An assignment W(x) := a produces a procedure W and creates/extends its remember table. When W(x) is accessed, it is not evaluated, that's why in your case _C1 was displayed; if you want evaluation, it must be accessed via eval(W(x)). So, don't use it, unless you know these details.


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)


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



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

.1904761905 = .1904761905




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 



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.

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!

4 5 6 7 8 9 10 Last Page 6 of 107