Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
I have two questions about the attached worksheet:
1. I am trying to calculate two functions in two different ways: One by using a program, the other using the step function. The program gives expected results and for one of the functions, the step function expression agrees. For the other, it does not. Obviously, I am doing something wrong, but I cannot see what it is - I thought I set them up in the same way.
2. When I eliminate an argument from the function, that I do not think is used, I get an error with "augument". This is something else I cannot understand.
Solved! Go to Solution.
Does the error in CallEvolve2() resolve if you call Evolve2() instead of Evolve1() in the one but last line?
Success!
Luc
Does the error in CallEvolve2() resolve if you call Evolve2() instead of Evolve1() in the one but last line?
Success!
Luc
Thanks, Luc. I should have caught that.
@JohnRudnicki wrote:
I have two questions about the attached worksheet:
1. I am trying to calculate two functions in two different ways: One by using a program, the other using the step function. The program gives expected results and for one of the functions, the step function expression agrees. For the other, it does not. Obviously, I am doing something wrong, but I cannot see what it is - I thought I set them up in the same way.
2. When I eliminate an argument from the function, that I do not think is used, I get an error with "augument". This is something else I cannot understand.
ad 1)
I have not studied the details and so cannot say, why "StateSlip" fails for the first 71 time values with results larger than 10^307. But you can get rid of those erranous values by using the "on error" statement to replace them with NaN's and as you can see the plot of the remaining values seems to look like you expected:
Here you can see up to which value of" t" the function fails
Error tracing leads us to this function call:
ad 2)
As Luc already suspected you forgot to call "Evolve2" instead of "Evolve1". Calling Evolve1 with only five arguments instead of the expected six means that the results are ot values but functions in one argument. These can't be augmented with "T", hence the error message.
Thanks, Werner,
1. Hmm. With the additional information you provided I will look again to see if I can figure out what is going on.
2. Yes, I called the wrong "Evolve"
I am still puzzled if you have anymore thoughts. The problem is with ThetaSlip which does become very large for values of T < T1 (which in this case is 2). But because of the step functions, I do not see why ThetaSlip is even being evaluated between 0 and T1 (and hence becoming too large at t =1.43, as you pointed out)
Is this nesting of Theat.slip done on purpose?
But thats not the reason for the expression failing.
Here you see where and why the calculation fails. If PsiSlip exceeds 709.78, exp(PsiSlip) exceeds the max number.
It dos not matter that the factor
is zero ant the result does not matter. It is evaluated and the evaluation fails.
If you don't have to do some calculus with the function StateSlip you may replace expressions like
with
to cope with the problem.
Afterthought: It may be more appropriate to avoid counting limits multiple times, so it may be better to write T1<T... instead of T1<=T...
Personally I would prefer using the programmed if statement as it looks clearer to me (Variant 2):
Hi Werner,
I agree the programmed version is clearer, but I could not understand why the other version did not work and I could not let it go. Since the programmed version worked, I probably spent too much time trying to understand the other version. But, with your help, I think I learned something. If I understand, the functions are evaluated over the entire interval regardless of the step functions - if so, this is good to know.
BTW, the nesting was intentional. In each interval the starting value of ThetaSlip is the last value in the preceding interval.
As always, Thanks.
Correct. You have products with two factors and even if the first factor (with the Heaviside functions) already returns zero, the second factor (ThetaSlip function) is evaluated as well. Mathcad does not support shortcut evaluation (don't evaluate the second factor if the first one is already proven to be zero) in this case.