"Cases" function and for loop - Сообщения

Any ideas as to what might be going on?
Thanks,
FT
Definitions inside cases() arguments should be avoided.
WroteI have to point out once again that in general you shouldn't put definitions inside cases().
Unlike if(), when a condition or a case fails instead of throwing an error the whole function is returned like if doesn't exists. The consequence is that every argument is exposed and preprocessed, with potential unwanted behaviors respect to the expected logic. This is on the edge of SMath possibilities, but is what makes possible to use cases() whereas if() usually fails.
In your case it should look like in the screenshot below:
Notice that I initialize a local variable to avoid unintentional inheritance of existing vectors (if you call it twice and the second time h has less values than the first time, the second s.c_ctr will be the first vector with the initial values updated)
Thanks again.
Thanks all; appreciate the quick responses!
.WroteThanks for the responses so far. I think my problem is that the Boolean is somehow incomplete.
Attach the Smath document for doctoring !
Since the first case catches all the conditions where OCR[j] <= 1, the 2nd and third "(OCR[j] > 1) AND" checks are redundant.
Also, since Sigma'vf_ctr[j] <= pc[j] case is captured in the second condition, the third case can be written in the otherwise placeholder.

This is also the reason why I try to code things as explicitly as possible (including in the if statements) so that the students can follow along easier.
Really appreciate all the thoughtful responses from everyone; loving the SMath community already!
Wrote
WroteThere is room for improvements in the conditions management.
If I didn't made a mistake, this is most simplified I could get.
Here is the file contains logarithmic simplification steps.
Regards
cases_simplified.sm (35 КиБ) скачан 27 раз(а).
Wrote... it makes it easier for me to explain to students ...
Wait, are you a teacher too?
How is everyone in this forum a teacher, academic, professor?
Am I the only simpleton here?
WroteWrote... it makes it easier for me to explain to students ...
Wait, are you a teacher too?
How is everyone in this forum a teacher, academic, professor?
Am I the only simpleton here?
WroteAttach the Smath document for doctoring !
Give your data set of points
That will be enough to fit
Issue is already solved, no need for demands.
WroteGive your data set of points
That will be enough to fit
Your log fit comes from Cat in the Hat.
A fitting session might be otherwise realistic,
while being more universal wrt to data collection.
As well more profitable for Students.
-
Новые сообщения
-
Нет новых сообщений