Can't calculate minus power - Messages
I want to create a file to calculate pressures in a cylindrical silo with respect to EN standards. I have entered the datas and formulas needed to calculate. Bu the programe can't calculate a formula.
I tried it on the mathematica and it worked. How can I solve this issue?
en 1991-4.sm (320 KiB) downloaded 48 time(s).
To accomplish you task you have to loop through the values of the input vector; to do this you can use the function vectorize(...) or a loop (for(...), while(...));
vectorize:
loop:
Always plot before "I want this, I want that"
Jean
en 1991-4.sm (346 KiB) downloaded 39 time(s).
WroteHello Berk,
To accomplish you task you have to loop through the values of the input vector; to do this you can use the function vectorize(...) or a loop (for(...), while(...));
vectorize:
loop:
Dear Davide,
Thank you for your reply. It is working with the vectorize function but why it should be like that? I couldn't understand. For example variable "a" has values when you press equal without any vectorize function.
WroteTwo quick observed bobos: YR is not digestible and unit problem
Always plot before "I want this, I want that"
Jean
en 1991-4.sm (346 KiB) downloaded 39 time(s).
Dear Jean,
Thank you for your answer too.
Do you mean that smath can not calculate it because of it is very long equation?
WroteIt is working with the vectorize function but why it should be like that? I couldn't understand. For example variable "a" has values when you press equal without any vectorize function.
In SMath while you are working with matrices "raise to power" it is a shorthand for matrix multiplication/inverse multiplication -> it works just when the exponent is an integer;
moreover when matrices are vectors (column matrices), instead of giving an error because dimensions of matrices are wrong, a special feature allows to the product to be the "dot product" (thus vector^power is the sum of its elements each one raised to power's value);
To apply scalar math to matrices/vectors you have to use vectorize(), programming (loops) or also you can use systems - sys(..) function.
WroteWroteIt is working with the vectorize function but why it should be like that? I couldn't understand. For example variable "a" has values when you press equal without any vectorize function.
In SMath while you are working with matrices "raise to power" it is a shorthand for matrix multiplication/inverse multiplication -> it works just when the exponent is an integer;
moreover when matrices are vectors (column matrices), instead of giving an error because dimensions of matrices are wrong, a special feature allows to the product to be the "dot product" (thus vector^power is the sum of its elements each one raised to power's value);
To apply scalar math to matrices/vectors you have to use vectorize(), programming (loops) or also you can use systems - sys(..) function.
I have done this calculations by vectorize function. I need random value in this equation. For example I need YR at z 1,5 m. How can I get that value to be used in a different equation?
WroteThere are several ways:
Thank you for your fast replies.
I couldn't define it as a function,
it didn't work for me to give a value to "z", it still give Y.R as matrix. I am really confused, sorry for misunderstanding.
PS: I have not defined variable "a" just written whole parameter in one line.en 1991-4.sm (594 KiB) downloaded 37 time(s).
en%201991-4(3).sm (596 KiB) downloaded 42 time(s).
BTW, it is even possible to move the vectorize() function from the definition to the point where you need to use it
WroteThis should works:
en%201991-4(3).sm (596 KiB) downloaded 42 time(s).
BTW, it is even possible to move the vectorize() function from the definition to the point where you need to use it
Thank you again for your fast reply.
It is not working for me. It calculated the value for Y.R for a single z for once, then I tried it for the later formulas at the end of sheet but it is not working. It gives a matrix solution again.en 1991-4.sm (607 KiB) downloaded 39 time(s).
that's because of the order of declarations in your file. Please notice that Davide defined formulas first, and later defined the variables that constitute the formulas. This way, when the formulas were defined, the meaning of its constituents was undefined, so it stayed as is: names. When later below, after all variables were set, you tried to get the Y.R value, SMath took the formula for Y.R, substituted all variables in it with their already-known values, and gave you the result for this set of values. After that, you re-defined some of variables, tried to get answer, and SMath repeated substitution in the formula, giving you the new answer.
But in your file, you define variables first, then define formula for Y.R. This way, at the Y.R definition, SMath already knows all variable values, so it stores them in the Y.R definition instead of their names. All later modifications of those variables won't have impact on what is inside the Y.R, so you won't see new results.
But you may use functional syntax instead, something like
Y.R(z):vectorize(1-(({z-h.o}/{z.o-h.o})+1)^n)
WroteBerk,
that's because of the order of declarations in your file. Please notice that Davide defined formulas first, and later defined the variables that constitute the formulas. This way, when the formulas were defined, the meaning of its constituents was undefined, so it stayed as is: names. When later below, after all variables were set, you tried to get the Y.R value, SMath took the formula for Y.R, substituted all variables in it with their already-known values, and gave you the result for this set of values. After that, you re-defined some of variables, tried to get answer, and SMath repeated substitution in the formula, giving you the new answer.
But in your file, you define variables first, then define formula for Y.R. This way, at the Y.R definition, SMath already knows all variable values, so it stores them in the Y.R definition instead of their names. All later modifications of those variables won't have impact on what is inside the Y.R, so you won't see new results.
But you may use functional syntax instead, something like, to be independent on the declarations order.Y.R(z):vectorize(1-(({z-h.o}/{z.o-h.o})+1)^n)
Thank you mikekaganski,
I am really confused because same things on the mathcad program works without any problem.
I have tried what you said in the attached file. I have put z range below the formulas. And I have created function of z with same variable ( both formulas are on the sheet now). But it couldn't calculate the results now with range.en 1991-4 (z).sm (602 KiB) downloaded 35 time(s).
WroteBut it couldn't calculate the results now with range.en 1991-4 (z).sm (602 KiB) downloaded 35 time(s).
About your latest attachment:
- Set n optimization to numeric on his definition (possible issue on exponentation of unit to check from smath side)
- You have renamed Y.R to Y.r (lowercase) - restore it (there's no name's conflict between functions and variables) or update the name inside the definition of p.hf
Wrote
Maybe it is about the version of the program. I understand that you have done nothing about the file that I attached. But it was not like this on my work notebook. Now I opened it on my own notebook and it works. The version is same as yourds. But I can't remember the work notebook. I will check it on wednesday but if it is not the latest one then it is the previous one.
Thank you.
WroteWroteBut it couldn't calculate the results now with range.en 1991-4 (z).sm (602 KiB) downloaded 35 time(s).
About your latest attachment:
- Set n optimization to numeric on his definition (possible issue on exponentation of unit to check from smath side)
- You have renamed Y.R to Y.r (lowercase) - restore it (there's no name's conflict between functions and variables) or update the name inside the definition of p.hf
Davide,
Thank you again, I just wanted to clarify that Y.r was just for demo. To try two methods simultenously. I have written that it is now working on my home notebook but I behave to early.
I have put two files tiled and screenshoted. As you can see all the things are same for both files (left is yours). But mine is not computing. I have just written the explanations of the variables only.
WroteI have put two files tiled and screenshoted. As you can see all the things are same for both files (left is yours). But mine is not computing. I have just written the explanations of the variables only.
Wrote
- Set n optimization to numeric on his definition (possible issue on exponentation of unit to check from smath side)
WroteWroteI have put two files tiled and screenshoted. As you can see all the things are same for both files (left is yours). But mine is not computing. I have just written the explanations of the variables only.
Wrote
- Set n optimization to numeric on his definition (possible issue on exponentation of unit to check from smath side)
Thank you mikekaganski,
But I am really exhausted. I can't figure it. When I say "ok" now finally, then other issue appears on other place. I thank the author for this program as it is free and capable, I think I am not able to use it efficiently. I started to copy all the text and formulas to mathcad again which is a time consuming process but I can't find any other better way unfortunately.
Please see the attached 1 and 2.png sequentially and 3 and 4.png sequentially. As I understand from numeric, I entered "n" manually after knew the result, then it worked. All the calculations were done and there were no error. The expression at the bottom were ok. Then I deleted "z" value at top of the sheet which was entered to do a trial to see results. Then at the bottom, latests equations gave error.
I tried in another sheet with Y.R(z), it was good at beginning but then it gave an error again when the equations arise.
File not found.File not found. File not found.File not found.
Best regards
Please note, this is an important feature of SMath Studio:
if the dependancy from a variable is hidden (not a function or the variable is not an argument of the function)
- if this variable is already defined, his value will be replaced and stored in the definition
- if the variable is not yet defined, the variable name will be stored
See the attachment for simple examples: name value.sm (9 KiB) downloaded 42 time(s).
-
New Posts
-
No New Posts