Carl Love

Carl Love

28025 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

{k = 1, n=1} satisfy your stated conditions. Other than that, I checked for n up to 54177 and found no other solution.

Like this:

convert(evalc(Im(D1C1)), exp)

I think that if you just view the indices by doing seq(nops(L)-i, i= 1..nops(L)), then you'll understand the reason that your second version doesn't work. If not, let me know, and I'll explain further.

By the way, you're finding the reverse of the list, not the inverse. The inverse is something else.

There's currently no predefined way to do that with the legend option. However, it wouldn't be difficult to simply overlay your plot with a legend (exactly as you show above) constructed with the plot and textplot commands. The overlaying is done with the display command. This requires knowing the approximate x and y coordinates of the placement of the legend, preferably the upper left and lower left corners. If you have foreknowledge of the full extent of the x and y axes, this is easy. If you don't have foreknowledge, it's possible to determine the axis extents of an existing plot programmatically.

Yes, it can be done with if ... then. The key is that all the code must be in a single execution group (in other words, a single command prompt). While typing code, to get a new line within the same execution group, use Shift-Enter instead of Enter (or carriage return). Example:

#There's no limit to the complexity of conditions that can be made with
#logical connectives such as `or`, `and`, etc.

if x > 0 then 
   y:= sin(x); #code line 1 to skip
   z:= cos(x)  #code line 2 to skip
   #... more code lines
fi; #or use "end if"

#Or, there can be alternative branches:

if x < 0 and a > 0 then
   y:= sin(x);
   z:= cos(x)
else
   y:= cos(x);
   z:= sin(x)
fi;

#If statements can be nested arbitrarily, and 
#"if ... then ... else if ... then ... fi fi" can 
#be contracted to "if ... then ... elif ... then ... fi".

The above are simplistic examples to get you started. There's actually easier ways to do each.

Here's a procedure that does it:

CheckProperty:= proc(n::And(odd, posint, Not(1), Not(prime)))
local nm1:= n-1;
   ormap(p-> irem(nm1, p[1]-1)=0, ifactors(n)[2])
end proc: 

Both numtheory:-factorset and NumberTheory:-PrimeFactors will do essentially the same job as ifactors here, but they do it by calling ifactors, which could be problematic for some very large  n (say n > 2^200).

The part that you want to extract is op([2,1], sol).

How about

plots:-textplot([0,0,typeset(Sigma)], font= [Times, 300], axes= none);

All that you need is

plot([seq([[k,0], [k, 3*k+2]], k= 1..6)]);

Making a plot rotate is quite simple. Like this (this code picks up immediately where your worksheet left off):

P:= %: #Save the static plot
Frames:= 20:
plots:-animate(
   plottools:-rotate, [P, theta], 
   theta= 0..2*Pi/5*(1-1/Frames), frames= Frames, paraminfo= false
);

The rotation doesn't need to be around the origin. It'd be trivial to rotate around any point.

The integrals have as their third argument the option AllSolutions, which latex can't handle. And what would you have it print for those anyway? So, you can workaround by doing

latex(subs(AllSolutions= (), sol))

The int in `latex/int` refers to the int and Int functions, not to "internal".

The following procedure computes the sequence. However, I don't get the values that you propose. For example, how do you get 2, not 4, as the second entry?

A:= proc(n::posint)
option remember;
local A0; #A(n-1)
   if n=1 then return 1 fi;
   A0:= thisproc(n-1);
   `if`(A0::even, `if`((A0+1)::prime, A0+1, n+2), A0+3)
end proc
:
seq(A(n), n= 1..20);
1, 4, 5, 8, 10, 11, 14, 16, 17, 20, 22, 23, 26, 28, 29, 32, 34, 36, 37, 40

 

The name Zeta is already defined in Maple (for the Riemann-Hurwitz zeta function), so it's dangerous to use it as a variable. You should replace it with zeta, which'll prettyprint identically to Zeta as the lowercase.

Once you make that change, then all you need to do is

evalc(%)

The evalc automatically assumes that all variables are real, thus avoiding some of the complexity of the other Answers. But it won't assume that Zeta is real because that's already defined and is thus not a free variable.
 

If you'd prefer to continue using Zeta, you could do

local Zeta;

and it'll now be a totally free variable. If perchance you'd still like to use the Riemann-Hurwitz zeta function, you can call it with :-Zeta(...), and now the names Zeta and :-Zeta will not have any link to one another.

 

You can use lhs and rhs to operate on specific sides of equations. You can use rcurry to pass trailing arguments to operators. So, what you ask for can been done as

(lhs = rcurry(int, T[1])@rhs)(%)

I can't say whether it's "the right thing to do."

It wasn't removed. It was branched into a separate Question (entitled "Algorithms") for which your Comment became an Answer. The branching wasn't done by me, although I do agree with the editorial decision to do so. I converted the branch from a Post to a Question, converted your Comment to an Answer, and voted it up. Any Moderator can do these things; it wasn't VV.

First 141 142 143 144 145 146 147 Last Page 143 of 395