Carl Love

Carl Love

28035 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Ritti Just ask Maple again:

is(abs(cosh(x)) <= exp(x^2/2)) assuming x::real;
      true

@zhuxian This is also easy with basic Maple commands. Suppose that is the expression that contains the constants and _C7 is the only one that shouldn't be set to 0. Then do

eval(S, (indets(S, suffixed(_C)) minus {_C7})=~ 0);

When you enter a Question, isn't there a box labelled Tags immediately below the box where you enter the text of the Question?

I reposted your actual math/Maple question as an official Question.

I used my moderator privileges to turn your question into an official Question (which a moderator can do even without tags). Do you see a box +Add Tags  under the word Posted on the left side of the header, to the lower right of your avatar? Try clicking on that.

@Rohith The new example can be handled with a relatively small change to the filter:

value(
   indets(
      InertForm:-Parse("a+(c/d)*log(1+b)+sin(a-b)+a^c"), #string!
      #selects operators with exactly two operands, both of which are names,
      #negated names, integers, or floats:
      And(specfunc({name, (-1) &* name, numeric}, {`%+`, `%*`, `%/`, `%^`}), 2 &under nops) 
   )                                            
);

So, the only changes that I made were adding (-1) &* name to the allowed operands and `%^` to the allowed operators. So, the items selected by this new filter are necessarily a superset of those selected by the previous one since both the operand set and the operator set have been enlarged.

Regarding your terminology: You should say that you're extracting "operators acting on exactly two atomic operands". What you mean will then be much clearer (even though this doesn't conform precisely with the technical definition of atomic used by Maple), because operand alone can apply to subexpressions of any complexity. For example, in a + b/c the `+` has exactly two operands: a and b/c.

@Preben Alsholm If an operator is restricted to having exactly two operands, then sometimes lhs and rhs are used to refer to those operands, even when the operator is not =, <<=<>. This is the sense by which the OP is using the terms "lhs" and "rhs"

@waseem Do not repeat the same inane question over and over again. It makes me very angry. Are you less than 10 years old? Next time, I'll just delete it. Be patient: It's not like I get paid to answer questions on MaplePrimes. It is just my hobby. As you can see, I've been working on the problem, but I got stuck. That's in addition to the numerous other MaplePrimes problems that I'm working on.

I'd suggest that if you're asking for help from someone whom you're not paying, that you limit any prodding to at most once per week, and that you learn to do it in a polite respectful way.

 

I am trying to solve the system with Maple's built-in numeric BVP solver (which is using a nonlinear FEM with dynamic mesh size anyway). The system solves very easily, but the values that I am getting do not agree with the paper at all, not even to one significant digit! I feel that I must have entered something wrong, like a minus sign perhaps. But I have gone over what I typed "with a fine-tooth comb" at least 10 times, comparing my worksheet with the paper character by character, using the 3 places in the paper where the ODEs are given and the two where the BCs are given.

So, I'd like some assistance to find the mistake. Or, at least I'd like someone to tell me that I've entered the system and parameter values exactly as they're given in the paper.
 

restart:

Digits:= 15:

ODEs:= [
   #Eq 9/18/24:
   (1+K)*diff(f(eta),eta$3) + f(eta)*diff(f(eta),eta$2) - 2*n/(n+1)*diff(f(eta),eta)^2 -
   2/(n+1)*M*diff(f(eta),eta) + K*diff(g(eta),eta) + 2/(n+1)*sigma*theta(eta)  =  0,
   #Eq 10/19/25:
   (1+K/2)*diff(g(eta),eta$2) + f(eta)*diff(g(eta),eta) -
   (3*n-1)/(n+1)*diff(f(eta),eta)*g(eta) - 2/(n+1)*K*(2*g(eta)+diff(f(eta),eta$2))  =  0,
   #Eq 11/20/26:
   diff(theta(eta),eta$2) + Pr*f(eta)*diff(theta(eta),eta)  =  0
]:   

<ODEs[]>;

