In C++ not problem ! I run the file with DevC++ and also Codeblocks. It just did the job.
Thats because the C program uses the data type "long double" and your compilers support it accordingly. The actual size of a variable of that type may differ depending on the implementation in the compiler. As far as I am aware GCC uses 16 bytes but VC++ for example uses the very same 8 byte as it uses for a simple "double" variable - so no improvemet in VC++ if you switch from double to long double.
Even if a compiler stores a long double in 16 Bytes, it may still decide to just use the 80-bit extended precision type which the hardware (x86 architecture) supports natively (even though 10 bytes would suffice, 12 or 16 bytes may be used to maintain data structure. But the compiler may also use the 128-bit quadruple precision format. There usually is a compiler switch to turn off the 80-bit mode.
In conclusion: As long as we don't know the used compiler quite well and the comiler switches set for compilation, we cannot say much about the precision by just looking at the source code.
Mathcads variables in numeric mode use the data type "double" as defined in the standard IEEE 754-1985. Depending on conversion round-off errors its said that you may expect a precision of about 1e-14. But of course depending on the actual situation you may also have luck with 1e-15 or even 1e-16. You simply should not rely on it 😉
The symbolic engine in Mathcad provides much higher precision but calculation time will become significantly longer and you may also run into other problems using it.
Here is a small example showing the effect of round-off/conversion errors in Mathcad. You may implement it in C and look at the differences when using different data types.
You may also play around with the symbolics by changing the 1 into 1.0 in just one of the two functions. then change it in both. Using a floating point number like 1.0 forces the symbolic into a numeric float mode. You may also do this by adding the modifier "float" in the symbolic evaluation. You may control the precision by adding the number of significant digits to use (default is 10, I think) by typing "float,100" for example.
But it is possible to tune Mathcad Symbolic to expand longer expressions? About 10 years ago I made a research on QUINTIC EQUATION that it is known still dowsn't have an analytic solution from mathematicians.
And I found a big, big, Mathcad limitation that objectively does not have a powerful justification because it is about DISPLAYING 100-200 serial terms, and not about calculation precision. The displaying left to right should not be a fact to limit the researcher. I think this frustrating limitation still exists also in Mathcad Prime 5, 6.
At least if it is possible to double the actual capacity of displaying (expanding) the large expressions... For the software designer should not be a big difficulty, just impose a bigger memory allocation for displaying....
The symbolic error "The symbolic result returned is too large to display ..." sure is an annoyance. Only way to get rid of it is if you somehow can get your hand on a Mathcad 11 implementation which uses Maple internally. MC11 is considered by many as the best Mathcad version ever - at least it uses the best symbolic engine compared to later versions. But even if you succed in obtaining a version of MC11 you would not be able to license it (legally) as PTC had already turned off the necessary license servers.
If you look what PTC had done with its "development" of Prime and consider that real Mathcad is not developed any further, it looks like you have to live with that limitation of not being able to see longer symbolic results.
BTW, sometimes its possible to get to see the desired results using some tricks:
Do you know Werner why this Newton Interpolation instead to obtain 6.3125 it gives 6.359 ? I sketched on paper, but I dont find any mistake in the writing the equations in Mathcad.
I got it finally from a book.
I was in trouble by complicating the equations. Now I escaped using a more simple approach :). Too many equations bring troubles.
Glad you found the error (the unnecessary loop) yourself. In your new version you never use prod1 and prod2, so you may delete their initialization.
According the calculation of the Newton coefficients, here is a shorter way to do it without if..otherwise:
"Mathcad 11 implementation which uses Maple internally"
It's not the fact that Mathcad 11 uses Maple, but it knows an environment variable that you can set/change to control the size of symbolic display.
I currently have NODE_DISPLAY_LIMIT set to 0x80000 (524288 decimal).
(and just as easily):
Cool . How You did that NODE_DISPLAY_LIMIT set to 0x80000 (524288 decimal). . In which file from Program Files of the Application ?
I think Mathcad 13 is also very capable, it was able to support some long expression. Since Mathcad 14 I didn't understand the politics of PTC, I participated several times as voluntary tester to their new platforms, I gave to them feedbacks but they still didn't implemented the necessary corrections. Mostly they were interested only on BUGS.... bugs, bugs, bugs....Bugs Bunny. Not creative proposals.
Due to the limiting of displaying long expressions, I had to stop several initiatives of research. Symbolic calculus often is essential. And sometimes only a paper and a pen is not enough.
It's a feature only supported for Mathcad 11. It supposedly does NOT work for any version later than Mathcad 11, and I seem to remember that it also does NOT work for any earlier versions... As Werner indicated: Mathcad 11 is the best ever.
Given that Mathcad 12 and 13 still use Maple as symbolic processor the feature is not tied to the symbolic processor. Other than that it's an undocumented feature that I learned from a rep a very long time ago. If you search this forum you may be able to find some posts about it. But, as said, unless you have Mathcad 11, it's of no use to you.
You could try and persuade PTC to build support for display of larger symbolic results into a future version of Prime, but be careful what you wish for:
Being able to display large results requires Mathcad to handle those large graphics. In Mathcad 11 it comes at the price of becoming slow, to sometimes unresponsive, and occasionally crash.
With (any version of) Prime being much slower than Mathcad 11 in ALL respects, you may be better off with not being to display larger results...
If you really need to work with symbolics heavily, consider using Maple, or Mathematica. Note that they're not nearly as intuitive to work with as Mathcad, but you need to choose the right tool for the job, considering all aspects. Then Maple or Mathematica may be a better choice for you.
Its nice that the algorithm can be switched on symbolic calculation (by removing some initial numeric values) so it generates the formula. For example, I obtained the generated Polynomial.
I didn't know that the Programming Functions was working with the Symbolic Tool Calculation.
Allways in Mathcad a function that is used in the main code (algorithm) should be written before the algorithm ?
For example, C++ tolerates to put a function on beginning or at the end of the code, and Matlab requires to put the defined functions always at the end.
It is possible to use or define GLOBAL VARIABLES inside an ALGHORITM such that you can call it when you are outside of that ALGHORITM that already has its specific output result ?
I can call somehow a vector x(i)=A+... inside an ALGHORITM , take its results from there, and after that to use that vector outside not depending on what defined output has that ALGHOIRTM ?
The only way that a Mathcad program can change a worksheet variable is if you assign the result(s) of the program to that variable.
Werner, I invite you to cooperate in my book as co-author among other collaborators that help me to finalize that book ""Numerical methods with programming in C++, Matlab and Mathcad"". Around a common flowchart there are issued approx. equivalent codes in C++, Matlab and Mathcad.
The book is now about 70% completed.and initially will be in my national language. Based on its initial feedbacks will be completed later a more substantial version in English. I am the coordinator of the book, and other 5-6 co-authors help me specifically for several aspects to finish it.
So, are you interested? Your large experience with Mathcad will help me to perfect it. The only task you will have will be the review of my existing mathcad files and transmit feedbacks, just only feedbacks. So, your spent time on that will be minimal.
Can't take additional tasks at the time but I'm around here in the forum on a regular basis if you have specific questions.
Hello Tubar, from :
It seems like this :