Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Power... Math power!


  • Please log in to reply
7 replies to this topic

#1 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 16 August 2010 - 05:44 PM

Alright before I go rob Einstein's brain and stuff it in my head. Does ANYONE know hoe I can calculate something like 3^2.5? I got a method for integer exponents but none for fractional ones. Any math genius here that can help?

#2 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 16 August 2010 - 06:01 PM

something like 3^2.5?

var result = System.Math.Pow(3, 2.5);

#3 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 16 August 2010 - 06:04 PM

var result = System.Math.Pow(3, 2.5);

Well I should have looked for that secret Math class, I was making one >.<

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 16 August 2010 - 06:17 PM

Quick question: .NET Micro Framework has some great math functions built in, but they are designed for low-power MCUs (so some of them are not as high of precision as their desktop counterparts). There are .NET MF source code samples out there of high-precision functions. Would you all be interested in an open source high-precision math library. If so, any math experts want to volunteer to help with the implementation? The Netduino hardware can certainly support it. Chris

#5 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 16 August 2010 - 06:56 PM

Quick question:

.NET Micro Framework has some great math functions built in, but they are designed for low-power MCUs (so some of them are not as high of precision as their desktop counterparts).

There are .NET MF source code samples out there of high-precision functions. Would you all be interested in an open source high-precision math library. If so, any math experts want to volunteer to help with the implementation? The Netduino hardware can certainly support it.

Chris

I am working on one!
I got this so far:
public static int Sin(int angle)
        {
            return Microsoft.SPOT.Math.Sin(angle);
        }

        public static long Cos(int angle)
        {
            return Microsoft.SPOT.Math.Cos(angle);
        }
        
        public static long Abs(long value)
        {
            long result;
            if (value < 0) 
                result = -value; 
            else 
                result = value;
            return result;
        }

        public static double Pow(double num, double exponent)
        {
            return System.Math.Pow(num, exponent);
        }

        public static double Root(double num, double root)
        {
            return Pow(num, (1/root));
        }

        public static double CovertToRange(double v, double inMin, double inMax, double outMin, double outMax)
        {
            return  outMin + (v - inMin) * (outMax - outMin) / (inMax - inMin);
        }

I got no comments yet since it isn't done or close to being done

#6 Solidus

Solidus

    Member

  • Members
  • PipPip
  • 12 posts

Posted 16 August 2010 - 11:39 PM

Quick question:

.NET Micro Framework has some great math functions built in, but they are designed for low-power MCUs (so some of them are not as high of precision as their desktop counterparts).

There are .NET MF source code samples out there of high-precision functions. Would you all be interested in an open source high-precision math library. If so, any math experts want to volunteer to help with the implementation? The Netduino hardware can certainly support it.

Chris

I would certainly be interested - FFT needs it :D

#7 Kamal

Kamal

    New Member

  • Members
  • Pip
  • 7 posts
  • LocationPlanet Earth

Posted 20 August 2010 - 05:20 PM

I needed to calculate arctan for a project I am working and that is not automatically available in the microframework so I found this http://www.microfram...-with-full-net/ which worked beautifully. Here is the math library class file. http://www.microfram.../file/exMath.cs

#8 krst

krst

    New Member

  • Members
  • Pip
  • 6 posts

Posted 22 August 2010 - 02:22 PM

I needed to calculate arctan for a project I am working and that is not automatically available in the microframework so I found this http://www.microfram...-with-full-net/ which worked beautifully.

Here is the math library class file. http://www.microfram.../file/exMath.cs


Works great! Many thanks!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.