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

@krobe8 You could put


in your initialization file.

@acer A recent upgrade, perhaps 2020, allows %assuming to be used in infix form. There are some examples at ?assuming.

@perr7 So why have you ignored the thickness option?

@perr7 The difference between your originally posted plot and the one immediately above cannot be due to Kitonum's suggestion. There's either a difference in your configuration (possibly the Digits setting) or a difference in your P_QM.

@Anthrazit I don't understand all the details of what's going on, but the following transcript proves that with(Units) does replace (strictly speaking, rebind) the default max with Units:-Simple:-max and that the first sentence of my Answer is not wrong (no offense taken):

Automatically loading the Units[Simple] subpackage

Error, (in showstat) cannot debug built-in functions

Units:-Simple:-max := proc()
    [...procedure code redacted, but you can view it yourself...]
end proc


@Kitonum The thickness option can be used for surfaces drawn with style= line. In this case, I think that it makes a big improvement. This is with thickness= 4:

I suspect that in your first differential equation, the second Q[1] is supposed to be Q[2]. Please confirm.

@Umang Varshney Just as in English writing, semicolons separate (rather than terminate) statements: If the item preceding the semicolon is a statement and the item following is not a statement, then the semicolon is not required, and the situation is syntactically equivalent to placing a NULL statement after it. It follows that a semicolon is allowed but not required immediately before endelseeliffi, od, or catch (except in those rare situations where one needs a null statement to comprise the entirety of procedure's or module's body following some header declarations).

Also as in English prose writing, line breaks don't serve as punctuation marks; they are syntactically equivalent to other white space.

@nguyenhuyenag But only the one after the final end if is required in this case. The others may be used for stylistic preference, but they perform no syntactic function.

@emendes Please show me an example of sols such that these two commands return different non-error values:

  1. ormap(x->x=true,map(has,rhs~(op~(sols)),_Z))
  2. has(sols, _Z)

(Yes, I know that it's possible to contrive such an example by putting _Z on the left side of an equation and no _Zs on the right. The OP won't have such an example in actual practice.)

If you're trying to use SolveTools:-PolynomialSystems with Threads: Given that it's hundreds, perhaps thousands, of lines of deeply nested module code that wasn't written with the intention of being threadsafe, the probability that it's accidentally threadsafe (like index) is infinitesimal. I don't know why CodeTools:-ThreadSafetyCheck gets it wrong.

Your original ormap (item 1. above) can also be replaced by

ormap(has, rhs~(op~(sols)), _Z)

These are 100% functionally equivalent, even for contrived examples. An expression x=true is almost always redundant in newbie code. Nitpickers: Note the emphasis on almost.

@nm Yes, I am well aware of that.

The purpose of my Answer is to give the OP something that does what they actually want. Its purpose is not to explain the cause of the error. To avoid the error, one must delay the evaluation of numbcomb until j's value becomes integer. The best and most natural way to do that is to make it into a procedure.

Now, I may have guessed wrong about what the OP actually wants. They might want a hypergeom symbolic expression. In that case, use binomial, like Acer says.

@ReactionUra Usually, when fsolve returns unevaluated, it means that there's no solution within the specified ranges. However, sometimes it means that it couldn't get the solution to sufficient precision. That's the case here. By reducing the requested precision to 7 digits, I got an all-nonnegative solution:

Digits:= 7:
    {ionic, n_Cl, n_H, n_HCl, n_Na, n_NaOH, n_OH, m, u_Cl, u_H, u_Na, u_OH}=~ 0..infinity    
 { ionic = 48.98702, m = 0.003277555, n_Cl = 0.1750121, 

   n_H = 0.05026130, n_HCl = 0.00001712527, n_Na = 0.09573009, 

   n_NaOH = 0., n_OH = 1.128623 10   , u_Cl = 0.6624931, 

   u_H = 963.1730, u_Na = 137.5875, u_OH = 459.2063 }

@janhardo Okay, I added some exposition to the worksheet. Let me know if you can understand it now. Unfortunately, MaplePrimes won't display it, but you can download it. By the way, the derivatives that I used are not implicit.

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/ .



Use fsolve instead of solve:

res := {ionic = -2.247127086, m = 0., n_Cl = -3.680938534, n_H = -0.2101029014, n_HCl = -7.502816177*10^7, n_Na = 4.769998672, n_NaOH = -4.769878672, n_OH = 8.240834305, u_Cl = -4.874160233, u_H = 3.688110962, u_Na = -2.974047722, u_OH = -4.110097263}

I suspect that some of these values are outside of allowed ranges. In particular, I suspect that the n_ variables should be nonnegative. You can specify the allowed ranges like this:

    ({n_Cl, n_H, n_HCl, n_Na, n_NaOH, n_OH}=~ 0..infinity)
    ({ionic, m, u_Cl, u_H, u_Na, u_OH}=~ -infinity..infinity)

{ionic = -2.225127530, m = 0., n_Cl = 3.159530733, n_H = 5.462749423, n_HCl = 2.054664202*10^7, n_Na = 7.562418530, n_NaOH = 3.102492997*10^6, n_OH = 9.037400983, u_Cl = -4.874160233, u_H = 3.641064071, u_Na = 1.655806581, u_OH = -4.110097263}

@vv In this particular case, the results are practically the same without using parametric or real. I mention this because I think that the OP is using a very old version of Maple where the parametric option may work differently, if it works at all.

1 2 3 4 5 6 7 Last Page 3 of 533