acer

32343 Reputation

29 Badges

19 years, 327 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@sursumCorda Carl previously gave the following in his Answer to the earlier Question thread:

    seq['fold'= (StringTools:-SubstituteAll, L)]('L1[i], L2[i]', i= 1..length(L1));

Carl prefaced that with, "...I'm not going to use the commands foldr or foldl documented on that page but rather a new option to seq that does essentially the same thing more efficiently."

The OP for both Question threads had, of course, already seen that earlier solution using fold. But the OP started out this current Question with a paragraph containing, "as Carl Love mentioned the foldl function, today I attempted to experience its functionality (In order to understand the foldl or foldr function)."

This seems to make it quite clear that the OP has started this new Question thread because he wants to know how he can instead use foldl or foldr to accomplish the task, and he already knows that kind of (indexed call) map/seq approach using fold.

@MANUTTM I don't understand what you're talking about.

Your first claim, "From graph that you generated we can see that maximum occurs at value of i less than 0.799" is wrong and untrue. The plot clearly shows that the maximum occurs for some value of i between 0.799999998 and 0799999999. And so the plot clearly shows that the maximum occurs at a value for i greater than 0.799 or 0.7999.

Your second claim, "But the Maximize function gives the value of i as 0.7999", is misguided and misplaced. The Maximize command returned the value 0.79999 only when I specified the allowed range as i=0.0..0.79999. In other words, it returned the upper end-point of the specified range -- because the function is increasing across that boundary. That indicated that I should try again, with a higher upper end-point for the allowed range -- which is why I called Maximize again.

When I increased the upper end-point of the allowed range then Maximize returned a result with a value for i that is clearly between 0.799999998 and 0799999999.

@lcz I don't understand what you mean when you say, "it should be able to recognize it."

Your attempt passes eight additional arguments after s,
   op([L1[1],L2[1]]),op([L1[2],L2[2]]),op([L1[3],L2[3]]),op([L1[4],L2[4]])
which flattens out to,
             "(", "{", ")", "}", "[", "{", "]", "}"
before foldl receives any arguments. And so your attempt results in 8 iterations of calls to SubstituteAll.

I dislike sursumCorda's approach of using unevaluations (quotes, or command) and additional eval calls. And that has nothing to do with my understanding. It's quite unnecessarily convoluted and opaque.

ps. I also see no reason to avoid,
   CharacterMap("()[]","{}{}",s)
by using,
   Subs(convert(L1,list)=~convert(L2,list),s)
The first of those is terser, more immediately understandable, uses fewer commands, produces fewer temporary structures, and doesn't require an elementwise construct.

@Kitonum The infix syntax K%.U that you've shown will not work in 2D Input in Maple 2021, which the OP has shown to be using.

It will instead parse % as the previous result.

@Rouben Rostamian  Yes, they do solve the original equation, and no, they are not spurious solutions.

@RezaZanjirani You can upload and attach worksheet (.mw file) using the green up-arrow in the Mapleprimes editor.

Alternatively, you could use Maple's lprint command to get a plaintext form of the expression(s) that you're passing to the solve command.

@Sphericalmoments You wrote, "I thought "GenerateBipartiteTournaments" is an available package in Maple."

Why did you think that?

Did you see someone use that command somewhere? Did you see something similar? Is there a reason not to explain in detail?

Please stop changing the Post to a Question, which I address to whomever keeps changing it.

The OP is reporting on a bug, and it's primariliy a technical discussion of that.

Doesn't your expression simplify to approximately zero (and if the floating-point coefficients are converted to exact rationals then exactly zero)?

If so, then isn't the ensuing plot just a representation of the numeric roundoff error incurred by floating-point evaluation at numeric values for x and t?

In other words, isn't your plot simply showing zero + roundoff noise?

I have deleted at least two duplicate Question threads by this member on this topic, or close example.

My response to your Q3 relates to removing warnings from a precomputed worksheet file.

At the risk of stating the obvious, you might also rerun the worksheet with all warnings disabled, by executing this command at its beginning:

    interface(warnlevel=0):

@Tycho Brahe Some of these responses relate to my own preferences, grown out of several decades of Maple work.

"0. The most important  thing I'd like to learn is why Assume (the way I wrote it does not work)."

In this case you are conflating a computation done with mathematical implications (due to some assumption) with substitution according to some formula.

"The reason: It is cumbersome to keep asserting the same thing at every step."

You are free to assign an equation to a short name, and then use that more than once.

Moreover, even for an example where assumptions were suitable, I much prefer utilizing assuming (when needed, multiple times if necessary) than assume. There is a lot of tricky waters that users often get into when trying to build and intermix expressions containg the "same" name with assume assumptions on it, without such, and with additionally followups.

"1. What's the difference between MatrixInverse(U) and MatrixInverse([U])?"

I don't know what you mean there by the square brackets. Do you mean a list, or a 2D typeset Matrix input, or...? If a Matrix has been assigned to U then MatrixInverse(U) should compute. Apart from casting to floats or sepcifying some indexing function I see little to no virtue in wrapping U (even if it were valid...). I don't understand why you're asking this.

"2. If Assume doesn't work as I used it, then what is its intedned use? maybe using a simple example"

The assume command is old. The more modern assuming is my personal preference where possible, even at the expense of more typing, as assume is quirky enough to irritate me more often that aid me. See also my response above to your 0).

I also prefer to see the assumptions being utilized -- beside a computation's input -- when I read it later on.

There are examples in the documentation.

".3. If I denote r' as "atomic" then it seems that typing r' in the next line still returns "dr(x)/dx" (nevermind r(x) was never even defined) but if I copy/paste the atomic symbol from the previous line, then it seems to recognize r'. Is this correct?"

I mentioned that you'd have to ensure that each such input is the so-called atomic variable instance. If you're lucky your Maple version will successfully let you copy&paste one such instance to other inputs. If you're unlucky in that respect then you might have to right-click convert each time, or use some other easy name to which it's been assigned, and only see the effect in output. That's what I was trying to convey before. (I don't suggest assigning the "atomic variable" form to the remember table entry of diff. which sounds like asking for confusion.) There are hints that you might be able to do this task under the physics package -- now, or soon -- but I don't know whether that would make your Maple syntax learning easier or harder.

@NHameed What range do you want to consider, for the roots? How many roots are you interested in?

fsolve(cos(x)*cosh(x)-1, x=0..20, maxsols=7);

    0., 4.730040744, 7.853204624, 10.99560783, 14.13716549, 17.27875965

By the way, did you read my Answer to your original query?

I changed your Post into a Question, because it consists of questions.

I forgot to mention (sorry, I cannot edit my response at the moment): you could also call
   indets(expr,`+`)
to see all the subexpressions on which the inner procedure would operate.

First 81 82 83 84 85 86 87 Last Page 83 of 592