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

Notification

Icon
Error

Login


2 Pages12>
Options
Go to last post Go to first unread
Offline Mroczak  
#1 Posted : 20 November 2018 12:45:41(UTC)
Mroczak

Rank: Newbie

Groups: Registered
Joined: 05/02/2018(UTC)
Posts: 7
Poland

Was thanked: 1 time(s) in 1 post(s)
Hello!

I have a problem with simple equation. In case of my function, f(10) is equal to 5 but there is no "dot" of such value on the graph.
Please tell me how it should look like.

Where is the dot.sm (4kb) downloaded 22 time(s).

Where is the dot.jpg

Best regards.
Mroczak

Edited by moderator 21 November 2018 14:03:40(UTC)  | Reason: Not specified

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

Offline Ber7  
#2 Posted : 20 November 2018 16:30:13(UTC)
Ber7


Rank: Advanced Member

Groups: Registered
Joined: 15/07/2010(UTC)
Posts: 437
Man
Israel
Location: Beer-Sheva

Was thanked: 520 time(s) in 288 post(s)
Just point x=10 must be drawn

Edited by user 20 November 2018 16:49:35(UTC)  | Reason: Not specified

Offline Mroczak  
#3 Posted : 20 November 2018 19:23:46(UTC)
Mroczak

Rank: Newbie

Groups: Registered
Joined: 05/02/2018(UTC)
Posts: 7
Poland

Was thanked: 1 time(s) in 1 post(s)
I think, that it is not proper solution. That "point" is already included in definition of the function, so why I should draw it manually. What in case, if the function is more complex and I don't know that there is such orphaned value in the middle of continous parts of function just from looking on the function definition. Your solution is correct in situation if we exactly know that there is such thing. It should be drawn on the graph somehow automatically, but it's not.

Best regards,
Mroczak
Offline alyles  
#4 Posted : 20 November 2018 19:41:01(UTC)
alyles


Rank: Advanced Member

Groups: Registered
Joined: 23/03/2016(UTC)
Posts: 276
United States

Was thanked: 91 time(s) in 57 post(s)
I think the issue is the auto-generated range does not include the point x=10 exactly and therefore never reaches the point where f(x) = 5. Simply allowing for some error as I've done in the attached solves the problem for me. Where is the dot (1).sm (4kb) downloaded 11 time(s).

Another option, defining the range discretely.

Where is the dot discrete.sm (6kb) downloaded 17 time(s).

Edited by user 20 November 2018 19:44:54(UTC)  | Reason: Not specified

Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline Mroczak  
#5 Posted : 20 November 2018 20:12:09(UTC)
Mroczak

Rank: Newbie

Groups: Registered
Joined: 05/02/2018(UTC)
Posts: 7
Poland

Was thanked: 1 time(s) in 1 post(s)
From your example it follows, that there is a problem on the level of logical operators - you had to manually insert error what should be done by choosing 'lower' and 'higher' instead of 'lower or equal' and 'higher or eqal'. It looks like, that in such function there is no difference between operators 'lower' and 'higher' vs 'lower or equal' and 'higher or equal'. For me, it should't work this way and it seems to be some kind of 'bug'. At least your idea works as problem workaround, but unfortunately it is still only workaround. Thank you for your answer!

Best regards,
Mroczak
Offline Davide Carpi  
#6 Posted : 20 November 2018 21:09:48(UTC)
Davide Carpi


Rank: Advanced Member

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

Was thanked: 1329 time(s) in 875 post(s)
Originally Posted by: alyles Go to Quoted Post
think the issue is the auto-generated range does not include the point x=10 exactly and therefore never reaches the point where f(x) = 5


That's part of "the point". The function has to be drawn on the canvas, thus it is calculated for each pixel, and each pixel correspond to a value that depends on the range (first and last values visible), and even on the number of pixels (the width of the canvas).

You can figure it easily placing a breakpoint in the plot placeholder and looking at the values of x.

2018-11-20 19_07_51-SMath Studio - [Where%20is%20the%20dot.sm_].png

You must be very lucky to hit exactly 10.000000000000000 (15 digits)

Edited by user 20 November 2018 21:17:53(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 frapuano  
#7 Posted : 20 November 2018 21:10:32(UTC)
frapuano


Rank: Advanced Member

Groups: Registered
Joined: 01/08/2010(UTC)
Posts: 115
Man
Italy
Location: Rome

Was thanked: 13 time(s) in 13 post(s)
Peter,

the issue -in my modest opinion - is only on the plot side; your definition of the function and its discontinuity works fine and the value f(10) is evaluated correctly ..but plotting a function with discontinuity requires a discontinuity analyzer i.e. you need ( I mean the developer of the 2d Plot that I guess is Andrey ) to develop a module that find the discontinuities , analyze them and behaves accordingly ( these are at least of 3 different types for functions of one variable ) and this is not so easy to handle.
This remembers me 40 years ago when on a Sperry Univac I had to develop in fortran by myself something to plot correctly the angular patter of the radiation scattered when a laser beam is sent in a spray of fuel droplets, this produces at some particular angles rainmbows so discontinuities in the pattern that created many troubles to the offline plotter I were using at the time, took me a lot of effort ( and euristics ) to analyze and try to solve this issue.

Best regards

Franco
Offline Jean Giraud  
#8 Posted : 20 November 2018 22:14:02(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: Mroczak Go to Quoted Post
I have a problem with simple equation. In case of my function, f(10) is equal to 5 but there is no "dot" of such value on the graph.
Please tell me how it should look like.

Your setup is not correct. Once in a while, undefined condition(s) do not reflect.
In very rare instances, it's the other way around, i.e: one of the condition must
be undefined wrt the algorithmic suite [typical => De Boor spline point].

Where is the dot discrete.sm (7kb) downloaded 25 time(s).

if_otherwise.PNG

Offline alyles  
#9 Posted : 21 November 2018 00:46:02(UTC)
alyles


Rank: Advanced Member

Groups: Registered
Joined: 23/03/2016(UTC)
Posts: 276
United States

Was thanked: 91 time(s) in 57 post(s)
Originally Posted by: frapuano Go to Quoted Post

the issue -in my modest opinion - is only on the plot side


Yes and no. You cannot really expect the program to know to evaluate/plot at a specific point for any arbitrary function. Additionally as shown in the figure below one can produce "incorrect" results by exploiting the fact that we're performing calculations on a discrete system.

It may seem like the plot "should" be able to detect an infinitesimal point at x=10, but what if we redefined it for x=pi or any arbitrary number. It becomes very difficult to find that single point discontinuity in the function.

I think in an instance like this, the user needs to either add some "fudge-factor" to the function or define the range manually to include the point(s) in question.
Untitled.png
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline Razonar  
#10 Posted : 21 November 2018 01:56:45(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: alyles Go to Quoted Post
Originally Posted by: frapuano Go to Quoted Post

the issue -in my modest opinion - is only on the plot side


Yes and no. You cannot really expect the program to know to evaluate/plot at a specific point for any arbitrary function.



Hi. Yes, you can. With the normal issues for symbolic or numeric manipulations. And as frapuano talk, in some moment we need to implement some code for handle singularities. As an example, maybe too much specific, but about finite jumps, you can see
https://en.smath.info/fo...f_postst14910_Round.aspx and the implementation of discontinuous plots in round.sm (70kb) downloaded 67 time(s).

Maple have following functions, but need readlib for the following two:

Clipboard03.gif

Clipboard01.gif

Also can use this option for plots:

Clipboard06.gif

Best regards.
Alvaro.

Edited by user 21 November 2018 03:02:06(UTC)  | Reason: Not specified

Offline alyles  
#11 Posted : 21 November 2018 07:29:12(UTC)
alyles


Rank: Advanced Member

Groups: Registered
Joined: 23/03/2016(UTC)
Posts: 276
United States

Was thanked: 91 time(s) in 57 post(s)
Originally Posted by: Razonar Go to Quoted Post


Maple have following functions, but need readlib for the following two:


Alvaro.


I see your point. I found a piecewise plotting example with removable discontinuity in maple here (need to scroll down).

A couple points to note. Generally, I don't think something like fdiscont would work for piecewise functions with single point discontinuities or perhaps even jump continuities. It mentions issues with these in the description.

I notice that both Maple and Matlab have "piecewise" functions. I assume that in those environments the "piecewise" functions may be an indicator to the "plot" function that specific conditions exist for which the function needs to be evaluated. Therefore the plot function will evaluate the boundary conditions.

Perhaps in SMath something similar could be implemented s.t. when a function is passed into the plot and it is specified as a piecewise function, it will evaluate any conditions specified within the range that aren't part of the auto-generated range.

I'm not certain if it's necessary to indicate that a function is intended to be piecewise continous within SMath or if SMath is smart enough to determine intent by the structure of the function itself. I do not think, generally, any function with conditionals can be considered piecewise, but I'm not sure if that's true.

Edited by user 21 November 2018 07:36:48(UTC)  | Reason: Not specified

Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline Jean Giraud  
#12 Posted : 21 November 2018 07:37:40(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: Mroczak Go to Quoted Post
Please tell me how it should look like.

Answer @ post # 8. Conditions are either true/false... Not maybe YES/maybe NO.

AdAbsurdum.PNG

Offline Razonar  
#13 Posted : 21 November 2018 11:13:04(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: alyles Go to Quoted Post


I'm not certain if it's necessary to indicate that a function is intended to be piecewise continous within SMath or if SMath is smart enough to determine intent by the structure of the function itself. I do not think, generally, any function with conditionals can be considered piecewise, but I'm not sure if that's true.


Hi. The only "true" piecewise function is Dirac's delta ... and it's a distribution, not a function. In maple you can convert from if's or some other to piecewise or step functions with 'convert', and in matlab (mupad, actually) with 'coerce'. Numeric or symbolic procedures for handling discontinuous plots have a lot of issues, and only works for "normal" functions, if not, think about how to implement procedures for plot x/sin(1/x) near zero.

But answering your question, my guess is not: assume that you implement an amazing routine for say that a number is rational or not (and then irrational: mathematica have something like that, or at least Wolfram think this). And then construct this function, and see this unusual, for say something, property

Clipboard08.gif

Best regards.
Alvaro
Offline Jean Giraud  
#14 Posted : 21 November 2018 19:04:22(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: alyles Go to Quoted Post
I'm not certain if it's necessary to indicate that a function is intended to be piecewise continous within SMath or if SMath is smart enough to determine intent by the structure of the function itself. I do not think, generally, any function with conditionals can be considered piecewise, but I'm not sure if that's true.

Mon ami, your point is SO fundamental
Those things appeared ad-nauseum in Mathsoft Collaboratory.
Mathcad up to 11, was a bit more understanding, but wrong by principle
because confusing because not telling the truth. A piece-wise function
MUST be specified completely. On that, Smath is absolutely correct.

There are other things under the hood related to this discussion:
Integration of erf(x), and Gamma(x), the integrand must be vectorized.
Indirectly, it kind of depends upon of discontinuous approximation
of these two functions, the only two I have detected.

Most/most important about discontinuous is the major difference between
if/else and if/otherwise. Generally, they do the same but they aren't.
EXPLAIN: if/else is not scalar and it will not integrate a completely
specified if/else function. On the other hand, if/otherwise is scalar
thus will integrate. They both plot the same to add to the confusion.
Demonstrated => Integrate Discontinuous [Nuance].
Demonstrated => Where is the Dot Discrete.
It may even be more important if the path of integration is discontinuous.

Jean

Where is the dot discrete.sm (20kb) downloaded 20 time(s).
Integrate Discontinuous [Nuance].sm (25kb) downloaded 17 time(s).

Offline oscampo  
#15 Posted : 22 November 2018 18:56:46(UTC)
oscampo


Rank: Advanced Member

Groups: Registered
Joined: 10/12/2009(UTC)
Posts: 246
Man
Colombia
Location: Cali, Colombia

Was thanked: 85 time(s) in 65 post(s)
Originally Posted by: Mroczak Go to Quoted Post
Hello!

I have a problem with simple equation. In case of my function, f(10) is equal to 5 but there is no "dot" of such value on the graph....


In a more compact form you can view no discontinuities

Captura de pantalla 2018-11-22 a la(s) 10.54.01 a. m..png
thanks 1 user thanked oscampo for this useful post.
on 22/11/2018(UTC)
Offline frapuano  
#16 Posted : 22 November 2018 21:34:31(UTC)
frapuano


Rank: Advanced Member

Groups: Registered
Joined: 01/08/2010(UTC)
Posts: 115
Man
Italy
Location: Rome

Was thanked: 13 time(s) in 13 post(s)
...It would be interesting to know why it works this way Umnik , just for sake of understanding; looks to me that the merging of several OR operations should be linked to this different (... and positive )behaviour.

Best regards

Franco
Offline Davide Carpi  
#17 Posted : 22 November 2018 21:54:18(UTC)
Davide Carpi


Rank: Advanced Member

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

Was thanked: 1329 time(s) in 875 post(s)
Originally Posted by: frapuano Go to Quoted Post
...It would be interesting to know why it works this way , just for sake of understanding; looks to me that the merging of several OR operations should be linked to this different (... and positive )behaviour.

Best regards

Franco


They behave the same way; in the first post the plot was made with "Graph by points" enabled.

Edited by user 22 November 2018 22:00:44(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 frapuano  
#18 Posted : 22 November 2018 23:29:35(UTC)
frapuano


Rank: Advanced Member

Groups: Registered
Joined: 01/08/2010(UTC)
Posts: 115
Man
Italy
Location: Rome

Was thanked: 13 time(s) in 13 post(s)
Strange I had the idea that the graph in the first post was not with "Graph by points" enabled, I am starting to have more issues with my eyes than it was supposed to be.

Best regards

Franco
Offline Jean Giraud  
#19 Posted : 23 November 2018 07:32:02(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)
The same plot in Mathcad will shows no apparent break @ 5.
Mathcad plots on ½ pica thus plots straight lines, thus not fine/pleasant look.
Smath plots on pixel thus the discontinuous were there is no ½ pixel.
A scalar function is a function that runs on a vanishing iterator 'x' .
Smath does not calculate ln(,), exp(,) ... it fetches from Windows.
Most if not all functions are approximations of 21 decimals.
i.e: Normalized Padé Rational Fractions.
Result may be only 18 Decimals. Thus, by convention results are
truncated to 15 decimals. Symbolic Engines is another story.
High accuracy Main-Frames may run Chebyshev of very high numerical
stability 25 decimals [typical Clenshaw ...]
Normalized Rational Fraction approximates on various best range wrt
to minimal arithmetic operations. Each function has its own specific range
generally very small. More numerical maths kind of scale the base range
to accommodate the 'x' of greater value than the base approximation,
naturally up to the max of the result < 10^307.
Before the event of rational approximations the first IBM used
continued fraction for the principal ln(x), exp(x), sqrt(x) ...

Can't help more about unknown math suite/use of the proposal.

scalarNOTscalar.PNG
Offline Jean Giraud  
#20 Posted : 23 November 2018 07:42:43(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: Jean Giraud Go to Quoted Post
math suite ...

...in the if/otherwise '5' has no meaning.
Backspace to delete 5, type ".

Users browsing this topic
Guest
2 Pages12>
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.