Carl Love

Carl Love

28055 Reputation

25 Badges

12 years, 358 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

The Algebraic package is simply not designed to work with floats. If you want to use floats, then either preprocess your expressions with convert(..., rational), or use package SNAP.

I think that nextprime is easier to use for this purpose than ithprime.

Here's a program. In order to not do your homework for you, I left two blanks (represented by ...) for you to fill in.

FirstCompositeRun:= proc(n::posint)
(* Returns the smallest positive integer that starts a
     sequence of n consecutive composites. *)
local p1:= 2, p2:= ...;
     while p2 - p1 <= n do
          ...;
          p2:= nextprime(p2)
     end do;
     p1+1 #Return value
end proc:

Its use:

FirstCompositeRun(100);

     370262

A proper Maple program should almost never use print to return its value because

  • it makes it nearly impossible to communicate the result with other programs,
  • it forces the end user to see results that they don't necessarily want to see,
  • it's the hallmark of a rank beginner who's learned bad habits from using other languages.

 

A good place to start is ?Student,Calculus1,VolumeOfRevolutionTutor.

assume(n, positive);
E:= 3^(-(1/2)*n)*2^((1/6)*n)-2^((2/3)*n)*6^(-(1/2)*n):
combine(simplify(convert(E, exp), radical));

     0

The procedure isqrt (integer square root) is built-in and extremely fast. So here's a procedure that uses it:

NextSquare:= proc(zahl::integer)
local IS:= isqrt(zahl), IS2:= IS^2;
     `if`(IS2 > zahl, IS2, IS2+2*IS+1)
end proc:

NextSquare(1234567);

     1236544

 

The following procedure will take any procedure defining a function on a given real interval and return a procedure which extends the definition of that function periodically over the whole real line.

Periodic:= proc(f::appliable, ab::range(realcons))
local a, b, F, P, S;
     (a,b):= op(evalf(ab));
     subs(
          [F= eval(f), P= b-a, S= (a+b)/2],
          x-> `if`(x::realcons, F(frem(x-S,P)+S), 'procname'(args))
     )
end proc:

Example of use:

F:= Periodic(x-> piecewise(x <= 1, x^2, (2-x)^2), 0..2):
plot(F, -5..5);

A drawback of my procedure is that the procedure that it produces is not amenable to symbolic analysis; it's only good for numerics such as plotfsolveevalf(Int(...)). If you need the resulting periodic function to be amenable to symbolic analysis, let me know.

What you have is properly called a set, not a list. Nonetheless, the exact same command will work for both sets and lists. That command is

remove(hastype, S, {specfunc(anything, RootOf), And(complexcons, Not(realcons))});

where has been assigned your set above.

In Maple 2015, the anything (and its following comma) can be omitted.

RealDomain is a very fussy package intended primarily for pedagogical use in precalculus mathematics. (Somehow, I think that you're beyond that level :-).) Don't use it unless you know that it'll work for your purpose, and there's nothing else that'll work instead. In this case RealDomain is hindering the simplification. All that you need is

restart;
f:= u/sqrt(u*(u-1));

simplify(f) assuming u > 1;

My guess is that 90% of the time that people use RealDomain and subsequently ask a Question here, its usage was inappropriate. In particular note the following line from the help page ?RealDomain:

The RealDomain package is not compatible with the use of the assume facility.

 

plots:-display([
     plots:-spacecurve(
          [2*cos(t), sin(t), t], t= -6*Pi..6*Pi, thickness= 3, style= line, numpoints= 200
     ),

     plots:-spacecurve([-2*t, 1, Pi/2+t], t= -5..5, color= black, style= line)
     ], axes= frame
);

Note carefully that Pi is spelled Pi, not pi.

I don't know what you were attempting with inttrans and NumericEventHandler, but they're irrelevant to this Question.

Expressions with Heaviside may be converted to abs form, and vice versa. Apparently, int can handle the abs form better.

simplify(convert(int(f(t-q)*g(q), q= -2..10), compose, abs, Heaviside));

     Heaviside(t-1)*t^2-Heaviside(t-4)*t^2-6*t*Heaviside(t-10)-2*Heaviside(t-1)*t+8*Heaviside(t-            
     4)*t+60*Heaviside(t-10)+Heaviside(t-1)-16*Heaviside(t-4)

 Note that this solution is valid for t > 10.

Stating the relationship as a formal analogy, seq is to $ as add is to sum.

Please see this post that I just made: Use Eigenvalues, not fsolve@Determinant. By using Eigenvalues, the computation can be done accurately without increasing Digits.

Your problem is that the coefficients of your characteristic polynomial are already corrupted by round-off error when the determinant is computed. Please see this post that I just made: Use Eigenvalues, not fsolve@Determinant.

I strongly suspect that you are trying to compute eigenvalues of a matrix. Use the command LinearAlgebra:-Eigenvalues for that. Trying to do it by computing the roots of a polynomial derived from a floating-point matrix is highly suspect unless you use a very large value of Digits. Please see this post that I just made: Use Eigenvalues, not fsolve@Determinant.

Please see this post that I just made: Use Eigenvalues, not fsolve@Determinant. The problem with your example is that the coefficients of the polynomial are already corrupted by round-off error.

First 236 237 238 239 240 241 242 Last Page 238 of 395