SMath Studio Forum
»
SMath Studio
»
Questions
»
Using solve or maple.solve for Array
Rank: Advanced Member Groups: Registered
Joined: 04/12/2017(UTC) Posts: 61 Was thanked: 2 time(s) in 2 post(s)
|
I want to using solve function for a simple arithmetic equation. But one of the value is an array so I must have array of answers. I am unable to achieve this using solve & maple.solve As the last resort I had to solve the equation separately which is both boring & not dynamic. The equation has units... Page1.sm (185kb) downloaded 7 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
|
Russia ☭ forever Viacheslav N. Mezentsev |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 04/12/2017(UTC) Posts: 61 Was thanked: 2 time(s) in 2 post(s)
|
Thanks for the solution. Can you please explain why we need to vectorize (above arrow) the last statement? Secondly I cannot add units to x in the function developed st_mass? My version is 0.99 (6671)
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Originally Posted by: ioncube Thanks for the solution. Can you please explain why we need to vectorize (above arrow) the last statement?
If the function uses a scalar and you substitute a vector of values, then you need to either use a loop over the elements of the vector, or the vectorization operator. Originally Posted by: ioncube Secondly I cannot add units to x in the function developed st_mass? My version is 0.99 (6671) Try to multiply x by 1 and replace 1 with units. And I think that the maple() function is not needed here, an ordinary solve() should handle it. Edited by user 17 November 2020 13:25:39(UTC)
| Reason: Not specified |
Russia ☭ forever Viacheslav N. Mezentsev |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 04/12/2017(UTC) Posts: 61 Was thanked: 2 time(s) in 2 post(s)
|
Per my experience maple.solve handles units far better... However still I am not able to reproduce your results. Sheet is attached, may be my version is old? Page1.sm (175kb) downloaded 6 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Originally Posted by: ioncube Per my experience maple.solve handles units far better. Keep in mind that the function maple() doesn't know anything about units at all. The function uses a special trick to ignore them in its work. Try now Page1 (uni).sm (176kb) downloaded 12 time(s). Page1 (uni).pdf (381kb) downloaded 9 time(s).Edited by user 17 November 2020 14:33:02(UTC)
| Reason: Not specified |
Russia ☭ forever Viacheslav N. Mezentsev |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 04/12/2017(UTC) Posts: 61 Was thanked: 2 time(s) in 2 post(s)
|
Originally Posted by: uni
Sir very weird thing is happening??
If I change the units of x from kW/kw (which is giving correct results) to kW/kW or to kw/kw answer's dimension is all weird
Ok I made a typo fault. Everything OK now THNX Edited by user 17 November 2020 16:10:57(UTC)
| Reason: Not specified
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: ioncube I want to using solve function for a simple arithmetic equation. But one of the value is an array so I must have array of answers. I am unable to achieve this using solve Here is Engineer style ... no need for Maple, just native Smath Attached SS 6179 ... some volunteer to make it unit kg/s Ioncube Otherwise.sm (21kb) downloaded 16 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Originally Posted by: uni .... Try to multiply x by 1 and replace 1 with units. And I think that the maple() function is not needed here, an ordinary solve() should handle it. Hi. I guess that the problem is that kw just like "kw" both in lowercase isn't an unit, but it is kW. To know the name of an unit you have the coup icon for insert one in the toolbar. In the attached using kW instead kw, maple don't needs units manipulation, but SMath's roots needs. Page1 (uni).pdf (414kb) downloaded 9 time(s). Page1 (uni).sm (178kb) downloaded 13 time(s).Best regards. Alvaro.
|
1 user thanked Razonar for this useful post.
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
... forget units, reconciliate as you wish in the solve bloc & Table Ioncube Otherwise.sm (29kb) downloaded 4 time(s).
|
|
|
|
SMath Studio Forum
»
SMath Studio
»
Questions
»
Using solve or maple.solve for Array
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.