Carl Love

Carl Love

18378 Reputation

24 Badges

7 years, 301 days
Mt Laurel, New Jersey, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@Test007 I didn't "come up with" any of the constants. The symbolic work is all done by dsolveevalc, and limit.

The same process could be applied to the constant-coefficient ODE that you propose. Below, I treat the monic case, which covers all the cases with a second derivative:
 

ode:= diff(y(x),x,x)+B*diff(y(x),x)+C*y(x):

Sol:= dsolve({ode, y(0)=a, D(y)(0)=b});

y(x) = (1/2)*(B*a+(B^2-4*C)^(1/2)*a+2*b)*exp((-(1/2)*B+(1/2)*(B^2-4*C)^(1/2))*x)/(B^2-4*C)^(1/2)-(1/2)*(B*a-(B^2-4*C)^(1/2)*a+2*b)*exp((-(1/2)*B-(1/2)*(B^2-4*C)^(1/2))*x)/(B^2-4*C)^(1/2)

evalc(rhs(Sol)) assuming B^2 - 4*C < 0;

a*exp(-(1/2)*x*B)*cos((1/2)*(-B^2+4*C)^(1/2)*x)+(B*a+2*b)*exp(-(1/2)*x*B)*sin((1/2)*(-B^2+4*C)^(1/2)*x)/(-B^2+4*C)^(1/2)

limit(rhs(Sol), B= 2*sqrt(C));

(x*C^(1/2)*a+x*b+a)/exp(C^(1/2)*x)

 


 

Download ConstCoeffODE.mw

@Test007 I suppose that the feeling is that that situation can always be handled with eval

@tomleslie A procedure's behavior should not rely on the user having issued a certain with command at the top level, simply because the user may not have.

@nm Simpler:

add(ArrayTools:-Diagonal(A)^~2);

@Scot Gould As you proposed in an earlier version of the above Reply, the potential problem of using global t can be corrected with quotes:

drdt:= t1-> eval(diff(r('t'),'t'), 't'= t1):

Without the quotes, the following would give an error message, even if the assignment to t were totally unrelated to its use with r (such is always the risk with global variables):

t:= 3;
drdt(0);

@Scot Gould There are two problems with your derivative: 

  • The symbolic derivative is recomputed for every invocation of drdt, including all the numeric points of the plot (if plotted in functional form).
  • If global is assigned a non-name value, the derivative won't work. 

@Carl Love Addendum: Using blocks= [u,v] should also work. It gives a different ranking of the derivatives. I think that the fact that it doesn't work should be considered a bug. Here is what the help page ?DifferentialRing says about the different rankings:

  • Together, the lists blocks and derivations provide the ranking of R, that is, an ordering for the derivatives of the dependent variables with respect to the independent variables. In brief, the elements in blocks (dependent variables or sublists of them) are ranked between each other using an elimination ranking and those within a sublist are ranked used an orderly ranking.
    An elimination ranking is one where derivatives of leftmost dependent variables, or of all the dependent variables in a leftmost sublist within blocks, rank higher than derivatives of variables to their right. An orderly ranking is one where derivatives of higher differential order rank higher than derivatives of lower differential order, and if the order is the same, then derivatives of leftmost variables rank higher.

The precise bug that you encountered comes from a construction of the form a^b^c, which is always an error in Maple because it doesn't disambiguate between (a^b)^c and a^(b^c).

@janhardo By symmetry, the case A <> 0 and B=0 is equivalent to A=0 and B <> 0 with the roles of x and switched. So, this case can be handled in your code by ans:= conics(0, A, D, C, E).

@nm Assumptions of equations specifying a value for a variable such as lambda=1 never work.

@emendes Just remove the one line that I specified. I don't think any other changes are needed.

Note that arg1 is not an argument to mainproc.

@janhardo The formula that you've used is sufficient for conics whose axes are parallel to the coordinate axes. For other conics, you need a term with both x and y. Conics include the degenerate cases of intersecting lines and a single point.

@imparter I said to switch them, not to replace Re with seq:

plot([seq(Re(eval(U1,tb=j)),j in[0.8,0.9,1.0])],r=0..1,legend = [tb =0.8, tb=0.9,tb =1.0],  labels = ["z ", "U"], labeldirections = ["horizontal", "vertical"],  linestyle = [solid,dash,dot],color = [black, red,green]);

@vs140580 There are three problems with your Reply:

  • It's fairly far from the original Question.
  • You never said whether the Answer provided a satisfactory solution to your original Question.
  • You didn't apply the Answer to the graphs that you show in the Reply.

@janhardo Tom's op([2,1,2], A) means the same thing as op(2, op(1, op(2, A))). However, it is confusing to use this with an Array such as A because the op numbers depend on the internal structure rather than on features that are usually externally visible to the user.

@Preben Alsholm Another option is map[evalhf](sin, V). I don't know how this differs from evalhf(map(sin, V)).

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