Items tagged with numerics numerics Tagged Items Feed

Consider a "toy system" of floating-point arithmetic where each floating-point numberis of the form
x = (-1)s × (1 + m) × 2e-σ:


The mantissa is a binary number such that
m = 0:m1m2m3 (base 2) belongs to [0; 1)


and the exponent e is a binary integer such that
1 ≤ e = e3e2e1e0 (base 2) ≤ 14:


Each m

Hi all. This is porbably a very elementary question. Maple outputs something of the form  " X +  0. I" after a computation, where X is a number. I'm confused as to what 0. I is. My first thought is that it's 0.1 * I, but then squaring X +  0. I  gives back X^2 + 0. I instead of the expected X^2 - 0. 01 + 0.2 X I. Could someone explain to me what Maple means by that? Thanks!

X +  0. I

Hey guys, 

Its my first post, so please be lenient. I have done an internship at a theoretical physics department and part of my work was to plot a particular only numerically solvable integral over time (problem from Quantum Mechanics). I wrote a maple code and made it work, but it only produces results for certain values and even for those it takes more than one hour to plot one graph. Since this is my first big project written in maple, i assume, that the code...

numeric solution

October 16 2010 by goli 125 Maple

Hi! I have an aquation and I want to solve it numerically. How can I do that?

The equation is:

H(z)^(2*n)*(H(z)^2-K1*(1+z)^3-K2*(1+z)^4)=1-K1-K2;

where K1 = 0.27, K2 = 5*10^(-5) and n = -0.1.

Thanks a lot!

I want to fsolve one non-linear equation as follows: expr_1/expr_2=C which can not be solvable in maple directly. However, once I use expr_3=simplify(expr_1/expr_2) and then expr_3=C, it returns a result. Something weird happens now. Once I substitute the result in expr_3, it returns a value the same as C. But if I substitute the result in expr_1 and expr_2 respectively and then do a division, the outcome is dramatically different from C, which makes no sense at all. Is it...

Following the last question: After eliminating the units, the equation is still not solved. Such kind of equation is not solvable at all, even numerically? Thanks.

PS: Is it possible to edit a posted question? Sometime I want to add more information but could not edit the old one.

There is a probem in the Optimization package's (nonlinear programming problem) NLPSolve routine which affects multivariate problems given in so-called Operator form. That is, when the objective and constraints are not provided as expressions. Below is a workaround for this.

Usually, an objective (or constraint) gets processed by Optimization using automatic differentiation tools ...

dsolve, events question

July 01 2010 by scottyg3 39 Maple 12

My question is in regards to the events feature in dsolve numeric.

At a particular event time, I was wondering if it is possible to call a previous moment, that is something like

eq:={ diff(y(t),t) = y(t) };

ic:={ y(0) = 2 };

de:=dsolve( eq union ic, numeric, events=[[ t =5, [ y(t) = y( t - 2 ) ]]],range=0..10);


If it is possible to "globaly" declare previous steps of the dsolve, I believe that the above de would work. However,...

Q1) Why doesn't this subthread show up when putting MPFR in the Mapleprimes Search?

Q2) How does Maple make use of these?

> # on a system with `ls`
> system(cat("ls ","bin*/*mpfr*"));
bin.APPLE_UNIVERSAL_OSX/libmmpfr.dylib
bin.APPLE_UNIVERSAL_OSX/libmpfr.1.0.0.dylib
bin.IBM_INTEL_LINUX/libmpfr.so.1
bin.IBM_INTEL_LINUX/libmpfr.so.1.0.0
bin.SUN_SPARC_SOLARIS/libmpfr...

Is anyone aware of Maple code intended to do some of the floating-point stress tests like are done in Kahan's paranoia code? (See here.)

I realize that modern Maple claims to comply with IEEE 854, 754, etc. But I like to check some things for myself. Call me paranoid. ;)

acer

Making a dash for it

November 19 2009 by acer 6841 Maple

An attempt at question 2 of the xkcd Velociraptor Math problem (mentioned on this blog post). The parameters and events facilities of

As Demmel and others have noted, SVD is both more reliable and more expensive than QR as a method of solving rank-deficient least squares problems.

SVD is the method that LinearAlgebra:-LeastSquares will choose when the Matrix has more columns than rows (n>m), unless instructed otherwise using the optional 'method' parameter.

LinearAlgebra:-SingularValues always computes a full U and Vt. But for least squares computations, such as when n>m, this is not necessary. Including the smaller singular values may just be (re-)introducing noise. See here for more detail.

Here's a 20x2000 example, using wrapperless external calling and the SVD routine dgesvd in the CLAPACK library. The effective speedup by using the Thin SVD for that 20x2000 least squares example is about a factor of 100 (ie, 2000/20), with a similar reduction in additional memory allocation.

There have been a few posts on mapleprimes about numerically solving systems of procedures. The latest one, up until now, was this.

Here's some code to implement the method. Since the algorithm is basically very simple, I've added a few bells and whistles as optional arguments.

The essence of it is as follows. The number of procedures must match the number of parameters of each and every procedure. It does maxtries attempts at choosing a random point, and then does at most maxiter iterations. A solution is only accepted if the norm of the last change in vector (point) x is less than xtol, and if the forward error norm(F(x)) is less than ftol. The jacobian of F may be supplied optionally as a Matrix of procedures, or a method for computing the jacobian may be supplied. The methods are fdiff which only uses Maple's numerical differentiation routine fdiff, or hybrid which attempts symbolic differentiation via Maple's D[] operator and then falls back to fdiff via the nifty evalf@D equivalence.

In a comment to a Mapleprimes thread, Jacques mentioned an old suggestion of Kahan's that numerical computations should return an estimate of conditioning alongside a result.

I mentioned in this comment an approach for numerical estimation of (all) roots of a univariate polynomial with real or complex numeric coeffficients that is based upon computing eigenvalues of a companion matrix. Here below is some rough code to inplement that idea, but which also returns condition number estimates associated with the eigenvalues.

I include an example of the badly conditioned Wilkinson's polynomial. It is possible that better results could be obtained by using a Lagrange basis representation of that polynomial, but I didn't try to figure out how that would work in an analogous way. The standard Maple utility, fsolve, has no problem with this example.

This forum question led to a discussion of a bitwise magazine review that compared Mathematica 5.2 and Maple 10. In that review the author struggled to get the following numeric integral to compute accurately and quickly in Maple.

evalf(Int(BesselJ(0, 50001*x)*x*exp(I*(355*x^2*1/2)), x = .35 .. 1));

Below, I reproduce an attempt at computing an accurate result quickly in Maple. I'm copying it here because that thread got quite long and messy.

Page 1 of 1