Hi guys, Most of the codes for my Java applet is done.

But I couldn't figure out how do we actually convert a hand written maths formula into java programming's syntex.

Any advice and guides on this? Or what keywords u use to search the internet to find such things?

Thanks for your patience.

Math.cos()

look at the Math class.

if you are looking fot something to calculate 2*3 + 5 / (6+1)... you need to look "postfix, prefix, infix expressions...

you can also look at this thread

Member Avatar for iamthwee

But I couldn't figure out how do we actually convert a hand written maths formula into java programming's syntex.

You'll need to explain just what you intend on doing a little bit more thoroughly.

So you've got ur equasion and u want to draw the equivalent cosine graph. Is that what it is?

Or are you looking to do more complex things such as evaluating 'postfix, prefix, infix expressions' as mentioned by
tonakai.

I'd say you'll need a loop which has some bounds. Most of the time it's -2PI to 2PI. (-6.28 to 6.28). You'll then need a real-to-screen conversion formula, which will depend on your window. After all that, then just loop through and call Java's built in cos() method as Phaelax pointed out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.