cases and replacement of variable by value - Messages

WroteShouldn't the variable A be replaced by its value 1 when 'cases' is used instead of 'if/else'?
This is by design and is related to functions and undefined arguments; however if I remember correctly was needed because the old way caes() was coded, I'll check if with current cases() and smath code can be removed. Also, applies ony when cases is on the RHS of functions.
WroteI notice one instance if/otherwise does not work vs if/else.
Reported, not acknowledged ... maybe more than one instance.
No way this can work, because a is defined after the plot; keeping this layout you have to move the vertical position of the plot down or the vertical position of a:0 up

WroteI really don't want to play silly games with you anymore.
I asked a simple question:
"Why is the value of the canvas variable A not stored in the function, when cases is involved ?"
Your answer has absolutely nothing to do with my question.
Convince yourself, try the right/wrong code in De Boor Colibri.
It may have to do with another next possible not silly visit/question.
Spline De Boor [Colibri].sm (39 KiB) downloaded 35 time(s).
WroteExample from Mathematica 4.0
Explained otherwise in Mathcad/Mathsoft
x^1/2 will output 250 floating point decimals [1/2 is exact]
x^0.5 will output 15 decimals [0.5 is unknown]
WroteExplained otherwise in Mathcad/Mathsoft
... I will leave it from there.
Please, don't hesitate to submit your project.
There was that futile discussion about 32/64/128 floating point
In PC's, 32 bits is enough. Common math functions as delivered
by Microsoft are 21 decimals, uncertain down to 18 decimals
agreed to true 15 decimals taking account of reasonable
numerical errors propagation.
A Mathsoft Collab wanted > 15 decimals. Answer was simple:
Mahcad 11 extended 64 floating point:
Install Chebyshev 25 decimals [Clenshaw, Luke ...]
Accuracy.sm (19 KiB) downloaded 36 time(s).
QuoteThe difference comes when the value of A changes after the definition of f(x) and g(x).
For g(x) the original definition of A:=1 remains. However, for f(x) the value of A changes.
I see that the problem is caused by the definition of the variable A, before the functions, changing the definition of this variable after the definitions of the functions, the problem is solved.
This indicates to us that we must be very careful when programming functions when some of the variables that integrate in them have already been defined previously, because we could arrive at erroneous results
cases_ok_cbg.sm (7 KiB) downloaded 33 time(s).
Best Regards
Carlos
sergio
Wroteit is evident that one expects the same behavior.
They do behave the same, except for the rare case that I reported.
In mainy instances < or <= won't matter
In other instance it matters to scrap the project [De Boor re-posted in this thread].
In less visible instance, if the form is not appropriate will freak the project.
Same things with Mathcad ... ad nauseum doctored.
No matter the arguments, Smath is correct, does not forgive user incorrect coding.
WroteWroteit is evident that one expects the same behavior.
They do behave the same, except for the rare case that I reported.
Take a look at post #1 or #3. That's about what we are talking here.
Another example:
The first A is replaced by its value, the second is not.
Not really intuitive or obvious, in my opinion.
- any argument will be preprocessed by smath; this means f.e. that if you place a definition, this will be evaluated despite the condition is met or not (like in if function)
File not found.File not found. - the protection against assignments won't work anymore
- won't be possible anymore to use functions like error()
(you will be able do them using line, though)
-
New Posts
-
No New Posts