Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hi
I am a beginner in Mathcad Prime. I would like to make plot for under stated conditional function .Please help in this regard.
V(t)= 5 for 0<t<5
=-5 for5<t<10
It should be square wave plot with period 10. I mean after t=10 it should repeat itself.
Solved! Go to Solution.
AlvaroDíaz wrote:
For functions "seccionalmente contínuas", o "contínuas a trozos" (can't remember the english name) I'm more comfortable with this implementation, because can handle symbolics, even the derivative isn't a function (is a distribution, but the integral is function). This is specially useful, for example, calculating deflections for beams.
I try to do this in Prime, but can't. In Prime Phi = Greek F = Heaviside evaluate at 0 gives ... Phi(0) = 0.5. That's a serious, serious bug.
I'm clearly having a Senior Moment here ... is your boolean equivalent of ~in correct, Alvaro?
Stuart
You run into troubles with derivative and integral that way.
And operations like integration seems to be the main reason why Alvaro prefers using the Heaviside function instead of the more intuitive if-statements or if-functions.
Try the indefinte integral of your function f.good.
You could replace "ceil" by "sign", but the problem remains.
Werner
Hi. Werner answer's Stuart is right. I can't find a replacement for Phi. MuPad's documentation from matlab says that can change the value at the origin (like maple or mathematica) with something like Pref::heavisideAtOrigin(1). But that in the last version of mupad kernel, assume that isn't which mathcad have.
Werner also points that integrals are the target of this strange implementation for some simple inequalities. That's because for derivatives is a little more complex: in the figure, Delta isn't a function. For that is why blue star appear, and can be corrected, but some price apply.
AlvaroDíaz wrote:
MuPad's documentation from matlab says that can change the value at the origin (like maple or mathematica) with something like Pref::heavisideAtOrigin(1). But that in the last version of mupad kernel, assume that isn't which mathcad have.
Its not just a problem with Mupad because Phi is also a numeric function implemented in Mathcad.
If you are willing to temper a little bit with your installation files, it would be easy to convince MuPad, that Phi(0)=1. But I have no idea how to change the behavior of the numeric implementation:
To change MuPads behaviour you can do the following:
1) Go into Mathcads installation folder in the mupad\mupad folder, e.g. "C:\program files (x86)\Mathcad\Mathcad 15\mupad\mupad"
2) Make a backup of the file "lib.tar"
3) "lib.tar" ist an archive file (like zip or rar). Find a program which can unpack and repack that format. WinZip or WinRar and a lot of free alternatives will do the job.
4) Unpack lib.tar preserving the directory structure.
5) In the folder "lib" You will find a subfolder named "SPECFUNC" and inside that folder a file named "heavisid.mu".
6) Edit "heavisid.mu" - you have to change the value three times (the first is just a comment). I tried to preserve the file length and so I replaced 1/2 by 1/1 and 0,5 by 1.0. But I guess that file length is not important. The vital two areas are (I am omitting the comment at the beginning of the small file).
7) repack "lib.tar" and start Mathcad. Phi(0) should yield 1 in symbolic eval, but still 0.5 in numeric evaluation.
There are also files which include "heavisid" in lib\STDLIB\SIMPLIFY, lib\SERIES, lib\TRANS\LAPLACE, lib\TRANS\FOURIER, but I have not touched them-
As the above concerns symbolic eval only, I guess its not of much use. Furthermore you will have to copy the modified "lib.tar" to every machine you will be working with.
Werner
Werner Exinger wrote:
AlvaroDíaz wrote:
MuPad's documentation from matlab says that can change the value at the origin (like maple or mathematica) with something like Pref::heavisideAtOrigin(1). But that in the last version of mupad kernel, assume that isn't which mathcad have.
Its not just a problem with Mupad because Phi is also a numeric function implemented in Mathcad.
If you are willing to temper a little bit with your installation files, it would be easy to convince MuPad, that Phi(0)=1. But I have no idea how to change the behavior of the numeric implementation:
To change MuPads behaviour you can do the following:
....
As the above concerns symbolic eval only, I guess its not of much use. Furthermore you will have to copy the modified "lib.tar" to every machine you will be working with.
Neat, Werner. I'll have to have a look at the MuPad library.
However, as you say, the problem will be that it introduces a configuration problem. Indeed, it may not be possible for many users to do anything with the library as the application will be on a remote server that the IT Polizei will have locked down.
I had a similar problem with recursion when Mathsoft suggested, post M12, that I change the recursion limit in the Registry ... even after I pointed out this *might* have some portability issues (What's that? Oh, you want to play with the Registry? Sure. No Problem. It's not like a mistake could affect anything ..." or "Just fill in IT Form 1234ABC requesting the change and get authorization from your Departmental Head. Oh, and don't forget the Cost Code.") .
Stuart
StuartBruff wrote:
Neat, Werner. I'll have to have a look at the MuPad library.
I haven't played around much with that library myself, just thought it should be possible to do. But of course we can't go that way in many situations as you pointed out.
From time to time Viacheslav N. Mezentsev (think he is the user "uni" in the SMath forum) posted some interesting things, doing some magic with the symbolic keyword "experimentally". Just found one here Re: how to import an equation from an editor?
He also once posted nice routines for implicit 2D and 3D plots - a painfully missed feature in Mathcad.
Regards Werner
Hi. Werner Procedure works, but as Stuart point, it's hard to do at every system, just for load some worksheets. Even that's corrects symbolics, the behavior of numerics can be overloaded easy with ceil(Phi(x)) or similar implementation. Instead of modify mupad lib, what actually you need is to access to the mc debug library. Attached shows a mc debug function, where don't need to hack mupad library, and can handle the symbolics procedures, but fails because the mupad lib is old, and have not implementation for modifying heaviside, like new versiones. So, following command don't works:
AlvaroDíaz wrote:
Hi. Werner answer's Stuart is right. I can't find a replacement for Phi. MuPad's documentation from matlab says that can change the value at the origin (like maple or mathematica) with something like Pref::heavisideAtOrigin(1). But that in the last version of mupad kernel, assume that isn't which mathcad have.
Werner also points that integrals are the target of this strange implementation for some simple inequalities. That's because for derivatives is a little more complex: in the figure, Delta isn't a function. For that is why blue star appear, and can be corrected, but some price apply.
Yes, I'd tried playing with the similar various representations of Heaviside, but it didn't really resolve the problem; it's a shame the delta (δ) function doesn't take real arguments.
Stuart
Yes, but that can be corrected overloading the function in numeric's mcad. But is much more hard to avoid the fact that symbolics didn't evaluate the derivative.
Werner Exinger wrote:
You run into troubles with derivative and integral that way.
And operations like integration seems to be the main reason why Alvaro prefers using the Heaviside function instead of the more intuitive if-statements or if-functions.
Try the indefinte integral of your function f.good.
You could replace "ceil" by "sign", but the problem remains.
Yes. I was just playing around with various options - they're all pretty horrible to deal with from a symbolic point of view, As you note with your MuPad modification - there's a snake waiting for you at the top of each ladder.
Stuart
Ups, thanks Stuart for the red label. It's x<a and x>=b.
Hi to all
Thanks for your kind interest. But sorry to say I am not getting any solution yet. Please find attached DOC for the reference.I actually want to find critical point of any function. Maximize/Minimize are suppose to put on Vector but I am not getting what makes not to it to do so.
It looks like the t in the argument for I(t) is considered to be a unit. (Prime makes units bold and dark blue.) In the math tab on the ribbon, pull down "labels" and make that "t" a variable. That should get rid of the red box in that equation and in the definition of V ripple. Then all you have to worry about is the correct set up for minimize. (I think it takes a guess and/or a range.)
Please find final outcome as per your suggestion
SAMEER GARG wrote:
Please find final outcome as per your suggestion
Are you sure about your equations? I'm not sure they will give you the minimized value you are possibly seeking.
A few comments.
You have defined I1 and Vripple_min to be functions; this means you cannot put an evaluation operator (=) after them - this is in part what Mathcad is complaining about.
It's usually well worth while evaluating functions at a few values (especially critical ones) and/or plotting your functions to check if they make sense over the intervals of interest.
I'm surprised Mathcad let you type in KHz instead of kHz; the SI multiplier for 1000 (kilo) always has abbreviation 'k' not 'K'. Indeed, 'K' is often used in computing circles to mean 2^10 = 1024 (eg, KB).
It helps others if you post your worksheet - saves all that typing and there are sometimes problems with a worksheet that aren't obvious or visible from a screenshot.
Stuart
Hello Stuart
Thanks a ton. You solved my problem and i got what i was looking for. I will definitely attach worksheet from next time as per your suggestion. Actually I got the option for attaching image but i am not getting the option for attaching any file in compose window yet.
SAMEER GARG wrote:
Hello Stuart
Thanks a ton. You solved my problem and i got what i was looking for. I will definitely attach worksheet from next time as per your suggestion. Actually I got the option for attaching image but i am not getting the option for attaching any file in compose window yet.
No Problem, Sameer.
The option for attaching a worksheet is one of those things that you need to know where it is before you can find it!
If you're starting a discusssion, you will find the attach "control" down on the right hand side of the text entry box - I've circled it in red in the image below:
However, if you are replying to a message, then the attach control is absent. You need to press the "Use advanced editor" option to show it.
The other annoying thing about the Attach control is that the mouse pointer doesn't change nor does it highlight / visually change or give any other indication that it's a control when the mouse is over. You just have to click on the word "Attach" and a file dialog will appear after a few seconds.
Stuart
Hello Stuart
Hello Stuart
I got the "Use Advanced Editor" option. I am quite surprised after seeing the way. When I used to make reply in the same page from the inbox window there will not be such option but when i will clicked on the main subject a new page will open for reply and there the same option was available. Anyway Thanks for your kind interest.