Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


3 Pages123>
Options
Go to last post Go to first unread
Offline Berk  
#1 Posted : 24 August 2016 18:21:14(UTC)
Berk


Rank: Member

Groups: Registered
Joined: 24/08/2016(UTC)
Posts: 21
Turkey
Location: Ankara

Hello,

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 (321kb) downloaded 32 time(s).

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Davide Carpi  
#2 Posted : 24 August 2016 18:47:41(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,639
Man
Italy
Location: Italy

Was thanked: 1323 time(s) in 873 post(s)
Hello 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:
2016-08-24 17_53_25-SMath Studio Desktop - [en%201991-4.sm_].png

loop:
2016-08-24 17_58_43-SMath Studio Desktop - [en%201991-4.sm_].png

Edited by user 24 August 2016 18:59:13(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
thanks 1 user thanked Davide Carpi for this useful post.
on 25/08/2016(UTC)
Offline Jean Giraud  
#3 Posted : 24 August 2016 19:03:55(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Two quick observed bobos: YR is not digestible and unit problem
Always plot before "I want this, I want that"


Jean

en 1991-4.sm (347kb) downloaded 23 time(s).
Offline Berk  
#4 Posted : 24 August 2016 22:40:21(UTC)
Berk


Rank: Member

Groups: Registered
Joined: 24/08/2016(UTC)
Posts: 21
Turkey
Location: Ankara

Originally Posted by: Davide Carpi Go to Quoted Post
Hello 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:
2016-08-24 17_53_25-SMath Studio Desktop - [en%201991-4.sm_].png

loop:
2016-08-24 17_58_43-SMath Studio Desktop - [en%201991-4.sm_].png



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.

Originally Posted by: Jean Giraud Go to Quoted Post
Two quick observed bobos: YR is not digestible and unit problem
Always plot before "I want this, I want that"


Jean

en 1991-4.sm (347kb) downloaded 23 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?

Edited by user 24 August 2016 22:43:26(UTC)  | Reason: Not specified

Offline Jean Giraud  
#5 Posted : 25 August 2016 03:04:34(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Hello Berk,

Just like this:

Forum Berk.gif
thanks 1 user thanked Jean Giraud for this useful post.
on 25/08/2016(UTC)
Offline Davide Carpi  
#6 Posted : 25 August 2016 10:41:28(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,639
Man
Italy
Location: Italy

Was thanked: 1323 time(s) in 873 post(s)
Originally Posted by: Berk Go to Quoted Post
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.


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.

Edited by user 25 August 2016 10:47:42(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
thanks 1 user thanked Davide Carpi for this useful post.
on 25/08/2016(UTC)
Offline Berk  
#7 Posted : 25 August 2016 16:31:55(UTC)
Berk


Rank: Member

Groups: Registered
Joined: 24/08/2016(UTC)
Posts: 21
Turkey
Location: Ankara

Originally Posted by: Davide Carpi Go to Quoted Post
Originally Posted by: Berk Go to Quoted Post
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.


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?
Offline Davide Carpi  
#8 Posted : 25 August 2016 17:08:04(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,639
Man
Italy
Location: Italy

Was thanked: 1323 time(s) in 873 post(s)
There are several ways:

  • define again a or z, define again Y.R
  • define Y.R as a function: Y.R(a) or Y.R(z)
  • define Y.R before defining z or a -> each time you call Y.R, the last value you define for these parameters will be used
    2016-08-25 16_07_23-SMath Studio Desktop (ver. 0.98.6060) - [en%201991-4(1).sm_].png
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline Berk  
#9 Posted : 25 August 2016 17:34:39(UTC)
Berk


Rank: Member

Groups: Registered
Joined: 24/08/2016(UTC)
Posts: 21
Turkey
Location: Ankara

Originally Posted by: Davide Carpi Go to Quoted Post
There are several ways:

  • define again a or z, define again Y.R
  • define Y.R as a function: Y.R(a) or Y.R(z)
  • define Y.R before defining z or a -> each time you call Y.R, the last value you define for these parameters will be used
    2016-08-25 16_07_23-SMath Studio Desktop (ver. 0.98.6060) - [en%201991-4(1).sm_].png


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 (595kb) downloaded 13 time(s).

Offline Davide Carpi  
#10 Posted : 25 August 2016 18:15:06(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,639
Man
Italy
Location: Italy

Was thanked: 1323 time(s) in 873 post(s)
This should works:

en%201991-4(3).sm (597kb) downloaded 22 time(s).
2016-08-25 17_11_01-SMath Studio Desktop - [en%201991-4(3).sm_].png

BTW, it is even possible to move the vectorize() function from the definition to the point where you need to use it

Edited by user 25 August 2016 18:19:07(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline Berk  
#11 Posted : 29 August 2016 15:53:01(UTC)
Berk


Rank: Member

Groups: Registered
Joined: 24/08/2016(UTC)
Posts: 21
Turkey
Location: Ankara

Originally Posted by: Davide Carpi Go to Quoted Post
This should works:

en%201991-4(3).sm (597kb) downloaded 22 time(s).
2016-08-25 17_11_01-SMath Studio Desktop - [en%201991-4(3).sm_].png

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 (608kb) downloaded 18 time(s).

Offline mikekaganski  
#12 Posted : 29 August 2016 16:47:14(UTC)
mikekaganski


Rank: Advanced Member

Groups: Registered
Joined: 17/01/2013(UTC)
Posts: 296
Man
Russian Federation
Location: Khabarovsk, Russia

Was thanked: 151 time(s) in 107 post(s)
Berk,
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
Code:
Y.R(z):vectorize(1-(({z-h.o}/{z.o-h.o})+1)^n)
, to be independent on the declarations order.
Best regards,
Mike Kaganski
Offline Berk  
#13 Posted : 29 August 2016 17:43:46(UTC)
Berk


Rank: Member

Groups: Registered
Joined: 24/08/2016(UTC)
Posts: 21
Turkey
Location: Ankara

Originally Posted by: mikekaganski Go to Quoted Post
Berk,
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
Code:
Y.R(z):vectorize(1-(({z-h.o}/{z.o-h.o})+1)^n)
, to be independent on the declarations order.


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 (603kb) downloaded 17 time(s).

Offline mikekaganski  
#14 Posted : 29 August 2016 17:53:17(UTC)
mikekaganski


Rank: Advanced Member

Groups: Registered
Joined: 17/01/2013(UTC)
Posts: 296
Man
Russian Federation
Location: Khabarovsk, Russia

Was thanked: 151 time(s) in 107 post(s)
minusPower1.png
Best regards,
Mike Kaganski
Offline Davide Carpi  
#15 Posted : 29 August 2016 19:01:48(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,639
Man
Italy
Location: Italy

Was thanked: 1323 time(s) in 873 post(s)
Originally Posted by: Berk Go to Quoted Post
But it couldn't calculate the results now with range. en 1991-4 (z).sm (603kb) downloaded 17 time(s).


About your latest attachment:
  1. Set n optimization to numeric on his definition (possible issue on exponentation of unit to check from smath side)
  2. 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

Edited by user 29 August 2016 19:14:19(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline Berk  
#16 Posted : 29 August 2016 23:50:20(UTC)
Berk


Rank: Member

Groups: Registered
Joined: 24/08/2016(UTC)
Posts: 21
Turkey
Location: Ankara

Originally Posted by: mikekaganski Go to Quoted Post
minusPower1.png


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.
Offline Berk  
#17 Posted : 29 August 2016 23:54:11(UTC)
Berk


Rank: Member

Groups: Registered
Joined: 24/08/2016(UTC)
Posts: 21
Turkey
Location: Ankara

Originally Posted by: Davide Carpi Go to Quoted Post
Originally Posted by: Berk Go to Quoted Post
But it couldn't calculate the results now with range. en 1991-4 (z).sm (603kb) downloaded 17 time(s).


About your latest attachment:
  1. Set n optimization to numeric on his definition (possible issue on exponentation of unit to check from smath side)
  2. 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.

minuspow.PNG

Edited by user 30 August 2016 00:38:56(UTC)  | Reason: Not specified

Offline mikekaganski  
#18 Posted : 30 August 2016 02:43:54(UTC)
mikekaganski


Rank: Advanced Member

Groups: Registered
Joined: 17/01/2013(UTC)
Posts: 296
Man
Russian Federation
Location: Khabarovsk, Russia

Was thanked: 151 time(s) in 107 post(s)
Originally Posted by: Berk Go to Quoted Post
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.


Originally Posted by: Davide Carpi Go to Quoted Post
  1. Set n optimization to numeric on his definition (possible issue on exponentation of unit to check from smath side)

Edited by user 30 August 2016 02:47:20(UTC)  | Reason: Not specified

Best regards,
Mike Kaganski
Offline Berk  
#19 Posted : 30 August 2016 19:51:16(UTC)
Berk


Rank: Member

Groups: Registered
Joined: 24/08/2016(UTC)
Posts: 21
Turkey
Location: Ankara

Originally Posted by: mikekaganski Go to Quoted Post
Originally Posted by: Berk Go to Quoted Post
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.


Originally Posted by: Davide Carpi Go to Quoted Post
  1. 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.

2.PNG1.PNG 4.PNG3.PNG

Best regards
Offline Davide Carpi  
#20 Posted : 31 August 2016 02:57:07(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,639
Man
Italy
Location: Italy

Was thanked: 1323 time(s) in 873 post(s)
Without this version of the file my best guess is you are feeding the tension with a vector, probably because p.he is involved and is defined after the first assignment of z -> you must move that definition before the first definition of z (another way could be to use Clear(z) from CustomFunction before p.he definition)


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 (10kb) downloaded 25 time(s).

Edited by user 31 August 2016 10:34:12(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Users browsing this topic
3 Pages123>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.