HP17BII+ - Help with writing Solve Equations...!



#9

I have recently bought a 17BII+, superb(having owned a 10B since about 1994). I am grappling with writing a solve equation to calculate net income (after tax) by entering the gross income (before tax). The problem is UK tax has tiers at different rates, for instance 0-£5225 is 0%, next tier is £5226-£7545 at 10% and the next £7546-£39825 at 22% with everything above £39826 at 40%.

This has meant that it appears to be a lengthy formula using 'IF' and lots of parentheses. I have tried countless variations and the machine keeps saying "Invalid Equation". Any help/ thoughts please.

Many thanks

Will


#10

My first thought is to check that your left and right parentheses match.

Any chance of posting your code?

#11

Will, how about this:
NET=G*IF(G<5225:0:IF(G<7545:.1:IF(G<39285:.22:.4)))


#12

Hi Will,

One method is to calculate the net income at each of the full steps and then add on the amount of net income at the highest bracket. A solver equation to do this is:

I=IF(G>39825:
32491.4+0.60*(G-39825):
IF (G>7545:
7313+0.78*(G-7545):
IF (G>5225:
5225+0.90*(G-5225):
G)))

Bill

#13

Actually, I guess that would show tax, not net income. Try this instead:

NET=G*IF(G<5225:1:IF(G<7545:.9:IF(G<39825:.78:.6)))


#14

Don, I think you are not "slicing" the income correctly. Each tear has its own tax rate. So, if your income is high enough, all tax rates come into play. Since the values for all tears but the highest applicable are constant, these values can be precomputed, as Bill shows in his equation.


#15

I think this may be what is required as it slices up the salary.

INC=G
-0.10*IF(G>5225 AND G<7546:G-5225:IF(G>7525:7545-5225:0))
-0.22*IF(G>7545 AND G<39826:G-7545:IF(G>39825:39825-7545:0))
-0.40*IF(G>39825:G-39825:0)

I do hasten to add that I wrote this in Notepad and will try it later on my HP17BII+ when I finish work. A refinement would be to use L and G to fix the tax bands for when they change on a periodic basis.

Chris

Edited out some extra minuses and formatted!

Update. I have keyed it in and it does work as expected.


Edited: 3 Mar 2008, 12:37 p.m.

#16

I see what you mean. Yes, you are right. The US does it differently.


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP50g: Writing a function that returns a function Chris de Castro 2 2,072 12-10-2013, 06:49 PM
Last Post: Han
  Writing RPL programs on OS X Sean Freeman 18 5,069 11-30-2013, 03:59 PM
Last Post: Sean Freeman
  [HP Prime] Tips for Solving Differential Equations More Efficiently Chris Pem10 8 2,833 11-21-2013, 08:25 PM
Last Post: Chris Pem10
  XCas / Prime "solve" question Nigel J Dowrick 4 1,957 11-08-2013, 04:01 AM
Last Post: Nigel J Dowrick
  [HP-Prime] - Shortcuts for program writing Jean-Michel 4 1,895 11-01-2013, 07:55 AM
Last Post: Jean-Michel
  Using the Prime to solve for eigenvalues Michael de Estrada 28 8,362 10-27-2013, 07:21 AM
Last Post: Tarcisi C
  HP Prime Define: Use with solve, etc. Helge Gabert 0 991 10-23-2013, 06:24 PM
Last Post: Helge Gabert
  HP 34s solve f'(x)=0 Richard Berler 8 2,537 10-07-2013, 03:03 PM
Last Post: Dieter
  HP Prime Solving Nonlinear System of Equations for Complex Results Helge Gabert 11 4,121 09-30-2013, 03:44 AM
Last Post: From Hong Kong
  Good puzzle for kids to solve on 35s? snaggs 11 3,312 09-18-2013, 10:40 PM
Last Post: David Hayden

Forum Jump: