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 Sparweb  
#1 Posted : 15 April 2019 08:45:35(UTC)
Sparweb

Rank: Newbie

Groups: Registered
Joined: 25/11/2018(UTC)
Posts: 6
Canada

I am troubleshooting a Smath roots() function that won't solve.
I've tried it a number of ways, but all I get are new ways to express the error.

Attached is a screen-capture of the page:
Solve_Smath_1.PNG
test.sm (17kb) downloaded 13 time(s).

In this case, the roots() function gives an error about the units, however I have confirmed that the units are fine by:
a ) removing the units in Smath to discover a new error ("no real roots" )
b ) re-typing the whole thing into MathCad and getting a solution with the right answer.

This problem came up in another document written in Smath, where it came up with a different error expression "above max allowed positive number".
I cut out and isolated this part in a separate sheet to diagnose the problem, but everything I do just creates different errors.

I'd like to ask for your thoughts on how this can be re-written to ensure Smath can solve it.
I have reviewed the wiki for ideas but nothing jumps out at me.
For those who are curious, here is the Mathcad 13 version that works:
test1.xmcd (68kb) downloaded 7 time(s).

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

Offline ndtma  
#2 Posted : 15 April 2019 10:08:54(UTC)
ndtma


Rank: Advanced Member

Groups: Registered
Joined: 05/06/2014(UTC)
Posts: 348
Man
Sri Lanka
Location: Colombo

Was thanked: 124 time(s) in 82 post(s)
Hi,

Removing all units gives the correct answer.

Roots Error.jpg

test_R1.sm (76kb) downloaded 19 time(s).
Look within!... The secret is inside you.
Best Regards
Eng. NDTM Amarasekera - Sri Lanka
thanks 1 user thanked ndtma for this useful post.
on 15/04/2019(UTC)
Offline Jean Giraud  
#3 Posted : 15 April 2019 14:01:13(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: Sparweb Go to Quoted Post
creates different errors.

Common to get different error messages depending upon where it is in the kernel.
Good practice to never use units, unless they match [sometimes].
You are using roots, as applicable a very robust solver, solves on the canvas !
The X, Y directions canvas are unit-less ... is it ?

Integral 0000000 Transit-Units.sm (24kb) downloaded 19 time(s).
Inst_Mach Number Pitot [PUBLISH].sm (32kb) downloaded 15 time(s).

Offline ndtma  
#4 Posted : 15 April 2019 14:10:46(UTC)
ndtma


Rank: Advanced Member

Groups: Registered
Joined: 05/06/2014(UTC)
Posts: 348
Man
Sri Lanka
Location: Colombo

Was thanked: 124 time(s) in 82 post(s)
Solving with units using "FindRoot" function.

test_with units.sm (22kb) downloaded 35 time(s).

FindRoot.jpg
Look within!... The secret is inside you.
Best Regards
Eng. NDTM Amarasekera - Sri Lanka
thanks 2 users thanked ndtma for this useful post.
on 15/04/2019(UTC),  on 15/04/2019(UTC)
Offline Sparweb  
#5 Posted : 15 April 2019 19:39:37(UTC)
Sparweb

Rank: Newbie

Groups: Registered
Joined: 25/11/2018(UTC)
Posts: 6
Canada

Using units in calculations is a VERY IMPORTANT feature of Smath to me. I would not use Smath without them.

Hello NDTA,
Thank you for looking at this.
Your efforts to incorporate units into your second example are not currently working on my machine - probably a problem at my end.
I will check first that I am caught up with my software updates before saying any more. I just want to thank you as soon as possible.

Jean,
Thanks to you too.
I usually don't get much from calculations outside my field of expertise like the first sheet you posted, but your second worksheet certainly is and it looks really good!
Are you showing me these to suggest the "eval()" function? I will look more closely later.
Offline Jean Giraud  
#6 Posted : 15 April 2019 20:19:21(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: Sparweb Go to Quoted Post
Jean,
Thanks to you too.
I usually don't get much from calculations outside my field of expertise like the first sheet you posted, but your second worksheet certainly is and it looks really good!
Are you showing me these to suggest the "eval()" function?I will look more closely later.


eval(∫(el(U,i))) ... eval(,) is the rule to accelerate the discretizer.
Sometimes is shows no effect in cases the function being discretized
is greedy [some are damned greedy !]
The other case of eval(,) is encountered when you recast a long function
typically parametric function(s) ... MyFunction(x):=eval(monsterbig)
In this case, eval(,) has the virtue of setting the kernel once for all
and naturally in the Smath executable kernel.
Another instance of eval(,) is wrt program.

Have a good day ... cheers [Jean]
Offline mkraska  
#7 Posted : 16 April 2019 02:15:09(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)
Here is a Maxima-based solution with units and with no guess required.

The system is very much the original one except for the use of 'q.o instead of q.o. This allows for better result formatting (works with numeric evaluation).


test-units.png
test-units.sm (19kb) downloaded 16 time(s).
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Jean Giraud  
#8 Posted : 16 April 2019 02:17:32(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: Sparweb Go to Quoted Post
Are you showing me these to suggest the "eval()" function?

Read carefully the observations. There are more remarkable applications
of eval(,) in other form of discretizer. This Smath document is good
piece of work of using properly Smath [Maya the Bee]
Like Maya the Bee: so much from so little for free !

Cheers ... Jean

Integrate Compendium_00 PRECIOUS Concept ArcSQRT.sm (26kb) downloaded 17 time(s).
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.