Recent content by Zurtex

  1. Z

    BASH: How do I grep on a variable?

    Oh that's cool, I'll try it out :smile: I also got another solution: bookfile=$(cat books.csv) printf "%s\n" "$bookfile" | grep -i horror
  2. Z

    BASH: How do I grep on a variable?

    Hi, I've been running code which very frequently calls books.csv. e.g: grep -i horror books.csv > temp Except, I'm trying to move away from using temporary files or frequently calling books.csv to improve efficiency. So I tried something like bookfile=$(cat books.csv) grep -i...
  3. Z

    C/C++ Inputting an array in to a function or returning an array? (C++)

    Thanks! I've not programed in C++ in about 2 years. I did forget about ^ (goes and looks up what the exponential is). I have absolutely no insistence in using standard arrays, I'll go and look up whatever "std::vector" is :smile:. P.S The idea of the first function is that it takes the...
  4. Z

    C/C++ Inputting an array in to a function or returning an array? (C++)

    I recently came up with a bit of a mathematical problem for myself and decided I needed a bit of code to help me. My understanding of C++ is pretty basic and I seem to have found myself stuck mixing arrays and functions. I wrote the function: int worko (int c[], int tri) { //turns...
  5. Z

    Mathematical Reasons Why You Cannot Divide by 0

    I know you can define a field like that, but I was always taught to define a field by these: http://mathworld.wolfram.com/FieldAxioms.html Where devision is defined through the multiplicative inverse, the Field Axioms then imply division by 0 isn't possible because 0 has no multiplicative...
  6. Z

    Mastering Indefinite Integration: Tips for Solving (sin(x))/x Without Tricks

    It has no elementry solution. There is a function however called SinIntegral(x) that is defined by this very integral: http://mathworld.wolfram.com/SineIntegral.html
  7. Z

    Mathematical Reasons Why You Cannot Divide by 0

    I know it's true just to say "division isn't defined for 0", I'm not arguing otherwise. My quible, if any, was to do the the analogy: 'your question is like asking why we use the word "blue" to decribe light with a wavelength of 465 nm.' The reason it's called blue is arbitrary, we could...
  8. Z

    Mathematical Reasons Why You Cannot Divide by 0

    To be fair that's not entirely true. While you can look it that way, just dryly, saying that "because that's the way it's defined". A more interesting way to look at it is to consider the Field of real numbers, which have a certain set of properties that must obey. Then it's non-trivial to...
  9. Z

    What's the formula for calculating large exponents?

    Reducing it down to the results rather than the calculations: 16^198 = 16^(2*3^2 * 11) 16^(2*3^2*11) = (-4)^11 =-2^22 2^22 = 4 16^(198) = -4 -4 is the same as 96, mod 100.
  10. Z

    What's the formula for calculating large exponents?

    Well I didn't use a calculator :P But yeah, it looks like you have to do some clever modular arithmetic, it'd pretty easy mod 10, mod 100 or perhaps even mod 1'000 by hand, but it's a bit of a pain mod 1'000'000. I'll think on a bit and see if I come up something (certainly nothing that...
  11. Z

    What's the formula for calculating large exponents?

    Why would it take an enormous amount of time to evaluate? Just multiply it out... 260469313784369307581244210575049132700967121965465162515478820772032704602251252793805945346545089482145699632555985954917531314614037698451693595794... (Edit I've removed the last load of digits not to make it...
  12. Z

    Find a function f(z) such that f(f(z)) = exp(z)

    As mentioned earlier, I thought it might be a good idea to try the taylor series approach. However unfortunately this quickly breaks down, I tried to approach it my doing this: fn(x) = a0 + a1x + ... + anxn Then we have: fn(fn) = g0(a0, a1, ... , an) + g1(a0, a1, ... , an)x + ... + gn-1(a0...
  13. Z

    Patterns in Matrices: P^n and S^n Calculations

    Yeah, I worked them both out pretty quickly, just trying to help you along rather than give the answer. I don't know how else to help you without just saying the answer :/
  14. Z

    Patterns in Matrices: P^n and S^n Calculations

    Well it's the same princaple, if you get a summation form in each of the element, you've worked out what it is, more over you may be able to put it in a closed form if you understand how to do the summations.
  15. Z

    Find a function f(z) such that f(f(z)) = exp(z)

    No, I don't think it makes sense either. I tried a tayloer series before but did it with a full infinite series, I like this method a lot, keep trying it for larger and larger terms, will try it later when I have time to mess about with it. Perhaps only bother trying to approximate it for...
Back
Top