Code Monkey home page Code Monkey logo

function-tree's People

Contributors

ram6ler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

function-tree's Issues

Ignore negative calculation.

I started with string normal string calculation.

Method i am using right now :

0-6=-6 and then i tries to add value in it. It will be added in negative number instead of substracting it shows -6+3=-9 as output.

Console output :
Screenshot_8

Code i've tried with it.

calculatedAmount = (startAmount.interpret()).toString();
print(startAmount);
startAmount = calculatedAmount;
print(startAmount);

Use symbol ! as factorial

Hi,
Thank you for creating this great plugin.
I am planned to add factorial function.
Example 5! -> 1 x 2 x 3 x 4 x 5 = 120
Do you have idea how to add this new function (using ! symbol) to compute factorial.
Thank you

A function wrapped in strings can be handled by this plugin

i wrote a tool on dart and now we are cutting down all the tools from frontend and putting them on backaend database.
now we are fetching these tools from api [API returns responses in string format only ].
the response came from the API is
'''BaseTool.fromFunction(
name: 'searchPatient',
description: 'Tool for searching patients based on a query.',
inputJsonSchema: const {
'type': 'object',
'properties': {
'query': {
'type': 'string',
'description':
'Patient search based on query, like name, phone number, email address, or city.',
},
},
'required': ['query'],
},
func: (final Map<String, dynamic> toolInput) async {
final String query = toolInput['query'];
try {
dynamic response = await userRepo.getPatientsBasedOnQuery(query);

      // create a list of patients
      final List<dynamic> patients = response['results'];
      final List<ViewPatientModel> patientArray = [];
      if (patients.isNotEmpty) {
        for (final patient in patients) {
          var innerModel = ViewPatientModel(
              phoneNumber: patient['phoneNumber'],
              uuid: patient['uuid'],
              display: patient['display'],
              age: patient['age'],
              gender: patient['gender'],
              id: patient['id']);

          patientArray.add(innerModel);
        }
      }
      AssistantController controller = Get.find();
      if (patientArray.isNotEmpty) {
        RaxaLoggedInAssistantModel finalModel = RaxaLoggedInAssistantModel(
            uuid: "patientList",
            value: "Here is your patients list based on your query",
            identifier: "patientList",
            viewPatientModel: patientArray);
        controller.resultAddedFromTheTool = true;
        controller.raxaAssistantLoggedInMessagesList.value.add(finalModel);

        controller.raxaAssistantLoggedInMessagesList.notifyListeners();

        controller.loadingAssistantMessage.value = false;
      } else {
        controller.resultAddedFromTheTool = false;
      }

      return jsonEncode(response);
    } catch (e) {
      assistantController.loadingAssistantMessage.value = false;
      return e.toString();
    }
  },
)'''
;

can i execute that string in a dart after assigning the string to the variable and can it be converted in executable dart code ?

Support null safety

This is a request to add support for null safety to package:function_tree.
We depend on your awesome package, so would be great to have null safety enabled.

The Dart/Flutter team already encourages publishing the migrated packages: See this blog post.

See the migration guide for details about enabling null safety.

The "log" function, is not log in base 10

I think that '' log '' does not work well, because when I use it it does the same as "ln" that is;
ln (6) = 1.791759469228055
log (6) = 1.791759469228055

This should not be the case, if ln is logarithm to base e that is fine, but log I understand that it is logarithm to base 10 and therefore it should be;
ln (6) = 1.791759469228055
log (6) = 0.77815125038364363250876679797961

Therefore "ln" works perfectly but "log" does not.

Maybe I do not use it well but I am using it as I put in the example and that way it works well for me in all calculators.

If I am not using it well I would like you to explain how to do it.

Ceil and Log function.

Functions such as ceil and floor are not working and log is returning the natural log instead of base 10.
Thanks in advance.

Negative multiplication and division

When I put
8*-5
or
9/-5

it show following error:
Unhandled exception:
#0 _StringBase.[] (dart:core-patch/string_patch.dart:260:41)
#1 _parseString (package:function_tree/src/interpreter.dart:90:17)
#2 _parseString._binaryOperationCheck (package:function_tree/src/interpreter.dart:166:9)
#3 _parseString (package:function_tree/src/interpreter.dart:198:27)
#4 _parseString._binaryOperationCheck (package:function_tree/src/interpreter.dart:165:22)
#5 _parseString (package:function_tree/src/interpreter.dart:180:23)
#6 new SingleVariableFunction (package:function_tree/src/trees.dart:57:12)
#7 StringMethods.toSingleVariableFunction (package:function_tree/src/extensions.dart:22:7)
#8 StringMethods.interpret (package:function_tree/src/extensions.dart:29:22)
#9 main (file:///C:/Users/huzai/OneDrive/Documents/GitHub/Flutter-Sec-A/Flutter/Assignments/second/test.dart:5:13)
#10 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:295:32)
#11 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

but it work fine at:
-8*5
or
-9/5

I think it is a operator adjacent problem

Still convert invalid expressions to LaTeX?

Hey @ram6ler,
first of all thank you for this great package!

I want to write a simple calculator where the input of the user gets parsed into latex in real time.
If the user didn't finish the equation yet, I would still be able to show the (until now) typed equation.
Is it possible to bypass the checking of valid expressions before parsing? (Only for parsing, not for interpreting :P)

Thank you so much in advance, and as I said: awesome package!
Keep up the good work!

Best Regards,
Louis :)

Logarithms to Arbitrary Bases & n Roots

Hi @ram6ler - thanks for creating this awesome package ✨ The functionality is amazing.

It integrates quite well with math_expressions (the string reprensentations in that package) and it supports almost all of the same functions. However, there is one missing feature we noticed.

Feature request: log(n, c) & nrt(n, c)

In math_expressions, you can define a logarithm to an arbitrary base n using log(n, c). The same goes for sqrt.

It would be great if this package would also support those and it seems relatively straight-forward:

  • log supports either log(c) or log(n, c) (not a breaking change). This would look like this when converted to TeX → \log{c} & \log_n{c}
  • sqrt supports either sqrt(c) or nrt(n, c) (also not a breaking change). This would look like this when converted to TeX → \sqrt{c} & \sqrt[n]{c}.

For the functionMap part, it should also be straight-forward:

  • log(n, c) would be (n, c) => log(c) / log(n)
  • nrt(n, c) would be (n, c) => pow(c, 1 / n)

Problem with exponential notation

When I put:
1 * 10 ^ 50
The result is: -5,376,172,055,173,529,600
When it really should be: 1e + 50
Or even if I put:
2000000000000000000*5
the result is: -8.446.744.073.709.551.616
When it should be: 10.000.000.000.000.000.000

I know that for most people it is not common to do an operation of such a large number, but it gives the feeling that when large operations are made it gives errors, it would be good if you fix it please, since I am making a calculator and I do not want him to give me errors of this type.
Also I was testing the math_expresions package and it does it well but I prefer this one as it has more options like sinh, etc ...
If you could update that would be awesome.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.