#### Smallest real number which has no inverse in Matlab.

```Hello everybody.

I am trying to find a real number x so that x is the smallest
number bigger than 1 which can be represented by the Matlab but
which doesn't have an inverse which could be represented in Matlab.
Now, the smallest number t which could be added to 1 so that 1 ~= (1+t)
is 2^-52. So, I wrote the following program:

x = 1;
y = x;
while x == y
x = x + 2^-52;
y = 1/(1/x);
end
x

Obviously, that program should find the required number. The
problem is that it take a *long* time to find that number (I tried
to run the program for 6 hours on Athlon 1333, and still no success).
Is it somehow possible to find the required number quicker?

```
 0
this (338)
11/15/2006 7:33:26 PM
comp.soft-sys.matlab 208223 articles. 7 followers. lunamoonmoon (258) is leader.

2 Replies
248 Views

Similar Articles

[PageSpeed] 37
```ddtl wrote:
> Hello everybody.
>
> I am trying to find a real number x so that x is the smallest
> number bigger than 1 which can be represented by the Matlab but
> which doesn't have an inverse which could be represented in Matlab.
> Now, the smallest number t which could be added to 1 so that 1 ~=3D (1+t)
> is 2^-52. So, I wrote the following program:
>
> x =3D 1;
> y =3D x;
> while x =3D=3D y
>   x =3D x + 2^-52;
>   y =3D 1/(1/x);
> end
> x
>
> Obviously, that program should find the required number. The
> problem is that it take a *long* time to find that number (I tried
> to run the program for 6 hours on Athlon 1333, and still no success).
> Is it somehow possible to find the required number quicker?

Generally, you will always get a round off error when representing
floating point numbers on a computer. This especially the case in your
example. The inverse of x will almost allways suffer from this, and is
also depending on the standard that is used for floating point
calculations. You can't even be sure that 1/1 equals 1 exactly (even if
it does when I test it in Matlab). When comparing x with y, you should
see if the difference is below a precision limit of your choice. You
should also take a look at the eps function if you haven't done so

Regards,=20
J=F8ger

```
 0
jogerh2032 (17)
11/15/2006 7:58:11 PM
```In article <obqml21jgi6shm35bkg4mub9n93vbn3edv@4ax.com>, ddtl
<this@is.invalid> wrote:

> Hello everybody.
>
> I am trying to find a real number x so that x is the smallest
> number bigger than 1 which can be represented by the Matlab but
> which doesn't have an inverse which could be represented in Matlab.
> Now, the smallest number t which could be added to 1 so that 1 ~= (1+t)
> is 2^-52. So, I wrote the following program:
>
> x = 1;
> y = x;
> while x == y
>   x = x + 2^-52;
>   y = 1/(1/x);
> end
> x
>
> Obviously, that program should find the required number. The
> problem is that it take a *long* time to find that number (I tried
> to run the program for 6 hours on Athlon 1333, and still no success).
> Is it somehow possible to find the required number quicker?
-------------------------
I can't imagine what led you to such a problem as this, ddtl, but it
does have a definite answer, and that is the number x =
1.414213573163048743, or in matlab's format hex, 3ff6a09e6964b6ac.  I
don't wonder that your while loop wasn't finished after a mere six hours,
since it would have required some 1.865e+15 (almost two quadrillion) trips
through the loop to reach that number, starting as far back as x = 1 and

What makes a solution possible in practical terms is the fact that no
value of x below sqrt(2) can possibly fail to achieve equality of x and
1/(1/x).  To demonstrate this, start with the assumption that 1 < x < 2.
Then you can write the result of the first reciprocal as:

t = 1/x + e1

where e1 is the round off error, and where, since 1/2 < t < 1, we have
abs(e1) <= 2^(-54).  This is a guaranteed property of division with double
precision IEEE 754 numbers - that is, the round off error cannot exceed
half the value of the least bit position, which for t is worth 2^(-53).
The next step is:

y = 1/t + e2

where, since 1 < y < 2, we have abs(e2) <= 2^(-53), again because of round
off precision requirements.

Given the meaning of e1 and e2, the previous two equations are
mathematically exact equations, and we can manipulate with them as such.
Combining them gives

y = 1/(1/x + e1) + e2 = x - (x^2/(1+e1*x))*e1 + e2,

and if we multiply both sides by 2^52 and do a transpose, we obtain

2^52*y - 2^52*x = -(x^2/(1+e1*x))*(2^52*e1) + (2^52*e2)

Because the fractional parts of x and y have only 52 bits, the left side
of this last equation must be an integer, and therefore so must the right
side.  However, abs(2^52*e1) <= 1/4 and abs(2^52*e2) <= 1/2.  This tells
us that the only way we will ever get a non zero integer value for the
right side is to have the factor x^2/(1+e1*x) be greater than or equal to
2.  That in turn means that x must be at least the square root of 2 (or
within round off error of it.)

That fact being established, the only modification needed on your
while-loop method to speed things up is to start with x = sqrt(2), or to
play safe, a small amount below that.  I started with x =  1.414213562,
and let it run until it finally stopped some ten or twenty minutes later
(I forgot to time it) and arrived at the number above.

Roger Stafford
```
 0
11/16/2006 6:24:28 AM
Similar artilces about - Smallest real number which has no inverse in Matlab.:

Help from Matlab users in UK?
Hi there I am PhD student in Health Sciences exploring the application of Matlab (Statistical Toolbox) for cluster analysis with a set of data. I need some basic help to get started and would be willing to pay someone for several sessions. I would be glad to hear from users based in or near London. Regards Michael Michael, MATLAB is a very simple programming language, get any basic MATLAB book and you will be up and running in no time. "Michael D" <michael@dimov.wanadoo.co.uk> wrote in message news:ef019f7.-1@webx.raydaftYaTP... > Hi there > I am PhD student in Health ...

Smallest 4-sided polygon surrounding convex hull ( smallest convex quadrilateral)
Hello Group, I'm trying to implement an image segmentation process, and the paper I'm working from says: "Finally the smallest 4-sided polygon surrounding the segmented code [ a convex polygon ] is evaluated. This is a special case of convex hull evaluation, in which the hull is constrained to have exactly four sides. The output consists in a list of four points which are the vertices of a general polygon surrounding the code". And I can't find an algorithm for that, perhaps because I'm using all the wrong words. I believe I'm looking for the minimal enclosing...

Displaying a data number on the graph
Ok, I am re-posting as it seems I was not clear. I'm successfully plotting column 14 of a 15 columns data file made of one single block. Here is the command line: plot "TS-plus.csv" using 1:14:xticlabel(2) title "VARIANCE" with lines linecolor rgb "blue" Now I need ALSO to display on the same graph the last number of col 14, i.e. the number on top of column 14 of the data file, which is 0.5667. I need displaying only that and no other numbers. I can display all the numbers in col 14 using this command line: plot "TS-plus.csv" using...

Autoupdate field with number of related registers
Hello group In a relation one to many (i.e. Customers <--> Offers, being these two tables related by the name of the customer), how can I define a field in Customers that automatically shows the number of registers in Offers related to the same customer?; or in other words, how many offers are issued for a given customer? Thanks in advance for your advice JJ de la Vega "JJ de la Vega" <rahitoya@netscape.net> schreef in bericht news:goitmq\$g2i\$1@reader.motzarella.org... > Hello group > > In a relation one to many (i.e. Customers <--> Offers, bei...

SN#11998 Sun and Aldata Collaborate on Real-time Retailing Solution
SYSTEM NEWS FOR SUN USERS Vol 71 Issue 2 2004-01-12 Article 11998 from section "Retail" Solution Based on Sun's RFID Infrastructure Software Sun and Aldata Solution S.A. are collaborating to bring forth a solution that will allow enterprises to seamlessly link into the Electronic Product Code (EPC) Network to track the movement of goods as they pass through the supply chain. The new solution should align Aldata's G.O.L.D. software with Sun's enterprise-class RFID infrastructure software for managing EPC eve...

Converting Mathcad to Matlab M functions #2
I am trying to convert a Mathcad file and I don't know what to use as a Matlab equivalent for some of the functions. It says Comp(T,niH2,niH2O,niCO,niCO2,niCH4,niN2) := Find(a,b,c2,d,e2) It appears to rely on the rules given above to find solve the following equations. 2a + 2b + 4e2 = 2niH2 + 2niH2O + 4niCH4 c2 + d + e2 = niCO + niCO2 + niCH4 b + c2 + 2d = niH2O + niCO + 2niCO2 Kp1(T) = ad/bc2 I am a little stumped by it right now. Also there is another mathcad function that I hope to confirm T_sAir(s) := root(s-s_Tair(Tg), Tg) seems to be this in matlab: a= fzero(s-s_Tair(x),x); ...

Re: Passing a number calculated from another dataset into a new
Hi Julie, Here is a couple examples of one approach: * sample dataset A ; data A; a1=1; a2=2; a3=3; a4=4; a5=5; a6=6; a7=7; a8=8; a9=9; ppe=10; run; * sample dataset B ; data B; set sashelp.class; income = int(ranuni(0)*100000)/100; run; * apply constants with datastep ; data result1(drop=a: ppe); set B; if _N_ eq 1 then set A; new_income = income * ppe; run; * apply constants with SQL ; proc sql; create table result2 as select B.*, income * ppe as new_income from B,A ; quit; proc com...

find out name of file from "lun" unit number
Hi, I need to extract a parameter from a filename in an idl procedure. But only the lun is passed as a parameter to this procedure. Is it possible to find out the name of a file using his lun? let's say: openr, lun, 'filename', /get_lun file_name= find_file_name(lun) how to write this "find_file_name" function? Thanks a lot in advance! Antoine On Friday, January 31, 2014 9:27:24 PM UTC-5, ankorrigan wrote: > Hi, > > I need to extract a parameter from a filename in an idl procedure. > > But only the lun is passed as a parameter to this pr...

Using MATLAB Image Acquisition Toolbox with webcam in deploy mode
I wrote this simple code to just grab images and display using a webcam : cam1=videoinput('winvideo'); % we connect to a Windows web camera under name cam1 preview(cam1) Then deployed it using the deployment tools in a different machine not having MATLAB ( but installed the MCRInstaller) . However got the error : ??? Error using ==> imaqdevice.preview at 179 PREVIEW(OBJ) is not permitted in deployed mode. imaq:preview:noDeployment Anyway to rectify this problem ?? iceman2 wrote: > I wrote this simple code to just grab images and display using a > webcam : > > ...

Is It Real? Watch This Video!
Is This real, A man is showing that he made \$2.6 million online in just 9 months. Is his proof real? He is also showing his secrets in these videos. Watch Videos => http://www.MavrickMoneyMaker.com Google "Ponzi" and save your money! "man of Allah" <challengingboy29@gmail.com> wrote in message news:28afa0c5-eabc-4ae5-b355-af4fd5f9d03e@f16g2000vbf.googlegroups.com... > Is This real, A man is showing that he made \$2.6 million online in > just 9 months. Is his proof real? > He is also showing his secrets in these videos. > > Watch Video...

midi mapper to handle midi control number out?
Howdy, I am looking for a (preferable)19" mounted midi mapper device (?), that will handle: Midi in ==> and via 4 programs to send OUT ==> midi control numbers 56 - 57 - 58 & 59. Question is: Are these devices available? If so, could you please send me some names of manufacturers? Thanks in advance, Regards- daan@golden-earring.nl Motu Midi Express will do this, 8 midi in, 8 midi out, 19" one bay rack mount, has some default patches and can be used as a stand alone device, and patches can be programmed via usb by a computer. Also on the computer side, Cakewalk...

How to convert Binary to Real numbers?
Please help me..I need this How to convert Binary to Real numbers? and how to convert real numbers to Binary? if is it posible convert matrix real numbers to matrix binary. x=[0.33 0.345 0.9200322; 0 0.23302 1.0; 0.349454565 0.003439 0.000004055] Jorge wrote: > Please help me..I need this > How to convert Binary to Real numbers? > and > how to convert real numbers to Binary? > if is it posible convert matrix real numbers to matrix binary. > x=[0.33 0.345 0.9200322; 0 0.23302 1.0; 0.349454565 0.003439 > 0.000004055] help dec2bin help bin2dec Steve Irwin: <SNIP OP: rea...

Checking var is a number?
Hi, I am very new to all this and need to know how to check a variable to see if it is a number or not. Also can anyone recommend a reference book apart from dive into python preferably a reference with good examples of how to impliment code. The project i have been given to work in is all CGI written in Python. Many Thanks David Phillips dav.phillips@ntlworld.com �rta: > Hi, > I am very new to all this and need to know how to check > a variable to see if it is a number or not. Also can anyone > recommend a reference book apart from dive into python > preferably a reference...

US-NY: New York-Senior UNIX C C++ Developer-Real Time-Multithreaded-Finan #3
************************************************************** JobCircle.com - Careers, Content and Community for Technology professionals in the Northeastern United States! Jobcircle.com provides resume submission, classified searches, eLearning, hundreds of career development articles, tech news, and more to tens of thousands of Technology professionals in your area - visit us today at http://www.jobcircle.com! !!! Voted a TOP 50 Career Web Site in 2002 by CareerXRoads !!! ************************************************************** Job Title: Senior UNIX C C++ Developer-Real Time...

Real-time bitmap comparison
Hi all I am working on an application that takes periodic snapshots of the screen, which are saved when the application ends. These bitmaps are then used as a record of the user's activity and can be 'replayed' as a very simple -- and jerky (which is fine) -- movie (ok, more like a slide show... still fine). The main drawback of this approach is the waste of memory and disk space, since most images compare with there predecessors in most respects (for example, after typing a character in Word, only a very small portion of the Word window will actually have changed...

IIR Filters - Matlab's Filter
Hello. I'm running an intense simulation which applies an IIR Filter on a large amount of data. I'm using Matlab's filter function - http://www.mathworks.com/help/techdoc/ref/filter.html the problem is this procedure takes up to 60% of the running time of the Simulation. I was wondering if anyone has experience how to speed it up? Any MEX file? I need the most simple implementation - I give the Coefficients and the Data Vector. Thanks. "Royi Avital" <RoyiREMOVEAvital@yahoo.com> wrote in message <idku68\$iao\$1@fred.mathworks.com>... > Hell...

Real time webcam processing...
Hi All, I have been studying on webcam application. I have no problem about previewing of webcam.The method I used is below: **in the "main.m" file; I called the "Processingeyedetection.m" by using; setappdata(handles.image1,'UpdatePreviewWindowFcn',@ Processingeyedetection); And I want to process this video (filtering etc...) in the "Processingeyedetection.m" and used: **function ProcessLeft(obj,event,himage) %save the image into the temp to call again at the end of the program temp=event.Data; temp=rgb2gray(temp); temp = edge(I,'sobel',thresh)...

I loaded the image to MATLAB GUI, the Image (0,0) is at Top-Left corner. I would like to make it at bottom left corner. How to do it? Could you please help me? Thanks, Best Regards, Paheerathan M Paheerathan wrote: > I loaded the image to MATLAB GUI, the Image (0,0) is at Top-Left corner. > I would like to make it at bottom left corner. > > How to do it? If you are not currently using axis image then try that. If you _are_ currently using axis image, try axis equal Dear Walter Roberson, The problem is In the GUI define axis, origin is ...

top-level-assembly param 'quantity' linked to part-level param 'number' ??
Hello all, i'm looking for a way to report the number of times a part is used in my top-level-assembly on the part-drawings. I've set up a BOM reporting the quantity numbers of the parts. That works just fine. How do I get ProE to show these quantity numbers on the part drawings ? I tried adding a parameter to the parts (within a smal test assembly), and adding relations in the top-level-assembly drawing, but to no avail. Ne1 ?! ProE 2000i^2 on W2k Greetz, Speeedy Dan. ...

ping plotter via matlab
Hello, Is there a function in matlab that will log ping times of an IP address? Thanks, AMK ...

[rfc-dist] RFC 4711 on Real-time Application Quality-of-Service Monitoring (RAQMON) MIB
A new Request for Comments is now available in online RFC libraries. RFC 4711 Title: Real-time Application Quality-of-Service Monitoring (RAQMON) MIB Author: A. Siddiqui, D. Romascanu, E. Golovinsky Status: Standards Track Date: October 2006 Mailbox: anwars@avaya.com, dromasca@avaya.com, gene@alertlogic.net Pages: 38 Characters: 77341 Updates/Obsoletes/SeeAlso: None I-D Ta...

US-TX-Austin,: Firmware Developer, Real time embedded systems, C, File Systems (45337432411)
US-TX-Austin,: Firmware Developer, Real time embedded systems, C, File Systems (45337432411) ============================================================================================ Position: Firmware Developer Reference: JGG00044 Location: Austin, TX Duration: contract to possible perm Skills: BS in Computer Science/Electrical Engineering or Equivalent Experience Required: 5 years of experience Real time embedded systems High proficiency in C Strong knowledge of assembly programming ...

Name of Form Element begin with number
I have problem in retrieve a value of a form element that have name begin with a number. For example, for this HTML code <input type="text" name="0000ABC12345CD6789" id="0000ABC12345CD6789"> I got Javascript error at document.form.0000ABC12345CD6789.value Thanks. In article <9138b68.0401150955.6bde7db@posting.google.com>, vietla@juno.com enlightened us with... > I have problem in retrieve a value of a form element that have name > begin with a number. For example, for this HTML code > <input type="text" name="0000ABC1234...

Real problem with Synchronisation with DAQmx using attached code
This time I have attached the correct file!!!!!!) &nbsp; Hi &nbsp; I was hoping somebody out there may be able to check the DAQmx code I have written for synchronized Analogue input/output in my application. &nbsp; The code is supposed to run in the following manner: &nbsp; The for loop on the top left generates an array of data points to write to the AO write sub vi (the start&nbsp;voltage&nbsp;and stop voltage and number of steps in AO voltage being the parameters that determine the output of this loop. &nbsp; In the main for loop the AO output is swept according ...

Running Matlab on a remote srv
Hi all, I can't get Matlab to open interactively on a remote linux server. I get the error "no display specified; you will not be able to display graphics on the screen" message and the the "SecureCRT" window becomes Matlab command window. Does anybody know how can I get it run properly? Thanks, Elnaz On May 23, 8:35=A0pm, "Elnaz " <ebsadegh...@gmail.com> wrote: > Hi all, > > I can't get Matlab to open interactively on a remote linux server. I get = the error "no display specified; you will not be able to display graphics o...