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 Mido0  
#1 Posted : 04 May 2019 03:53:16(UTC)
Mido0


Rank: Advanced Member

Groups: Registered
Joined: 10/01/2017(UTC)
Posts: 31
Man
Canada
Location: Alberta

Hi,
I was trying to solve 2 equations and getting the root using FindRoot with weird results, that when substituting with the SMath results the equations don't yield to the same results.
I know using units seem to create problems, but it sometimes works and I need to solve this somehow.
any suggestion?
Test.jpg

Test.sm (288kb) downloaded 18 time(s).

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

Offline Jean Giraud  
#2 Posted : 04 May 2019 05:17:16(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)
Originally Posted by: Mido0 Go to Quoted Post
I was trying to solve 2 equations and getting the root using FindRoot with weird results, that when substituting with the SMath results the equations don't yield to the same results.
I know using units seem to create problems, but it sometimes works and I need to solve this somehow.
any suggestion?

1. I don't understand what you are trying to do.
2. Here is is a working example.
3. Your document is not backward compatible

Solve FindRoots LogLikely.sm (15kb) downloaded 31 time(s).

Offline Davide Carpi  
#3 Posted : 04 May 2019 13:01:20(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)
Somehow it works better reversing the unknowns... dunno why...

Also since you are working with units you have to pay attention at the required precision. The one shown in the function description is about the base units, m for the length and m^2 for the area.

Test - r0.sm (278kb) downloaded 22 time(s).
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline Mido0  
#4 Posted : 06 May 2019 19:21:12(UTC)
Mido0


Rank: Advanced Member

Groups: Registered
Joined: 10/01/2017(UTC)
Posts: 31
Man
Canada
Location: Alberta

Thank Davide and Jean,
Jean, as a structural engineer I deal a lot with units and creating a sheet without units is not professional and typically creates errors from users which we try to avoid. I read on other forums that the function works well without units (same as your sheet) so I prefer to find a way that works with units.

Davide, I am worried because this error should not occur.
I mean do I need to check every time I change my input that my output is correct?! and try to flip the variables to make it work? I tried your code in another old sheet and it did not work, I had to stick with the order a1=d first then the Area to make it work properly!!

Also, what happens if there are two positive real solutions, which one will be shown by SMath?

Thanks a lot for your help!!

Edited by user 06 May 2019 19:36:42(UTC)  | Reason: eng.mag@gmail.com

Offline Jean Giraud  
#5 Posted : 06 May 2019 21:37:00(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)
Originally Posted by: Mido0 Go to Quoted Post
Jean, as a structural engineer I deal a lot with units and creating a sheet without units is not professional and typically creates errors from users which we try to avoid. I read on other forums that the function works well without units (same as your sheet) so I prefer to find a way that works with units.

1. If it happens several roots, then solve(4)
2. Maple symbolic does not take units.
3. None of my Smath Process Control & Instrumentation [~ 100] carries units.
All results are in appropriate units ... [t/hr, mWc, cP ...]
4. What's the arc length unit => UnitGraphic that you can scale 1.23456789
5. Units were discussed ad nauseum Mathsoft Collaboratory.
Over 125000 exchange, not a single work sheet with units.
6. In few steps the resistance is no more Ohms ...
7. The unit system should be dead decoration, i.e: not sub-processing.

Cheers ... Jean

thanks 1 user thanked Jean Giraud for this useful post.
on 08/05/2019(UTC)
Offline mkraska  
#6 Posted : 06 May 2019 22:49:54(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,980
Germany

Was thanked: 1120 time(s) in 718 post(s)
Originally Posted by: Mido0 Go to Quoted Post
Thank Davide and Jean,
Jean, as a structural engineer I deal a lot with units and creating a sheet without units is not professional and typically creates errors from users which we try to avoid. I read on other forums that the function works well without units (same as your sheet) so I prefer to find a way that works with units.

Davide, I am worried because this error should not occur.
I mean do I need to check every time I change my input that my output is correct?! and try to flip the variables to make it work? I tried your code in another old sheet and it did not work, I had to stick with the order a1=d first then the Area to make it work properly!!

Also, what happens if there are two positive real solutions, which one will be shown by SMath?

Thanks a lot for your help!!


If using the Maxima plugin is an option for you, then the solution is straightforward.
- Units are no problem for the plugin (they are converted into symbolic variables, Maxima itself isn't unit-aware).
- Multiple solutions are returned by Solve as a row vector of solutions (with each being a list of equations). You can pick the solution by
index and apply it using Assign().

I don't know how you can know in advance which solution to use. Perhaps the reasoning on which one to select can be cast into some test for index generation.

Best regards, Martin

test1_kr.png
test1_kr.sm (291kb) downloaded 16 time(s).
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
thanks 2 users thanked mkraska for this useful post.
on 06/05/2019(UTC),  on 08/05/2019(UTC)
Offline Jean Giraud  
#7 Posted : 07 May 2019 03:36:29(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)
Originally Posted by: mkraska Go to Quoted Post
I read on other forums that the function works well without units (same as your sheet) so I prefer to find a way that works with units.

Just remember maths are unitless.
You are solving for two monkeys that you can't augment with units.
And you have only one project in hand, what about if you are contracted
for the entire British Empire ?
Examine the attached Colebrook.
In < one page maths, it solves a monster big pile of information.
More can be added for tabulation. Little modifications will solve
for as many fluids the plant will have [commonly 100's of fluids].
At the end: one page recast will produces several inches thick of
documents in no time in unit-result visible, consultable by more
than the piping design team, thinking in terms of the $ illuminatis.
Try unitless, plot something ...

Cheers ... Jean

Inst_Colebrook Pipe Data.sm (60kb) downloaded 13 time(s).


thanks 1 user thanked Jean Giraud for this useful post.
on 08/05/2019(UTC)
Offline Jean Giraud  
#8 Posted : 07 May 2019 07:08:56(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)
Think twice: 1.23456789*9.87654321= result + an empty place holder
What is the 2nd place holder for ? I know: the slipping bar for the parrot
Rather from uniless maths to validate the unit-result as desired.
Whereas the standard you are using has dimension then no need to carry units
as the standard tells what the unit-result is.
In your project, I trust you [that stuff is extraterrestrial to me].

UnitLess.PNG
thanks 1 user thanked Jean Giraud for this useful post.
on 08/05/2019(UTC)
Offline Jean Giraud  
#9 Posted : 07 May 2019 07:24:41(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)
The SS 6179 document.

Solve Given_Find [Simple Demo].sm (69kb) downloaded 42 time(s).
thanks 1 user thanked Jean Giraud for this useful post.
on 08/05/2019(UTC)
Offline Mido0  
#10 Posted : 08 May 2019 01:04:02(UTC)
Mido0


Rank: Advanced Member

Groups: Registered
Joined: 10/01/2017(UTC)
Posts: 31
Man
Canada
Location: Alberta

That Works, Thanks a lot Jean and Martin !!
Clap
Users browsing this topic
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.