Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hi Masters
Have a good day.
I have a question about why the integral values are different between the imaginary conductance is outside and inside the integral function.
or did I miss something on operators as calculating the imaginary term?
tks
Solved! Go to Solution.
Numerical integration always is just an approximation. While integration would be summing up an infinite number of infinite small values, numerical integration basically sums up a larger number of rather small values. Taking into account rounding errors and the like, it does matter if the factor is only used once in front of the integral or if it is used in every summand.
Given that, it can be said that you get the more accurate results by placing the constant factors outside of the integral.
So the small differences you experienced are just numerical inaccuracies, a summation of round-off errors, etc.
It sometimes helps to set the system variable TOL to a lower value (default is 10^-3), but you may run into troubles (calculation not converging) if you set it too low.
10^-11 is too small in my opinion, but in case of your calculation it makes for equal results.
Setting TOL to 10^-12 lets the last integral fail.
So generally its better to make it easier to the numerics to get a more accurate result. In your case you may also place Vpk^2 in front of the integral.
Another option may be using the symbolics.
Assign the result to a function in all input variables.
You may either do it before you define these variables or use clear.sym(...) to make them unknown to the symbolic engine.
This way may be especially useful if you intend to experiment with different sets of input values and want compare the results
Of course if you really intend to do so, it would make sense to make Vrms and only fL fcuntion arguments and calculate Vpeak and omega inside the function definition
Please show the circuit and what value you want to solve.
Numerical integration always is just an approximation. While integration would be summing up an infinite number of infinite small values, numerical integration basically sums up a larger number of rather small values. Taking into account rounding errors and the like, it does matter if the factor is only used once in front of the integral or if it is used in every summand.
Given that, it can be said that you get the more accurate results by placing the constant factors outside of the integral.
So the small differences you experienced are just numerical inaccuracies, a summation of round-off errors, etc.
It sometimes helps to set the system variable TOL to a lower value (default is 10^-3), but you may run into troubles (calculation not converging) if you set it too low.
10^-11 is too small in my opinion, but in case of your calculation it makes for equal results.
Setting TOL to 10^-12 lets the last integral fail.
So generally its better to make it easier to the numerics to get a more accurate result. In your case you may also place Vpk^2 in front of the integral.
Another option may be using the symbolics.
Assign the result to a function in all input variables.
You may either do it before you define these variables or use clear.sym(...) to make them unknown to the symbolic engine.
This way may be especially useful if you intend to experiment with different sets of input values and want compare the results
Of course if you really intend to do so, it would make sense to make Vrms and only fL fcuntion arguments and calculate Vpeak and omega inside the function definition
And sometimes it's worth playing with the integrator used behind the hood of the integral operator.
Stuart
@StuartBruff wrote:
And sometimes it's worth playing with the integrator used behind the hood of the integral operator.
Ahh, forgot about this.
The ability to chose the algorithm is a new feature introduce in Prime 10.
Not sure which version of Prime the OP is using, though. As I was able to open the file he posted with Prime 9, I fear the option to chose a different algorithm is not available to him.
@Werner_E wrote:
@StuartBruff wrote:
And sometimes it's worth playing with the integrator used behind the hood of the integral operator.
Ahh, forgot about this.
The ability to chose the algorithm is a new feature introduce in Prime 10.
Not sure which version of Prime the OP is using, though. As I was able to open the file he posted with Prime 9, I fear the option to chose a different algorithm is not available to him.
Yet another reason for people to upgrade to Mathcad Prime 10. The ability to use different solvers is quite beneficial. 👍
Stuart
For comparison:
Mathematica (or Wolfram Language as it now known) gives the 'correct' solution when all relevant variables are explicitly declared +ve (I haven't found a keyword that equates to ALL) - Greenpeace are on my case for all the typing and its correlation to disappearing polar bears.
Maxima simplifies the expression when used with assume_pos: true$. I have to use Maxima for the course I'm doing, so it made a good learning exercise.
However, I did submit my first assignment using Mathcad; admittedly as a maths typewriter for the most part, but I did sneak in some symbolics for checking my results. Maxima has a truly horrible to use interface; Mathcad knocks the spots off it - as it does with almost all of the text-based maths apps; keeping track of what each app thinks are the correct brackets is a nightmare.
(as an aside, brackets means all things to all homo sapiens: brackets [ ], braces { }, parentheses ( ), and chevrons ⟪ ⟫ ⟨ ⟩ < > ‹› are all called brackets somewhere or other. (To add insult to injury, chevrons aren't really chevrons, which are vertical, but sideways chevrons. < > are also known as angle brackets or, if they're small ‹› guillemets, and should not be confused with bras <| and kets |>, and should definitely not be confused with guillemots)
There were a few cases where I couldn't figure out how to get Mathcad to play ball, eg:
Xcas and Matlab's symbolic processor handled it, as did Wolfram Alpha, without me having to exercise any brain cells, Mathematica I had to look up FullSimplify. Maxima gave a correct but unusual answer: 8 - 23/2 √3. (Nice being able to use the Community superscript button; makes life so much easier 😊)
Do you know how to rationalize the denominator using Mathcad's symbolic processor?
Stuart
Do you know how to rationalize the denominator using Mathcad's symbolic processor?
Using Mathcad? Sure:
😈😈😈
@Werner_E wrote:
Do you know how to rationalize the denominator using Mathcad's symbolic processor?
Using Mathcad? Sure:
😈😈😈
😎
If only my old desktop PC hadn't gone to motherboard heaven.
Still, if Mathcad Prime 10 is using Xcas, then there is a considerable degree of hope that MP 11 will be able to rationalize the way I like it. Well, when i say, "I like", I mean "the university likes".
Stuart
If only my old desktop PC hadn't gone to motherboard heaven.
If you had a perpetual MC15 license and you kept the license file at a save place, you could install a virtual NIC and assign it the appropriate MAC. MC15 will happily accepts it (on contrary to Prime).
Unfortunately my MC15 license is not perpetual 😞
Still, if Mathcad Prime 10 is using Xcas, then there is a considerable degree of hope that MP 11 will be able to rationalize the way I like it. Well, when i say, "I like", I mean "the university likes".
Stuart
I, too, had wished that Primes symbolics would be able to rationalize the denominator, but as far this seems not be possible.
As PTC is constantly working on improving the symbolic engine, the hope may be justified.
As of XCas, I thought Prime would use FriCAS, a variant or fork of Axiom??
As far as I know, Xcas is also used by the free GeoGebra in its CAS view and its not even needed to tell it that it should simplify it
Ah, OK, I thought I'd seen mention that it was an Xcas-based system. If it's FriCAS then FriCAS should rationalize the denominator (at last for simple stuff) without asking (to -2 √2 √3 + 8 in my example), and there is a ratDenom function which does what it says.
Stuart
Stuart,
“How to show this function on the screen?” Not sure what function you are referring to. Can you clarify?
Good to see you back in the thick of it in the new forum. Not many of us old timers seem to monitor things these days, although I must admit the topics don’t seem as interesting to me as they once were – or at least relate to topics to which I can contribute a bit.
Lou
@LouP wrote:
Stuart,
“How to show this function on the screen?” Not sure what function you are referring to. Can you clarify?
Good to see you back in the thick of it in the new forum. Not many of us old timers seem to monitor things these days, although I must admit the topics don’t seem as interesting to me as they once were – or at least relate to topics to which I can contribute a bit.
Lou
Cheers, Lou. Yes, fewer of we few, we happy few, we band of siblings in Crispin Crispian's Mathcad. All we need is jmG to pop up. 😈
If you could point out where I, “How to show this function on the screen?”, I'd be glad to clarify. I'm afraid I don't recall doing so or spot within my messages where I do ... which is probably not too surprising as this gentlemen in Scotland now a-bed thinks himself accurs'd that he is not asleepe at oh dark o'clock, 🙄
Stuart
I think he replied the message to me, there is a recipient of me (To: kocela) on the top.
“How to show this function on the screen?” the question i asked when i had seen the solution you had provided
"And sometimes it's worth playing with the integrator used behind the hood of the integral operator."
I didn't notice who Lou was replying to, I'm afraid. 😞 I just saw my first name and what I took as a reference to our shared history in the Mathsoft Collaboratory, the precursor to PTC's Mathcad Community.
Did you get an answer to your question? The choice of integrator is selectable from a right-click context menu.
Stuart
@Kocela wrote:
Thank you for sharing
I am using Prime 9, unless upgrade it to 10, right?
tks
I believe it's a new feature in Mathcad Prime 10. So, yes, you'll have to upgrade to MP10 to select the integrator type. You should be able to install MP10 alongside MP9, although the XMCD/XMCDZ/MCD converter will then only translate older worksheet formats to MP10.
Stuart
While Werner pointed out how to minimize numerical errors when evaluating the integral, it is worth exploring whether you need the integral in the first place. This appears to be an evaluation of complex power into a parallel LC with a sinusoidal voltage applied. In the sinusoidal case, the integral in the first line, together with the preceding fL term, has the form
(1/T)*Integral { v(t)^2 dt } over one full period (= 1/fL). This is precisely the definition of Vrms^2. The complex power can then be evaluated without needing to do any integration. (Result is -4429.21608641315i W.)
In general, I trust numerical results more if I have made as many simplifications as possible in the math before using numerical evaluation. In general, I think most linear network sinusoidal problems can be solved without requiring numerical integration, but typically at the price of some additional symbolic manipulations. I try to make use of the symbolic processor to check my math manipulations for errors, with the goal of simplifying as much as possible before resorting to numerical evaluation. I'm always more comfortable if I can avoid numerical integration.
Lou