Home>graphics>
Dealing with numbers too large for machine precision in Graphics

Dealing with numbers too large for machine precision in Graphics

March 14Hits:2

Advertisement

Graphics only supports machine precision numbers (i.e. number that can be converted to machine precision). Take for example

Graphics[Point[{0, Exp[1000.]}]]

which produces an error because Exp[1000.] is too large to be representable as a double.

What is the simplest way to deal with situations like this? Replacing all too large numbers with just some arbitrary very large machine precision number is fine, as they'll be outside the plot range anyway. I'm sure there must be some built-in function that can fix this easily.

Answers

I wonder whether I have understood your question correctly because I know you'll be aware of Clip

This is just a "draft" since points should be taken only from graphics directives with coordinates, and then filter also the Scaled or Offset coordinates.

Graphics only supports machine precision numbers (i.e. number that can be converted to machine precision). Take for example Graphics[Point[{0, Exp[1000.]}]] which produces an error because Exp[1000.] is too large to be representable as a double. What

I am currently implementing a class for a network protocol. The protocol uses a quite complex and extensive finite state machine. A pair of an event plus a state is mapped to a function, which does some work and sets the new state. As there are about

For machine-precision numbers, Mathematica uses a tolerance for comparisons, so that 1.-$MachineEpsilon==1. However, Floor does not take into account this tolerance, leading to an inconsistency: {Floor[#], # < 1., # >= 1.} &[1. - $MachineEpsilon

I'm working on some pretty intense computation in Mathematica; when my code started running slowly, I tracked the source of the problem to Exp[]. I need to exponentiate every element of a 50x500x500 array; performing the operation on a 500x500 array

I am puzzled by the behavior of Mathematica machine precision with numbers approaching zero. This manifests itself, e.g., with FixedPoint and the like. In the examples below I will use the following "service" function to take only a few values o

I have a set of 2D points with machine precision coordinates. I need to remove all duplicates. Performance is important. This is the most obvious fast solution: Union[points] Unfortunately it turns out that unlike Equal and SameQ, Union has no tolera

Is it possible to obtain the machine precision (double) version of Infinity? This is useful when using LibraryLink and C functions that accept doubles: passing Infinity raises a type error, because Infinity is a symbol. --------------Solutions-------

I thought Kahan's summation method would make a nice example for students to use to think about round-off error [W. Kahan, Pracniques: Further Remarks on Reducing Truncation Errors, Commun. ACM 8 (1965), 40]. The method is available (I surmise) throu

There are multiple ways to convert an expression to machine precision, for example: In[1]:= a = Sqrt[2] Out[1]= Sqrt[2] In[2]:= {1.a, 1`a, [email protected], SetPrecision[a,MachinePrecision]} Out[2]= {1.41421,1.41421,1.41421,1.41421} In[3]:= Precision /@ % Out[3]=

I should state that I am a Mathematica beginner but I checked the questions about machine vs arbitrary precision (such as: this one ) and I continue to have the following issue while trying to evaluate an expression: After various calculations which

I have four quantities stemming from a 4th order differential equation. I can represent these as a vector which is a product of a 4X4 matrix $$ M=\left\{v,\frac{\partial v}{\partial x},\frac{\partial ^2v}{\partial x\, \partial x},-\frac{\partial ^3v}

Consider the following InputField InputField[Dynamic[h2, If[# === Null, h2 = h2, h2 = Round[#, 0.001]] &], Number] The purpose of the second argument of Dynamic is to avoid someone entering a value with more than 3 decimal places (or emptying the fie

I'm new to Mathematica, but so far, everything seems straight forward and intuitive, which is really nice. However, I've come to use this software since I have to show a rather nasty 3x3 matrix is unitary. Initially, I set up a system to solve Conjug

I do all of my development in a virtualbox virtual machine. Copying it over and over again to an external for back-up gets tedious and I simply do not do it as often as I should. Ideally I would like to simply be able to shut down my VM, click 'backu

I want to generate a few random numbers using an LFSR. However, the LFSR output depends on the number of taps, so for a large period I use large (relative) number of bits. This causes the numbers to be as large as the period. For example, I would lik

I wrote a small perl module that dealing with PHP-ish array structures, and I'm going to release it to CPAN. I want it to be reviewed before the release about the module naming and the code itself. Could you please give me improvements? Any suggestio

It seems that in version 10.0.2 and 10.1.0, floating point numbers are truncated to only 6 digits of precision when exporting to JSON. Example: ExportString[RandomReal[1, 5], "JSON"] (* "[ 0.832049, 0.355306, 0.615313, 0.332704, 0.186309 ]&

Issue: Time Machine wants to take 60Gb, 40GB, etc. when that is not the amount of data change. I have excluded Dropbox and my VirtualBox VMs from the backup via the GUI. I tried this previously via the command line (tmutil) with no positive results (

I've an interesting doubt. Since virtual machines create a file that represents a hard disk - the so-called virtual disk -, and it usually takes 20-40GB (and even more), how does this affect a solid-state disk (SSD) life time? For example, in my case

I've defined my claim in the following way: \newtheorem{claim}{Claim} The numbering works perfectly fine, but what should I do in cases when I want to skip some numbering. That is: Claim 1: .... Claim 2: .... Claim: //just claim without numbering! Cl