Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
Im trying to plot, lifetime as a funct. of doping, and abs. coefficient as a function of wavelength. I've looked up some videos and good instructions from this Solved: How to produce a log based range variable or plot ... - PTC Community but I have a problem getting the plot to show while defining the range correctly, ie, units for the start and stop, adding steps. I can pull it up with python but not with Mathcad and I can't find out why. thank you,
Thank you,
Solved! Go to Solution.
It would be a good idea to make the function QE_emit work OK with a single scalar value of lambda (without any vectorization). Once you have tested that function, you can call it vectorized with vector argument(s).
What I noticed so far:
When you write a(lambda) Prime assumes a function a, which does not exist. If you meant a * lambda you would have to explicitly write is a multiplication. So you would write e.g.
but I still wonder as you defined x being zero, so this expression would always be constant 1
As you now multiply by a (which has unit 1/m), there is again a unit mismatch because now the exponent again is not dimensionless but has the unit meter.
You could make x dimensionless again, but you would run into problems with the sinh and cosh function. Their argument must be dimensionless, too, and as Ln is a length, xj must be a length, too.
Further unit mismatches in the expressions
and
where one summand is dimensionless while the other is a length.
So you have to fix the unit mismatches in your formula first, then set up the function in a way that it works for a single argument lambda and the n you should be able to call it with vector arguments.
P.S.: Guess we again are far away from the thread topic "Range Plot with Logspace and Units "
You have a unit incompatibility error. Your X is unitless, CAuger is cm6/s and t0 is s.
Just answered your question in the old thread before I saw your new one here 😉
See Solved: Re: Circuit ODE set up and solution - symmetrical ... - PTC Community
I found that 100 points would suffice for a decent plot. The way you had used logspace would only create 70 points which may be a bit too coarse. Stuart increased to 1400 points 😉
BTW, while its not necessary to use vectorization because X^2 is an operation not defined for vectors and so Prime would apply automatic implicit vectorization, I would nonetheless suggest to use explicit vectorization on f(X). Just good habit IMHO and it avoids unexpected results if some day you define a function differently. You see the difference if you replace X^2 by X*X 🙂
I thought I'd changed the x-axis scaling to logarithmic before posting, but clearly not. However, when I corrected that deficiency (and extended the range ... I didn't know why the OP had chosen those values and assumed they had some reason to do so), the plot still looked different to what I expected. I rewrote it to match what you'd written (in case I missed something obvious or some other weird interaction was happening), but I got the same plot. So, in desperation, I deleted the plot and created a new one (with log axes), and hey, voilà, success.
Stuart
@StuartBruff wrote:
I thought I'd changed the x-axis scaling to logarithmic before posting, but clearly not. However, when I corrected that deficiency (and extended the range ... I didn't know why the OP had chosen those values and assumed they had some reason to do so), the plot still looked different to what I expected. I rewrote it to match what you'd written (in case I missed something obvious or some other weird interaction was happening), but I got the same plot. So, in desperation, I deleted the plot and created a new one (with log axes), and hey, voilà, success.
Stuart
What shall I say ... its Prime time 😉
I also noticed just now when the axis is scaled logarithmically, Prime does not allow to change the second value on the axis and thus controlling the step width.
I wanted to change the exponent to show every fourth to match the picture, but I only was able to set the top value on the y-axis to 10^-3 and the bottom one to 10^-30, but I was not allow to change the second value from 10^-27 to 10^-26. That's silly and an unnecessary restriction!
Another one for the plotting improvement list. I wonder how long that list is now?
@StuartBruff wrote:
Another one for the plotting improvement list. I wonder how long that list is now?
tried to print, ran out of paper ...
Ah. I wondered why there was an international shortage of paper. Alles klar. 😈
Can I throw in a request too. Can the slide bar be a little wider, it's so hard to see and grab it with the mouse.
@cadtelsim wrote:
Can I throw in a request too. Can the slide bar be a little wider, it's so hard to see and grab it with the mouse.
What do you mean by wider? Vertical or horizontal? You can stretch the slider across the page, but, surprisingly, not down it.
One workaround might be to use the arrow keys. Click on the slide bar, then:
You will probably have to submit a formal request on the Mathcad Ideas forum. You need a fully-paid up maintenance licence to even see the Ideas forum, let alone post to it. @Catalina might be able to suggest other means of getting your request considered?
Wider, as in increasing horizontally. It take a considerable amount of my day to scroll to the side bar, pass it and go to the next screen, slow down and come back hoping this time I can grab it, doing this about hundred times for each assignment. Also, when I'm screen sharing going over it with someone else, It becomes embarrassing too. If its a worksheet I'm referencing, I can set it on the rightmost screen, that way the mount curser can't pass the bar, it stops and then I can grab it easier, but the primary worksheet is always on one of middle screens so I can look at them straight for a long time. So the problem is stopping right when I can grab it, after that it can easily be moved with the mouse.
This screen shot is barely 2/3 of the screen, doesn't the side bar seem almost one dimensional? I think I have developed a PTSD towards it. First and second knuckles if right hand index finger hurts when I even talk about it. I've had a paid student version for at least three years and every year I pay for updated version. That doesn't count as a fully paid license? Thanks.
A
@cadtelsim wrote:
Wider, as in increasing horizontally. It take a considerable amount of my day to scroll to the side bar, pass it and go to the next screen, slow down and come back hoping this time I can grab it, doing this about hundred times for each assignment. Also, when I'm screen sharing going over it with someone else, It becomes embarrassing too. If its a worksheet I'm referencing, I can set it on the rightmost screen, that way the mount curser can't pass the bar, it stops and then I can grab it easier, but the primary worksheet is always on one of middle screens so I can look at them straight for a long time. So the problem is stopping right when I can grab it, after that it can easily be moved with the mouse.
This screen shot is barely 2/3 of the screen, doesn't the side bar seem almost one dimensional? I think I have developed a PTSD towards it. First and second knuckles if right hand index finger hurts when I even talk about it. I've had a paid student version for at least three years and every year I pay for updated version. That doesn't count as a fully paid license? Thanks.
Ah, it's the scroll bar you're talking about. I's misunderstood and thought you were referring to the advanced Slider control. 🙂
Yes, I agree with you. The window scroll bars can be tricky to find. Can you use the standard Windows keyboard shortcuts to move the screen to where you want?
From : https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role
Keyboard scrolling must also be supported. When focus is within the viewport controlled by a scrollbar
, the Up Arrow and Down Arrow (or Left Arrow and Right Arrow for a horizontal scroll bar) should move the scroll bar thumb proportionally. Additionally, the Page Up, Page Down, Space, and Shift + Space keys must move the content and the scroll thumb the height (or width) of the viewport for each key press until the bottom or top (or left or right) of the content is in view.
I can't, however, find a keyboard shortcut that reliably moves to the top or bottom of a worksheet using my Dell laptop keyboard (no numeric keypad).
Then there's the official Microsoft page:
Complaints about the scroll bar narrowness seem to have increased with the move from Windows 10 to Windows 11. Some people find that going to Accessibility in Settings and setting the scroll bars to Always On widens them a little bit, but I didn't see any effect on my laptop (which has a 4K screen).
See https://github.com/microsoft/terminal/issues/12395 for a discussion about the matter in the MS Terminal GUI. Apparently, all will be resolved when XAML gets fully implemented ...
https://github.com/microsoft/microsoft-ui-xaml/discussions
If you're brave (and I'm a natural-born coward) you could try the advice given here:
But I'll leave playing with the Registry to the adventurous, those who know what they're doing, or those who exist at the wrong point of the Dunning-Kruger model. (I've played with the Registry a lot, but doing so always makes me nervous)
Here's a screenshot of my Registry Editor with the scroll bar width changed from the default -255 to a wider -360 (15*n pixels wide). Maybe a small effect on the width (after restarting). However, if you're not an administrator on your PC, you might not be able to change Registry settings.
Stuart
Only if Mathcad User Manual was this detailed and extensive.... I will work through this piece by piece and see.
Good luck. To be fair, it's a Windows-11-wide problem that has affected many W10 applications. You could suggest that PTC look into this matter and add further information to the documentation.
Looking at the fix in the Windows Registry, I'm guessing that it's more of a problem for those with high visual density screens, eg, 2k & 4k laptops and small hi-res monitors ... and larger monitors outside of arm's reach (I've got a 60 cm 2K monitor about 2.5 metres away from where I usually work).
Stuart
This is a full screen width (1916 pixels wide, I only lost 4 pixels at the window borders of Prime.
I have no problem using the scroll bars.
Now if you have a 4k display on a 15"screen, that may be a different story. In that case you could consider setting the display scale in windows to a value higher than 100%.
Success!
Luc
Thank you for clean plot, finally got that one plot. I'll work more on a vs lambda that doesn't show,
would you please see what I'm missing in the efficiency formula? I tried to simplify it but it still gave me an error.
Select each axis express and then press "Logarithmic Scaling" for both axis on the "Plot" ribbon.
Then delete the last value (10^10 which you seem to have typed in manually) on the x-axis to let Prime choose the appropriate value automatically.
EDIT: I just noticed that you edited your posting and deleted your question about your plot not showing what you expect, which is why I formulated this answer
According the function QE_emit:
1) Its not a fault but its noticable that the argument lambda is not used in the expression. So the result would be the same for any input argument lambda - constant function.
2) the error stems from the expression e^(-a*xj) because the exponent must be unit-less. a is of dimension length^-1, so xj must be of dimension length. You have to add the unit meter even if the value is zero!
Not sure if the single scalar result is what you expected. Maybe you should vectorize the whole right hand side of the function definition, not sure though.
Thank you, how did you spot that the error was coming from the expression e^(-a*xj)?
I need to calculate quantum efficiencies as a function of wavelength, so I need all the corresponding quantum efficiencies. Adding the unit to xj fixes that error but when I vectorize the whole right-hand side It still doesn't pass the lambda vector into the function.
How do I make the logGrid expression work for my version too?
It would be a good idea to make the function QE_emit work OK with a single scalar value of lambda (without any vectorization). Once you have tested that function, you can call it vectorized with vector argument(s).
What I noticed so far:
When you write a(lambda) Prime assumes a function a, which does not exist. If you meant a * lambda you would have to explicitly write is a multiplication. So you would write e.g.
but I still wonder as you defined x being zero, so this expression would always be constant 1
As you now multiply by a (which has unit 1/m), there is again a unit mismatch because now the exponent again is not dimensionless but has the unit meter.
You could make x dimensionless again, but you would run into problems with the sinh and cosh function. Their argument must be dimensionless, too, and as Ln is a length, xj must be a length, too.
Further unit mismatches in the expressions
and
where one summand is dimensionless while the other is a length.
So you have to fix the unit mismatches in your formula first, then set up the function in a way that it works for a single argument lambda and the n you should be able to call it with vector arguments.
P.S.: Guess we again are far away from the thread topic "Range Plot with Logspace and Units "
Thank you for that, I'll make a new thread.
I just realized that was the problem. How do you annotate like that? Thank you,
@cadtelsim wrote:
I just realized that was the problem. How do you annotate like that? Thank you,
The screenshot program I use has editing facility.
But I guess you can do something similar using Windows' Snipping Tool, too. At least you can draw lines and use a highlighter.
Is this solution marked accepted? how can I make sure it is?
@cadtelsim wrote:n
Is this solution marked accepted? how can I make sure it is?
Yes, it is.
When you mark a posting as "accepted solution" it is duplicated and appears additionally as second posting right after your initial posting.
Thank you, Just wanted to make sure, since I got the email.
I was looking at this matrix operation in your sheet, and I need to find a good video to learn it. Can you explain to me what is happening in this calculation?