9 years, 4 days

## Example?...

Do you have an example of this for me to try? I am using Maple on Linux and have never had an issue with exporting 3d plots. I am interested to see if I have just been lucky so far. I just did a plot of an oscillating function (sin(x)*cos(y)) and the exported version looks like this (I had to convert the .eps to .png as this site will not allow .eps image uploads, but it looks pretty good)

## C++ -> Maple...

The input of these Maple scripts is the output of a matrix eigenvalue solver I have written in C++. This is quite a sizable code which utilises different optimisation algorithms to effectively "fit" Laguerre polynomials to a wavefunction via. the coefficients of each term.

I checked one of the larger inputs and using the length command on expr0 results in a length of over 2,600,000, but simplifying will obviously bring this down. This is a particularly complicated calculation but I know Maple can deal with these sizable inputs; it is more to lower the computational cost/time and to prevent rounding errors (which I have been experiencing with this problem, but altering the epsilons seems to stop this, and as you mentioned usage of floating point numbers early in the problem) and keep the results consistent and correct as the integrand increases in size.

## acer does it again!...

Thank you for the very excellent and thorough explanation of my question. I am still relatively new to Maple, and I am amazed at how many more commands, procedures and other hidden gems that it has. I have learnt a lot from the above posts and will spend time playing around with the scripts. Thank you for the time and effort you put in.

I will test these ideas on one of the larger inputs (I have yet to count terms but could be of the order of millions). I have a working example of the script which I am testing now as it was giving an answer which I knew was wrong, but after increasing the number of working digits and the epsilon for each of the integrals it is now providing a correct answer (after 4 hours of computation time!)

- Yeti

## @acer  Hi acer In terms of target a...

Hi acer

In terms of target accuracy I would like it to be as accurate as possible but not computationally heavy with a much larger input. 5-6 would be passable but obviously any extra would be brilliant.

I didnt mean that the syntax has changed, I just meant that there was an issue with the simplify commands and I assumed as it worked in previous Maple versions that a change was made in the latest version.

Good catch of the error as well, that was my mistake. I just threw together a minimal working example and made some errors. I was experimenting with different simplify/combine combinations to test the speed changes.

- Yeti

## Homework perhaps......

Looks like we are being asked to do their homework that needs handing in in a few hours...

## Works fine for me in Maple 2015.2 and Ma...

I checked the code in Maple 2015.2 and Maple 17 and both produce the desired result.

## Thank you...

Thank you for the reply acer. It makes perfect sense as to why it was hanging the program before. I can easily settle for a lower accuracy for this particular measurement as some other variables of the problem are only known to 8 decimal places and will have a direct effect on the FWHM.

I think fsolve is good for this particular problem. I may need to rethink the code for another problem which may show up later where (in theory) a very high degree of accuracy is required in order to find a very subtle topological change. But I wil tackle that when it comes :)

- Yeti

## Scaled down problem...

Does it work with a "scaled down" problem? i.e. smaller matrix sizes, lower input parameters etc...Without a minimal working example it is hard to understand what Maple is doing.

## Maple IDE...

I have always found it odd that default Maple does not allow line numbers or colour syntax. You may want to look into Maple IDE as a possibility

http://www.maplesoft.com/products/toolboxes/IDE/

If you want to "present" your Maple code then you can use the minted package for LaTeX to produce a custom code box which will insert line numbers, and you can also get it to do custom syntax highlighting.

- Yeti

## @acer I have been playing around wi...

I have been playing around with the Maple script and I inserted a larger sum than in the previous one to see how it would behave. One thing that stood out is the time it takes for expand() to evaluate. Taking on board your description of simplify(...,size): requires for it to be expanded otherwise it will error out saying:

Error, (in content/polynom) general case of floats not handled

I also tried some of the options with expand but none seemed to remedy the issue.

With the expand in place, it will go through the first steps but then just returns the ans1 call as I assume it is not in a form simplified to its liking?

Edit: By asking for type(...,numeric) it produces a FAIL so I guess the issue lies there. By lowering the epsilon it is possible to get it to evaluate. On my machine it FAILS at ep=1e-6

## Thank you...

I have learnt an awful lot from your posts on this forum acer and I would like to say a big thank you. You also reveal capabilities of Maple that I never knew were there. This is an excellent reply and I have learnt a lot which I can apply to other codes I have written, am writing and will write. Thank you.

## @Doug Meade    Thank you for t...

Thank you for the replies, it is very much appreciated. I have had to use 32 digits in similar calculations in the past due to numerical instability creeping in for particular calculations; and was remedied by using quadruple precision.

## Accuracy of 5 to 6 decimal places...

5 to 6 decimal places is preferred for the accuracy.

## Question needs rephrasing...

The function may return a value of zero but this information does not tell us about its gradient. I think this is what the poster wants, but the way they have written it would give a zero answer. Hence they want it to equal a(t)*diff(b(t)/t). I think their function is only zero at a particular point, and they want to keep the form generic to consider the rest of the domain of the function? Not entirely clear.

## What is Maple telling you?...

I assume the issue you are having is the piecewise solutions? Look at what Maple is telling you. It is 'undefined' for when K<0. I do not know the exact limits on these variables but it is effectively telling you that K can never be less than 0. So you can tell Maple that K can never be less than zero (i.e. assume K>0) then it will work.

 1 2 3 4 5 Page 4 of 5
﻿