Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

How about

plot([seq(-arctan(2*m*x)/(1-x^2), m= 1..10)], x= 0..10, discont);

It is always dangerous and unreliable to expect terms or factors to appear in a certain order. Isn't the result that you want the same as would would get from simply simplify(dairihensu1)?

To list the first 10 prime Leyland numbers, use

select(isprime, {seq(seq(a^b+b^a, a= 2..99), b= 2..99)})[1..10];

Some guess work was required to come up with the 99; it's much larger than is needed, but Maple's integer arithmetic and primality testing are so fast that it doesn't matter. Note that putting integers into a set automatically sorts them.

Here's a one-line solution:

cnt:= Statistics:-Tally(op~([g[]]), output= table);

This produces table output, like Joe's.

Consider creating a Matrix with an initializer function, like this:

v:= Matrix((5,9), (i,j)-> F(V__dot[i], DD[j]));

where F represents any operation that you want. In your case, I think that you want

v:= Matrix((5,9), (i,j)-> V__dot[i]/(Pi/4)/DD[j]^2);

While entering the command, you should use Shift-Enter to get to the next line. Only use Enter when the command is complete. Thus, in the code portions of most worksheets, Shift-Enter would be more commonly used than Enter.

Download DirectSearch from the Maple Applications Center. I gave a more-complete Answer to your simultaneous Question on StackOverflow.

I'm on my mobile right now. I'll give your problem a more-thorough look when I get to a real computer. 

Use the solve command. See ?solve. If the equation is too complicated to solve symbolically, you can still get a numeric solution with fsolve if the equation has no symbolic parameters. 

A slightly ugly solution is to use $ in prefix form:

Array(`$`(1..3, n));

But, then again, everything is ugly in 2-D input, so maybe it doesn't matter. You should use 1-D input. To change your default format to 1-D input: Using the menus, do

  • Tools => Options => Display => Input display => Maple Notation
  • Interface => Default format for new worksheets => Worksheet
  • Apply Globally.

Good Question; Vote Up.

I don't have a great amount of experience with the Units package, but my experience so far has been that trying to assign units to symbolic entities (such as your t and x(t)) is clunky at best and ultimately frustrating and perhaps not worth the effort. That being said, here's what I managed to come up with for your situation:

restart:
with(Units:-Standard):
x:= t-> 'procname'(t)*Unit('m'):
t:= ()-> 'procname'*Unit('s'):
#Note that diff is overloaded/replaced by the with(Units:-Standard).
diff(x(t),t());

This produces precisely the result that you requested, but note that the second argument to diff is t() rather than t.

The first proc procedure in your code is not assigned to anything. It needs to be assigned to p, as in p:= proc(....

Fixing this error will get you the first three plots. Another error occurs after that, and I haven't figured that one out yet.

Good Question; Vote up.

Here's a simple recursive conversion of tables to sets followed by Maple's normal equality check (which works well for sets but not for tables). The conversion to sets is different from that performed by convert(..., set) because it includes the indices.

TableToSet:= T-> `if`(T::table, {op(2, thisproc~(T))[]}, T):
TablesEqual:= (A::table, B::table)-> 
   evalb(TableToSet(A) = TableToSet(B))
:

 

The following performs your test for any number of variables. The variables are passed in a list as the second argument.

MyTest:= (
   F::list(algebraic), 
   V::depends(And(list(name), satisfies(V-> nops(V)=nops(F))))
)->
   andmap(
      k-> ormap(depends, [F[..k-1][], F[k+1..][]], V[k]),  
      {$1..nops(V)}
   )
:

(The code has been simplified by Boolean algebra since its original posting.)

I strongly recommend that you stop referring to the objects that you're working with as "monomials". By doing so, you cause confusion for all mathematically educated people reading these posts, and you end up making yourself sound foolish. It causes confusion because monomial is a precisely defined mathematical term, and your objects don't fit the definition.


restart:

MyTypes:= {algebraic, ''[algebraic $ _], 'Vector(_, algebraic)''' $ _= 2..3}:
TypeTools:-AddType(MyType, MyTypes):

MyProc:= proc(
     A::depends(
          And(
               MyType, 
               satisfies(A-> andmap(T-> A::T implies B::T and C::T, MyTypes))
          )
     ),
     B, C   
)
     if A::algebraic then
          #option 1
     elif A::[algebraic $ 2] then
          #option 2
     elif A::[algebraic $ 3] then
          #option 3
     elif A::'Vector(2, algebraic)' then
          #option 4
     else #A::'Vector(3, algebraic)'
          #option 5
     end if
end proc:

Here's a method that's much simpler than the module method that I already posted as an Answer. This method puts all of the illegal-input checking into the procedure header (what's also called the "argument processing").

If you do want to put this procdure into a module, then you'll need to be careful how you handle the user-defined type. It needs to be global, and thus handled in a similar fashion to the user-defined types in the module that I already posted (which avoids clobbering any previously defined global of the same name).

 

You've run up against yet another syntax difference between the 2-D input format and the 1-D input format. In 1-D input (which Tom Leslie is using), the range operator can be either two or three dots: A..B means the same thing as A...B, regardless of whether A and/or B are symbols or numbers. But in 2-D input (which you are using), if B is an integer, then the third dot is interpreted as a decimal point, so 10...50 becomes 10 .. 0.50. Since the final value is less than the starting value, seq correctly returns the null sequence, which appears to you as if Maple "doesn't do anything."

My primary advice is to just use 1-D input (aka Maple Input). The 2-D input has many subtle and annoying nuances like this. If you want to continue using 2-D input, then always use two dots rather than three for the range operator.

First 206 207 208 209 210 211 212 Last Page 208 of 395