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

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline ioncube  
#1 Posted : 17 November 2020 10:57:44(UTC)
ioncube


Rank: Advanced Member

Groups: Registered
Joined: 04/12/2017(UTC)
Posts: 61
Man
Pakistan

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).

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

Offline uni  
#2 Posted : 17 November 2020 11:31:26(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
maple_solve.png
Russia ☭ forever
Viacheslav N. Mezentsev
Offline ioncube  
#3 Posted : 17 November 2020 13:14:29(UTC)
ioncube


Rank: Advanced Member

Groups: Registered
Joined: 04/12/2017(UTC)
Posts: 61
Man
Pakistan

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)
Offline uni  
#4 Posted : 17 November 2020 13:20:34(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Originally Posted by: ioncube Go to Quoted Post
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 Go to Quoted Post
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
Offline ioncube  
#5 Posted : 17 November 2020 14:23:15(UTC)
ioncube


Rank: Advanced Member

Groups: Registered
Joined: 04/12/2017(UTC)
Posts: 61
Man
Pakistan

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).
Offline uni  
#6 Posted : 17 November 2020 14:29:19(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Originally Posted by: ioncube Go to Quoted Post
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
Offline ioncube  
#7 Posted : 17 November 2020 15:51:32(UTC)
ioncube


Rank: Advanced Member

Groups: Registered
Joined: 04/12/2017(UTC)
Posts: 61
Man
Pakistan

Was thanked: 2 time(s) in 2 post(s)
Originally Posted by: uni Go to Quoted Post
maple_solve.png




Ok I made a typo fault. Everything OK now THNX

Edited by user 17 November 2020 16:10:57(UTC)  | Reason: Not specified

Offline Jean Giraud  
#8 Posted : 17 November 2020 18:31:50(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: ioncube Go to Quoted Post
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).
Offline Razonar  
#9 Posted : 18 November 2020 06:47:29(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Originally Posted by: uni Go to Quoted Post
....
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.
thanks 1 user thanked Razonar for this useful post.
on 18/11/2020(UTC)
Offline Jean Giraud  
#10 Posted : 18 November 2020 15:17:56(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 981 time(s) in 809 post(s)
... forget units, reconciliate as you wish in the solve bloc & Table

Pakistan.PNG

Ioncube Otherwise.sm (29kb) downloaded 4 time(s).
Users browsing this topic
Guest
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.