Group Abstract Group Abstract

Message Boards Message Boards

How to crunch numbers in Mathematica. How to properly use it to test if a given method solves faster

Posted 1 month ago

I have been trying to factor semiPrimes for years now. I have a simple algebraic equation that gives one factor knowing only N. The only problem I have to find the value of x where y equals 1. I thought this was a simple thing, but with 200 digit numbers finding where y equals 1 on the graph takes some computation. I believe the computation is much smaller than recursive division, but factoring it is the only way to be sure.

My question is how is Mathematica on computation? If I programmed the math algorithm in Mathematica will it be as efficient as a Xeon processor crunching numbers. I have tried computations in Mathematica before and it let me know it was processing but I had no information on the processes it was going through.

And what functions in Mathematica would be used to find y equals 1 on a graph that is f(x} equals x?

Seems like it should be easy. If I were doing the calculation by hand, I would choose test values and find the derivative or slope. But to find the x value with a 200 digit number there would be many close options for x. I know there are equations to solve this but I have never used them.

So I need to know if Mathematica can handle the computational problem of 200+ digits, and if I think my method is less computational will Trurl’s method will be less computational to work in Mathematica.

POSTED BY: Bobby Joe Snyder
4 Replies

how is Mathematica on computation?

It's great. Especially in domains where it is strong.

If I programmed the math algorithm in Mathematica will it be as efficient as a Xeon processor crunching numbers.

This compares apples and oranges. A compiled, special-purpose algorithm might be beat Mathematica (possibly by a great factor), unless Mathematica already uses a compiled version of the same algorithm. Since WL is an expression rewriting system (sometimes WL is called an "interpreted" language), there is the potential for a significant speed-up in a compiled version of the same algorithm. WL can compile some codes for you. Since WL can run on many processors, comparing it to a processor it can run on doesn't make sense to me. Of course, a bad algorithm on a good processor can be a lot slower than a good algorithm in Mathematica on an ordinary processor.

Sometimes Mathematica's symbolic processing, which is arguably slower than crunching numbers, allows one to take shortcuts that make it much faster than crunching numbers.

I need to know if Mathematica can handle the computational problem of 200+ digits

It's system dependent more than Mathematica-dependent. The theoretical limit on the number of digits of a real number is around 10^15 or more. For me, on my system (Macbook M4 Max 36GB), I can get 10^10. But adding 1 and 1 with that many digits takes 150+GB, and I can do it only once. Perhaps if I set $HistoryLength to zero, I could do more. But I don't want to work that close to the system limits, so I see no point in trying it out. I can usually get by with 10000 digits or less (normally a lot less), and there's no real obstacle in doing that. For integers, it's similar, although I think there's no hard limit on how larger integers can be. Whatever the system can take. I can compute 2^(2^40). Once. If I do it twice, the kernel crashes.

POSTED BY: Michael Rogers

The symbolic solution is found easily:

Solve[1 == (((((pnp^2/x) + x^2))/x)/pnp), x]
Solve[1 == (((((pnp^2/x) + x^2))/x)/pnp), x, Reals]

I have no idea how fast it would be for number crunching.

POSTED BY: Gianluca Gorni
Posted 2 days ago

If I programmed the math algorithm in Mathematica will it be as > efficient as a Xeon processor crunching numbers?

Mathematica has a Benchmark command. You can run it on your Xeon machine and compare its results with those of other processors. If you have MMA installed on machines with other processors, you can run the Benchmark on them and compare results with those running on the Xeon machine.

POSTED BY: Mark Harder

equations for number crunching

I thought maybe it would help if I explained what I was number crunching. This link is to a few simple equations I developed to factor semiPrimes.

I need to find x where y=1 in this equation:

y = (((((pnp^2 / x) + x^2)) / x) / pnp)

I know if I was graphing f(x) there would be no problem, but I need x where y on the graph equals 1.

This is more computational complex. How do I approach number crunching in Mathematica? Will this crash?

POSTED BY: Bobby Joe Snyder
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard