I checked the "Questions that may already have your answer" and didn't really find what I need.

It's actually pretty basic. I want to solve an equation manually with Regula Falsi. I dont need a function that does it by itself.

Here is my input:

f[y_] := sin[y] - y/2

x[0] = Pi
x[1] = Pi/2

x[n_] := (x[n - 2]*f[x[n - 1]] - x[n - 1]*f[x[n - 2]])/(f[x[n - 1]] -
f[x[n - 2]])


So you can see it is pretty basic.

I should be able to calculate for every n, right? I should make the recursive calls and give me a solution. But NSolve just gives me..

{{sin[π/2] -> -1.77622, sin[π] -> -3.55244}}


NSolve::infsolns: "Infinite solution set has dimension at least 1. Returning intersection of solutions with (151145\sin[[Pi]/2])/110742- (17791\sin[[Pi]])/18457 == 1."

I can't really figure this error message out.

So this was my first question ever here. I got a very fast solution, thanks again. I cant upvote yet, because i am new here. But i managed it that my first question, gets downvoted. thanks a lot. its always very easy to be a beginner in something. Well i want to be a positive part of the community. So if someone could explain to me what i did wrong i probably could do it better next time.

my thank you in advance got edited away. Now my question sounds rude.

Again, Thanks for the fast answer, and i hope i get to know what i did wrong.


closed as off-topic by dr.blochwave, Öskå, Yves Klett, Daniel Lichtblau, Bob Hanlon Dec 13 '15 at 22:05

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – dr.blochwave, Öskå, Yves Klett, Daniel Lichtblau, Bob Hanlon
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ For starters, sin should be Sin. $\endgroup$ – bill s Dec 13 '15 at 17:35
  • $\begingroup$ oh wow... and there it beginns... $\endgroup$ – Marcel Dec 13 '15 at 17:39
  • $\begingroup$ okay well now i get absolutely no solution. just nothing $\endgroup$ – Marcel Dec 13 '15 at 17:40

A couple of syntax errors: in particular, you don't want NSolve, you just want the recursion. For example:

f[y_] := Sin[y] - y/2;
x[0] = Pi;
x[1] = Pi/2;
x[n_] := x[n] = (x[n - 2]*f[x[n - 1]] - x[n - 1]*f[x[n - 2]])/
         (f[x[n - 1]] - f[x[n - 2]]);


(4 π)/(4 + π)

To see more, I suggest changing from symbolic to numeric:

x[n_] := x[n] = N[(x[n - 2]*f[x[n - 1]] - x[n - 1]*f[x[n - 2]])/
         (f[x[n - 1]] - f[x[n - 2]])];

Now you can look at a bunch of answers:

Table[x[i], {i, 2, 7}]

{1.7596, 1.932, 1.89242, 1.89543, 1.89549, 1.89549}

You see that it's converging, and that this will cause problems after a while because of the denominator.

  • $\begingroup$ THANKS A LOT, really! thanks, i can finally finish up this RegularFalsi thingy.. Thanks! $\endgroup$ – Marcel Dec 13 '15 at 17:45
  • $\begingroup$ sooo... why does he give me a huge fraction? i mean, i know what it means but why do you get so beautiful numbers and me not D: $\endgroup$ – Marcel Dec 13 '15 at 17:51
  • $\begingroup$ @bill So as far as i understand, the N makes is numeric instead of symbolic, that should give me a numeric solution right? So if i put the N in the function like you do, mathematica uses it as a variable. When i put square brackets after the N it actually changes the output, the fraction has values in it now, but it is still a fraction. What you have done here is exactly what i need. but something isnt right, or i am not smart enough. do you know what could be the problem? ..got it, put the N[] into Table[]. thanks bill $\endgroup$ – Marcel Dec 13 '15 at 18:03
  • $\begingroup$ @Öskå I am sorry what is the problem? I actually think this is to be meant to solve my case, thats kinda the way cause i asked.. Thanks for your very very helpful comment. $\endgroup$ – Marcel Dec 13 '15 at 18:08
  • 2
    $\begingroup$ Ok, cool down everyone. Marcel, welcome to the site. We hope you continue to get value out of it and out of the Wolfram language/ Mathematica application. Please understand, though, that the users of this site are volunteering their time and it can be frustrating to see people barge through with very basic syntax errors time after time. I have sympathy with the difficulties of not being a native speaker, but I also know that in that situation, the answer is to take more care before acting. To start, have a look at mathematica.stackexchange.com/a/18395/8 for some tips. $\endgroup$ – Verbeia Dec 13 '15 at 22:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.