Page 1 of 1

Having trouble creating functions for scientific calculator

Posted: Tue Nov 21, 2017 5:23 am
by qqchrono
Hello!

I got tasked recently to create a calculator which i have managed to create a standard one with a few basic functions... The problem comes when i tried to escalate it into a scientific calculator which is actually just adding tan,cos,sin,tan-1,cos-1,sin-1 functions (I know that's not all to a scientific calculator haha but this'll suffice). Been stuck at these functions for awhile now.
Coming from a weak maths background i tried prowling the internet for information on the formulas but could not find one with a formula that could explain it in a way i understand. Could anyone offer any input or help on this?

Thanks!

Chrono

Re: Having trouble creating functions for scientific calculator

Posted: Tue Nov 21, 2017 11:12 am
by richmond62
As tan, sine, cosine and so forth are built into LiveCode
people like You and I can "cheat", and not get all worried about the shame
of being bad at Maths at school.

Make the Dictionary your friend 8)
sine.png

Re: Having trouble creating functions for scientific calculator

Posted: Tue Nov 21, 2017 2:20 pm
by bogs
richmond62 wrote:
Tue Nov 21, 2017 11:12 am
Make the Dictionary your friend 8)
It doesn't even have to be the stock dictionary, you can make any of these your new best buddy !

*Brian's page is actually the stock dictionary, just much much _-`faster.

Re: Having trouble creating functions for scientific calculator

Posted: Tue Nov 21, 2017 2:46 pm
by [-hh]
Here is one (by MaxV). Has more features than you need.
http://livecodeshare.runrev.com/stack/7 ... Calculator

Re: Having trouble creating functions for scientific calculator

Posted: Tue Nov 21, 2017 3:00 pm
by dunbarx
Hi.

As Richmond said, all the functions you mentioned are native to LC. So my question to you is this: Did you just not know that, or are you having difficulty implementing them?

In other words, and never mind how the user interface might work, are you able to simply:

Code: Select all

on mouseup
ask "Enter angle"
if it is a number then answer sin(it)
end mouseUp
And do you know that the arguments to trig functions are in radians?

Craig Newman

Re: Having trouble creating functions for scientific calculator

Posted: Tue Nov 21, 2017 7:27 pm
by richmond62
And do you know that the arguments to trig functions are in radians?
That's stated explicitly in the dictionary.
plonk.jpg
plonk.jpg (9.12 KiB) Viewed 7191 times

Re: Having trouble creating functions for scientific calculator

Posted: Tue Nov 21, 2017 7:28 pm
by [-hh]
dunbarx wrote:And do you know that the arguments to trig functions are in radians?
Yes, I know. And I even know what radians are ;-)

Re: Having trouble creating functions for scientific calculator

Posted: Tue Nov 21, 2017 9:01 pm
by dunbarx
Ah.

Hermann is back. :)

Re: Having trouble creating functions for scientific calculator

Posted: Thu Nov 23, 2017 1:50 am
by qqchrono
richmond62 wrote:
Tue Nov 21, 2017 11:12 am
As tan, sine, cosine and so forth are built into LiveCode
people like You and I can "cheat", and not get all worried about the shame
of being bad at Maths at school.

Make the Dictionary your friend 8)

sine.png
Oh thats weird the first time i checked i only found atan, asin, acos which i have no idea what they meant. I tried looking it up in the dictionary before because i used sqrt for the calculator. :shock:

Thanks for pointing that out, will look through again.

Re: Having trouble creating functions for scientific calculator

Posted: Thu Nov 23, 2017 1:54 am
by qqchrono
dunbarx wrote:
Tue Nov 21, 2017 3:00 pm
Hi.

As Richmond said, all the functions you mentioned are native to LC. So my question to you is this: Did you just not know that, or are you having difficulty implementing them?

In other words, and never mind how the user interface might work, are you able to simply:

Code: Select all

on mouseup
ask "Enter angle"
if it is a number then answer sin(it)
end mouseUp
And do you know that the arguments to trig functions are in radians?

Craig Newman
Yes i would be able to code it. My mistake i missed the function out completely :?