Jump to content
THIS IS THE TEST SITE OF EUROBRICKS! ×
THIS IS THE TEST SITE OF EUROBRICKS!

Recommended Posts

Posted

Hello all,

I have been working on a Lego EV3 calculator recently and have incorporated quite a few functions into it.However, there are two functions I would like to add that I don't currently have. The functions that are already in it are as follows:

  1. Add
  2. Subtract
  3. Multiply
  4. Divide
  5. Exponential
  6. Square root
  7. Factorial (this was a pain to make!)
  8. Sin
  9. ASin
  10. Cos
  11. ACos
  12. Tan
  13. ATan

The two that I would like to add are an Xth root of Y function and a Log() function. If anyone knows any way I can program these blocks or any ways you have seen yourself, please post a reply!

Thanks, Jim

Posted (edited)

You can write the Xth root of any number as the number with an exponent of 1/X. You already have the exponent function, time to apply it.

Log() will also use the exponent function, this time a base number N with an exponent of X (X is your variable, N is defined once).

Edited by BusterHaus
Posted

Finding the Xth root of Y is not too difficult. If you can make an xy function, finding the xth root of y is basically doing y1/x.

As for log, there is a Log function in the Advanced section of the math block. If you want log of any number, use this: loga x = ln x / ln a. If you prefer to work with log10 instead of ln, it will work as well.

Curious as to how you did the factorial. I'm guessing it was using recursion.

Posted (edited)

You can write the Xth root of any number as the number with an exponent of 1/X. You already have the exponent function, time to apply it.

Log() will also use the exponent function, this time a base number N with an exponent of X (X is your variable, N is defined once).

Thanks, but what do you mean about the Log function?

Finding the Xth root of Y is not too difficult. If you can make an xy function, finding the xth root of y is basically doing y1/x.

As for log, there is a Log function in the Advanced section of the math block. If you want log of any number, use this: loga x = ln x / ln a. If you prefer to work with log10 instead of ln, it will work as well.

Curious as to how you did the factorial. I'm guessing it was using recursion.

Thanks, but I think the EV3 Log function is only log10 . I'll post the factorial program later.

Edited by Technic Jim
Posted

Thanks, but what do you mean about the Log function?

Logarithmic expressions are written as X to the power of N. So it's a defined number X to the power of N. Since you already have the exponent function, all you need to do is apply it to the number X.

Posted

Logarithmic expressions are written as X to the power of N. So it's a defined number X to the power of N. Since you already have the exponent function, all you need to do is apply it to the number X.

Thanks, but I'll probably use my solution.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...