Comments (7)
Hello,
All the functions are defined in class "FuncExpression".
To create a new function, first you need to extend "FuncCallback" to declare the parameters type and how you calculate the return value. Line 46-64 of FuncExpression.m is an example.
Then you need to register your function with a name you want to use. Check line 152-161, where I have registered 3 functions.
After these steps you can try to invoke your new function from the command line.
I am glad you are interested in this small tool. Feel free to write me email if you have further questions.
Regards,
Harper
from ioscalculator.
Thank you for you response,
I mean add function in calculator for calculate derivation, for example d(tan(x))/dx
from ioscalculator.
I see.
These pre-defined functions are what I called "Basic Functions", and they are managed in class "BasicFuncExpression".
In this file I have currently defined three basic function SIN/COS/LN, and you can add more functions as you like with the following steps:
- Add a new type to the enum BasicFuncType
- Modify BasicFuncExpression.m to give the result of differentiation/integration for this new function
- Modify the "calculus.lpp" and "calculus.ypp" to add new function name to the parser so that the new function can be recognized.
Hope this helps.
Regards,
Harper
from ioscalculator.
I did it, but new function do not work
from ioscalculator.
I think there is need some changes in "CalculusLexer.cpp" and "CalculusParser.cpp" and "CalculusParser.h" I tried to do, but I had no results.
from ioscalculator.
These files should be generated by flex/bison automatically. I never manually modify them.
There may be some problem with the configuration of XCODE that prevent it from recompile the lpp file. You can manually invoke flex and bison from the command line to regenerate the files, then refresh the workspace. I will check whether I can find the command I use before and send it to you.
from ioscalculator.
thank you , my email is : rashvand at hotmail.com
from ioscalculator.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ioscalculator.