Mike McDermott

95 Reputation

5 Badges

9 years, 161 days

MaplePrimes Activity


These are replies submitted by Mike McDermott

I could not guess the outcome either, but I didn't try very hare.

Have you investigated the XMLTools package? Particularily 'GetAttribute'

Alternatively, there is DocumentTools[Retrieve]

@laurent 

Thanks for you reply. This was not at all obvious to me. For one thing, I was using document mode and the code is not shown when you do that. For another thing, how would you be able to type the code and know the label? Here is the code that Maple wrote when I used worksheet mode:

DocumentTools[Retrieve]("C:\\Users\\fzfbrd\\Documents\\Example for Om.mw", "L12009")

If I wanted to type this, how would I ever know the label "L12009"? As it is, I had a menu pick between labels (10.1 10.2 10.3 10.4) when I used the menu to generate this code.

It would be nice if there was something more meaningful than "L12009" here. I suppose if I assign the result to a meaningful name, and/or add comment text, I can show in the document what is going on.

@Christopher2222 

the example in the help page is not in document mode.

I don't know why this was chosen, but that's what I've been told.

@Axel Vogt 

@acer You have been a lot of help, and I think I will implement your approach. We have problems with more than 20 variables, and as you know 2^20 is quite large, and we are not very patient. :)

OK. I see what you are saying, and you are probably correct in that going down the road I was heading would be complicated. I saw that your procedure still took 2^N inputs vectors, and generating these vectors for us can take significant time for expressions with a lot of variables, so either we live with that, or focus on better ways to improve that part of the problem.

Thanks again for your help.

Thanks, but what I was really asking is if there is a way to identify independent parts of an experssion so that the problem could be broken downt into smaller parts. My example has 2 independent parts, and can be broken into 2 expressions of 2 variables each. Each of the 2 sub expressions require only 4 evaluations. In this example, the number of evaluations would be half of the full factorial of the initial expression.

Codegen looks like a good way to reduce calculations, but my question was about an algorythmic way to brake a problem like this up into smaller problems so that the number of test vectors could be reduced. In my example, and in the codegen function, there are 16 test vectors because there are 4 variables. If the expression could be broken down into 2 independent expressions, then we have 2 expressions of 2 variables each. Each sub-problem has 4 test vectors, for a total of 8 test vectors, which is half of what we started with.

codegen looks promising as a way to make the evaluation of the expression more efficient, but I was wodering if there is a way to reduce the number of times the expression has to be evaluated. For the example above, I believe that it's possible to get the same result by calculating the expression only 8 times, by breaking the expression into independent parts. In my example of a*b + c*d, it is only necessary to evaluate the 4 combinations of a and b, and then add that min, max result to the 4 combinations of c and d. Thus when the 4 element problem is broken into two 2 element problems, the number of computations is reduced.

Sorry to waste your time.

It's working now, even though I didn't change anything. I don't have permission to delete my question.

Carl,

I was using the falg form of the NonlinearFit function, when I should have been using the fop version. Thanks again for your patience with me.

Mike

Mac Dude

Thanks. That's exactly what I was looking for.

1 2 Page 1 of 2