Vector(3, {(1) = (1+K)*(diff(diff(diff(f(eta), eta), eta), eta))+f(eta)*(diff(diff(f(eta), eta), eta))-2*n*(diff(f(eta), eta))^2/(n+1)-2*M*(diff(f(eta), eta))/(n+1)+K*(diff(g(eta), eta))+2*sigma*theta(eta)/(n+1) = 0, (2) = (1+(1/2)*K)*(diff(diff(g(eta), eta), eta))+f(eta)*(diff(g(eta), eta))-(3*n-1)*(diff(f(eta), eta))*g(eta)/(n+1)-2*K*(2*g(eta)+diff(diff(f(eta), eta), eta))/(n+1) = 0, (3) = diff(diff(theta(eta), eta), eta)+Pr*f(eta)*(diff(theta(eta), eta)) = 0})

BCs:= [
   #Eq 12/21:
   f(0) = -lambda, D(f)(0) = -1, g(0) = -1/2*(D@@2)(f)(0), D(theta)(0) = -c*(1-theta(0)),
   #Eq 13/22:
   D(f)(%infinity) = 0, g(%infinity) = 0, theta(%infinity) = 0
   #I changed infinity to %infinity to make it a parameter.
];

[f(0) = -lambda, (D(f))(0) = -1, g(0) = -(1/2)*((D@@2)(f))(0), (D(theta))(0) = -c*(1-theta(0)), (D(f))(%infinity) = 0, g(%infinity) = 0, theta(%infinity) = 0]

Solve:= subs(
   _BVP= {ODEs[],  BCs[]},
   proc(
      #The values presented here are simply defaults. They can be changed when the
      #procedure is called.
      {K::realcons:= 0, Pr::realcons:= 0.733, sigma::realcons:= 0, lambda::realcons:= 3,
       c::realcons:= 1, M::realcons:= 1, n::realcons:= 1, %infinity::positive:= 8
      }
   )
      dsolve(_BVP, numeric, _rest)      
   end proc
):
   

Try to duplicate Table 2,  second column:

Table2:= Solve(K= 0, Pr= 0.733, sigma= 0, lambda= 3, c= 1, M= 1, n= 1):

seq(eval(diff(f(eta),eta), Table2(Eta)), Eta= 0..8);

HFloat(-0.9999999999999999), HFloat(-1.0), HFloat(-1.0000000000000004), HFloat(-1.0000000000000002), HFloat(-0.9999999999999994), HFloat(-0.9999999999991915), HFloat(-0.9999999968802413), HFloat(-0.9999664933149132), HFloat(0.0)

Totally wrong!

 

Use known exact solution (Eq 32) for this special case to try to duplicate Table 2, first column:

#Eq 32:
F:= eval[recurse](lambda - (1-exp(-eta*z))/z, [z= (lambda+sqrt(lambda^2+4*M-4))/2, lambda= 3, M= 1]);

3-(1-exp(-eta*(3/2+(1/2)*9^(1/2))))/(3/2+(1/2)*9^(1/2))

evalf(map2(eval,  diff(F,eta), eta=~ [$0..8]));

[-1.00000000000000, -0.497870683678640e-1, -0.247875217666636e-2, -0.123409804086680e-3, -0.614421235332820e-5, -0.305902320501826e-6, -0.152299797447126e-7, -0.758256042791190e-9, -0.377513454427910e-10]

It agrees with the table!

 

Try Table 3, column 1:

seq(eval(diff(f(eta),eta$2), Solve(K=1, Pr=0.733, sigma=5, c= 1, M= 3, n= 0.5, lambda= L)(0)), L= 2.0..4.0, 0.5);

HFloat(2.6198066501250747), HFloat(2.4131979709211966), HFloat(2.216852164633253), HFloat(2.040203526244527), HFloat(1.8844737238149782)

 

Totally wrong. It's even moving in the wrong direction!


 

Download nanofluidBVP.mw

 

I have no attachment to the name Type. Indeed, I don't like that it's capitalized, but type was already taken (it being itself a type as well as a built-in procedure). I struggled to come up with a good name. I considered `` (the empty symbol).

Aha, how about eval?

