Carl Love

Carl Love

28090 Reputation

25 Badges

13 years, 99 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

How is a table (using your terminology, not Maple's table) different from a Matrix? Note that a Maple Matrix can have any type of generic data as its entries.

MyTable:= Matrix((10,2), fill= 0);

I just included the fill= 0 to be analogous to the Mathematica; it's actually the default. If you want to get fancy, you can also include the embedded assignments to n and m:

`&=`:= proc(n::evaln, v) assign(n,v); v end proc:   
MyTable:= Matrix((n &= 10, m &= 2), fill= 0);

(I wonder why Maple's assign doesn't already return the value. That would be so useful, and would make it more compatible with other languages.)

[I began posting this before Markiyan's Reply appeared. Sorry for any duplication.]

The radius of the sphere is 6, so your plot is completely inside the sphere. To see the sphere, you need to make the r range larger. You also need to switch theta and phi: In Maple's spherical coordinates the second coordinate is the longitude, and the third coordinate is the latitude.

plots:-implicitplot3d(
   (r*sin(theta)*cos(phi))^2+(r*sin(theta)*sin(phi))^2+(r*cos(theta))^2=36,
   r=-7..7, theta=0..2*Pi, phi=0..Pi, coords= spherical
);

I know it's a hack, but you can plot the components separately. This is similar to Kitonum's, but uses a single plot command and avoids piecewise.

F:= x-> 
   if not x::realcons then 'procname'(args) 
   elif abs(x) < 2 then x
   else undefined
   end if
:
plot(
   [F~([seq](x-n, n= -8..8, 4))[], [seq]([[n-2,-2],[n+2,2]][], n= -8..8, 4)],  
   x= -10..10, scaling= constrained, color= blue, style= [line$5, point], 
   symbol= circle, symbolsize= 16
);

Since you've been here on MaplePrimes many times before and the solution to this system is straightforward (no singularities, convergence issues, etc.), I wonder what difficulty you encountered.

restart:
Eq1:= 
   diff(F(eta),eta$4) - 
   M*(eta*diff(F(eta),eta$3) + 3*diff(F(eta),eta$2) + 
      diff(F(eta),eta)*diff(F(eta),eta$2) - F(eta)*diff(F(eta),eta$3)
   ) - 
   Ha^2*diff(F(eta),eta$2)
:
Eq2:= 
   diff(G(eta),eta$2) + 
   Pr*M*(F(eta)*diff(G(eta),eta) - eta*diff(G(eta),eta)) +
   Pr*Ec*diff(F(eta),eta$2)^2 + Nb*diff(H(eta),eta) + 
   diff(G(eta),eta) + Nt*diff(G(eta),eta)^2
:
Eq3:= 
   diff(H(eta),eta$2) + M*Sc*(F(eta)*diff(H(eta),eta) - eta*diff(H(eta),eta)) +
   Nt*diff(F(eta), eta, eta)/Nb
: 
IC1:= F(0) = 0, (D@@2)(F)(0) = 0, D(G)(0) = 0, D(H)(0) = 0:
IC2:= F(1) = 1, D(F)(1) = 0, G(1) = 1, H(1) = 1:
 
params:= {Ec = .1, Nt = .1, Nb = .1, Sc = .5, Pr = 10, M = .5}:
HA:= [0, 2, 4, 6, 8]:

for k to nops(HA) do
   P||k:= plots:-odeplot( 
      dsolve(eval({Eq||(1..3), IC||(1..2)}, params union {Ha= HA[k]}), numeric),
      [[eta, F(eta)], [eta, G(eta)], [eta, H(eta)]],
      linestyle= [1,2,3],
      color= [red, blue, green, black, purple][k]
   )
end do:
plots:-display(P||(1..nops(HA)));

There's a simple trick that let's you exploit the internal representation of an Array to get what you want:

[rtable_elems(DataName)[]];

How about

plots:-polarplot([[r, 0, r= 0..1], [r, Pi/6, r= 0..1]], color= magenta, thickness= 6);

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.
First 206 207 208 209 210 211 212 Last Page 208 of 395