@vv You begin your Answer with a discussion of whether it is interesting. To me, it is interesting if there's any hope of generalization and automation. The domain of generalization would be systems of linear equations that include floorceil, and frac. So, do you see any hope for it? I'm not asking you to write the algorithm, just whether you've gotten a sense that it's possible.

@ It's okay: Now that you have given your reasons, it does seem that you have excercised "due diligence" (appropriate to your education level) before concluding that Maple was wrong. And, yes, it was clear to me that you did not intend that to be a strict mathematical proof. And I wasn't criticizing it! I did say that it "does provide some evidence...", not that it doesn't provide evidence.

It turns out that all three expressions are valid solution branches. (I'll try to define that in another post.) And the pair given by Maple is a complete solution set[1] (meaning that given any numeric (real or complex) value of k, the set's evaluation at that value will be the set of all values of x that satisfy the equation for that k). Nonetheless, given any pair of these three expressions, there are some values of k for which the two aren't equal. (The branches are cut in different places.) That is what is is tellling you. 

So, now I am concerned about your instructor: Why do they say that the solution is wrong? Someone who claims that a parameterized solution (k is the parameter in this case) is wrong should be able to provide a witness, that is, a specific numeric value of k for which the solution is wrong. Please ask them why they think it's wrong, saying that I asked you to ask. I'm willing to consider any argument, even "the format that Maple displays the result is ugly."

[1]As long as we do the sensible thing about the k=0 divide-by-zero case, that is, return the empty set. And Maple will do this part also if you include the parametric option to solve.

What makes you say that the solutions given by Maple are wrong? As a math educator, I am just curious about your reasoning on that.

What you have labeled "Proof" does give some evidence that your proposed solution is a correct solution. But you don't show any evidence that Maple's proposed solutions are not also correct. You may substitute them into the original equation just as you did with your proposed solution. Try it.

It is true that Maple often arranges expressions in ways that are distasteful to a human reader. This seems especially common with combinations of square roots and minus signs. That alone doesn't make them wrong.

Thank you for the very useful procedure. Vote up. However, it can be massively simplified to

# Type for a variable expression, e.g. x=5.
TypeTools:-AddType('varexpr', 'And'('name','Non'('constant'))='algebraic'):

# Type for a function expression, e.g. f(x)=x^2.
TypeTools:-AddType('funcexpr', 'function'('And'('name','Non'('constant')))='algebraic'):

# Identity type (not 'identical'). Ought to be built-in!
# It saves a lot of redundancy in procedure headers!
TypeTools:-AddType('Type', type): 

# Procedure to assign variable and function expressions.
my_assign:= proc(u::{Type,list,rtable,set}({varexpr, funcexpr}), $)
   if u::'indexable' then thisproc~(u); return
   else assign(`if`(u::'varexpr', u, op(0,lhs(u))= unapply((rhs,op@lhs)(u))))
   fi
end proc: 

I believe that this is functionally equivalent to yours[1]. Certainly, all the examples run identically. One problem I see with the lengthy code is that it makes it seem as if Maple coding is more difficult than it actually is.

Please let me know if you have any questions about how such simplification is achieved, or why any of the numerous parts that I removed were redundant.

[1]Except that yours didn't allow mixed containers (containers of both varexpr and funcexpr) whereas mine does, because I thought that that was just an oversight on your part. Not sure. 

@Carl Love I just realized that it was incorrect of me to attribute the original algorithm to Kitonum. After rereading the whole thread, I see that Kitonum actually was just making a correction to the OP's code. So, I apologize for that.

@Carl Love 

This boggles me: If I just declare a to be a constant via the official, documented method for declaring constants (see ?constant),

constants:= constants, a;

then, as far as int is concerned, how is a any different from any other official constant, say, gamma? Yet

int(exp(a*exp(I*x)), x= -Pi..Pi) still returns 0, while
int(exp(gamma*exp(I*x)), x= -Pi..Pi) returns 2*Pi.

Somewhere there is knowledge stored about gamma. For example, Maple knows (at the symbolic level?) that it's positive:

signum(gamma) returns 1, whereas signum(a) returns unevaluated. So, where is that knowledge stored?

First 308 309 310 311 312 313 314 Last Page 310 of 708