Math problems

Everything not related to Prince of Persia should be discussed here.

Moderator: English Moderator Team

User avatar
Coco
Beylerbey
Beylerbey
Posts: 63
Joined: February 1st, 2013, 3:58 pm

Math problems

Postby Coco » May 21st, 2017, 11:20 pm

Does anyone here have a good knowledge of mathematics? I need some simple help for understanding few things about trigonometry and integration.

David
The Prince of Persia
The Prince of Persia
Posts: 1362
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Math problems

Postby David » May 27th, 2017, 12:03 pm

I might be able to help you.

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 2979
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: Math problems

Postby Norbert » May 27th, 2017, 7:54 pm


User avatar
Coco
Beylerbey
Beylerbey
Posts: 63
Joined: February 1st, 2013, 3:58 pm

Re: Math problems

Postby Coco » May 28th, 2017, 12:51 am

Difficult to explain, so I've made these pics in attachment.

One is integration problem. Given the function values, how would you determine the function, and how would you calculate the grey surface area using calculus. (I know it's an obvious circle, but I need calculus method).

Second pic represents my basic not-understanding of trigonometric functions. It's all clear with right angeled triangle, but what are sin(), cos(), and tg() functions (triangle sides relation) when all angles are different, and none is 90 degrees angle?

in right angle triangle, an angle between adjacent and hypotenuse side (lets call it alfa) is sin(alfa)= opposite side/hypotenuse. But what if my triangle is like in the picture? Mind that:

a != b != c

and that:

A != B != C

Thx

EDIT:
actually, the angle is arcsin(alfa) [or 1/sin(alfa)], but you get the point...
Attachments
trig.jpg
trigonometry prob
int.jpg
integral prob

David
The Prince of Persia
The Prince of Persia
Posts: 1362
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Math problems

Postby David » May 28th, 2017, 11:05 am

(Say, is this your homework or something?)

Coco wrote:One is integration problem. Given the function values, how would you determine the function, and how would you calculate the grey surface area using calculus. (I know it's an obvious circle, but I need calculus method).

To get the function, you need the equation of the circle: https://en.wikipedia.org/wiki/Circle#Equations
And then transform it so that one side will be y by itself. (And that the other side will not contain y.)

Coco wrote:Second pic represents my basic not-understanding of trigonometric functions. It's all clear with right angeled triangle, but what are sin(), cos(), and tg() functions (triangle sides relation) when all angles are different, and none is 90 degrees angle?

As Wikipedia writes, sin,cos,tg are functions of an angle by itself, and the right-angled triangle is only needed for the definition: https://en.wikipedia.org/wiki/Sine#Righ ... definition
I.e. the sin,cos,tg of an angle in your triangle (or anywhere) is the same as the sin,cos,tg of an angle equal to it in a right-angled triangle, provided that such a triangle exists, i.e. the angle is less than 90°.
But there is another definition, which works for any angle: https://en.wikipedia.org/wiki/Sine#Unit ... definition

If you want relations between angles and sides of arbitrary triangles, you can use these:
https://en.wikipedia.org/wiki/Law_of_sines
https://en.wikipedia.org/wiki/Law_of_cosines

Coco wrote:in right angle triangle, an angle between adjacent and hypotenuse side (lets call it alfa) is sin(alfa)= opposite side/hypotenuse.
[...]
actually, the angle is arcsin(alfa) [or 1/sin(alfa)], but you get the point...

Actually, the angle is alfa = arc sin(opposite side/hypotenuse).

Also, please don't use "1/sin" for arc sin.
In the "sin-1" notation (commonly found on calculators), the "-1" superscript means inverse function and not reciprocal.
Although the use of "sin-1" also seems to be discouraged, exactly because of this confusion: https://en.wikipedia.org/wiki/Inverse_t ... s#Notation

User avatar
Coco
Beylerbey
Beylerbey
Posts: 63
Joined: February 1st, 2013, 3:58 pm

Re: Math problems

Postby Coco » May 28th, 2017, 2:08 pm

(Say, is this your homework or something?)


No. I've finished my last homework a long time ago :cry: , however, I'm still interested in relearning a few things that I've missed in math class because I was young and uninterested back than, or the things that I haven't fully understood. So now I just browse forums on technical universities, and I'm trying to solve math exams they use for selecting new students. It's more fun than solving crossword puzzles, and I might find it useful someday :mrgreen:

Actually, the angle is alfa = arc sin(opposite side/hypotenuse).

I meant that, my bad. And thanks for clarifying the rest.

To get the function, you need the equation of the circle: https://en.wikipedia.org/wiki/Circle#Equations

Uhm... I'll just read some more on the subject. Waaaay more :shock:

If anyone is interested, I have one more task. This one might be more interesting for programmers.

David
The Prince of Persia
The Prince of Persia
Posts: 1362
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Math problems

Postby David » June 3rd, 2017, 3:59 pm

Coco wrote:however, I'm still interested in relearning a few things that I've missed in math class because I was young and uninterested back than, or the things that I haven't fully understood.

Well, as they say, better late then never. :)

Coco wrote:If anyone is interested, I have one more task. This one might be more interesting for programmers.

What is it? :)

User avatar
Coco
Beylerbey
Beylerbey
Posts: 63
Joined: February 1st, 2013, 3:58 pm

Re: Math problems

Postby Coco » June 14th, 2017, 1:20 am

How many numbers exist between 1 and 1.000.000 that are divisible by either 11 or 13, and no other number (except 1, and themself, of course)?

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 2979
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: Math problems

Postby Norbert » June 14th, 2017, 1:11 pm

Coco wrote:How many numbers exist between 1 and 1.000.000 that are divisible by either 11 or 13, and no other number (except 1, and themself, of course)?


Three numbers: 121, 143 (by both) and 169.

At least, that's what my basic code tells me. No guarantees the code is correct.
The code could probably be a lot better, to skip large blocks of numbers based on their properties.

No idea if there's a mathematical way to determine this.

Code:
Spoiler: show

Code: Select all

#include <stdio.h>
#include <stdbool.h>

#define MIN 1
#define MAX 1000000

bool IsInt (double dVal);
void Divisible (void);

/*****************************************************************************/
bool IsInt (double dVal)
/*****************************************************************************/
{
   /*** https://stackoverflow.com/a/20068358 ***/

   int iTruncated;

   iTruncated = (int)dVal;
   return (dVal == iTruncated);
}
/*****************************************************************************/
void Divisible (void)
/*****************************************************************************/
{
   int iNumber;
   int iDivide;
   double fResult;
   int iBingo;

   for (iNumber = MIN; iNumber <= MAX; iNumber++)
   {
      /*** Every 10000 numbers print the current number. ***/
      if (IsInt ((float)iNumber / 10000))
         { printf ("[ INFO ] At %i\n", iNumber); }

      iBingo = 0;
      for (iDivide = 1; iDivide <= iNumber; iDivide++)
      {
         fResult = ((float)iNumber / (float)iDivide);
         if (IsInt (fResult))
         {
            if ((iDivide == 1) || (iDivide == iNumber))
            {
               /*** ignore ***/
            } else if ((iDivide == 11) || (iDivide == 13)) {
               if (iBingo != -1) { iBingo++; }
            } else {
               iBingo = -1;
            }
         }
      }
      if (iBingo > 0)
      {
         printf ("[  OK  ] %i", iNumber);
         if (iBingo == 2)
         {
            printf (" (by both)");
         }
         printf ("\n");
      }
   }
}
/*****************************************************************************/
int main (int argc, char *argv[])
/*****************************************************************************/
{
   Divisible();

   return 0;
}
/*****************************************************************************/


Output:
Spoiler: show
norbert@stimpy ~/math $ time ./math
[ OK ] 121
[ OK ] 143 (by both)
[ OK ] 169
[ INFO ] At 10000
[ INFO ] At 20000
[ INFO ] At 30000
[ INFO ] At 40000
[ INFO ] At 50000
[ INFO ] At 60000
[ INFO ] At 70000
[ INFO ] At 80000
[ INFO ] At 90000
[ INFO ] At 100000
[ INFO ] At 110000
[ INFO ] At 120000
[ INFO ] At 130000
[ INFO ] At 140000
[ INFO ] At 150000
[ INFO ] At 160000
[ INFO ] At 170000
[ INFO ] At 180000
[ INFO ] At 190000
[ INFO ] At 200000
[ INFO ] At 210000
[ INFO ] At 220000
[ INFO ] At 230000
[ INFO ] At 240000
[ INFO ] At 250000
[ INFO ] At 260000
[ INFO ] At 270000
[ INFO ] At 280000
[ INFO ] At 290000
[ INFO ] At 300000
[ INFO ] At 310000
[ INFO ] At 320000
[ INFO ] At 330000
[ INFO ] At 340000
[ INFO ] At 350000
[ INFO ] At 360000
[ INFO ] At 370000
[ INFO ] At 380000
[ INFO ] At 390000
[ INFO ] At 400000
[ INFO ] At 410000
[ INFO ] At 420000
[ INFO ] At 430000
[ INFO ] At 440000
[ INFO ] At 450000
[ INFO ] At 460000
[ INFO ] At 470000
[ INFO ] At 480000
[ INFO ] At 490000
[ INFO ] At 500000
[ INFO ] At 510000
[ INFO ] At 520000
[ INFO ] At 530000
[ INFO ] At 540000
[ INFO ] At 550000
[ INFO ] At 560000
[ INFO ] At 570000
[ INFO ] At 580000
[ INFO ] At 590000
[ INFO ] At 600000
[ INFO ] At 610000
[ INFO ] At 620000
[ INFO ] At 630000
[ INFO ] At 640000
[ INFO ] At 650000
[ INFO ] At 660000
[ INFO ] At 670000
[ INFO ] At 680000
[ INFO ] At 690000
[ INFO ] At 700000
[ INFO ] At 710000
[ INFO ] At 720000
[ INFO ] At 730000
[ INFO ] At 740000
[ INFO ] At 750000
[ INFO ] At 760000
[ INFO ] At 770000
[ INFO ] At 780000
[ INFO ] At 790000
[ INFO ] At 800000
[ INFO ] At 810000
[ INFO ] At 820000
[ INFO ] At 830000
[ INFO ] At 840000
[ INFO ] At 850000
[ INFO ] At 860000
[ INFO ] At 870000
[ INFO ] At 880000
[ INFO ] At 890000
[ INFO ] At 900000
[ INFO ] At 910000
[ INFO ] At 920000
[ INFO ] At 930000
[ INFO ] At 940000
[ INFO ] At 950000
[ INFO ] At 960000
[ INFO ] At 970000
[ INFO ] At 980000
[ INFO ] At 990000
[ INFO ] At 1000000

real 20m4.965s
user 20m4.876s
sys 0m0.028s

User avatar
Coco
Beylerbey
Beylerbey
Posts: 63
Joined: February 1st, 2013, 3:58 pm

Re: Math problems

Postby Coco » June 14th, 2017, 8:42 pm

You forgot 13 and 11, or Ive formulated the question in a wrong way. However I think that is correct. Anything above 169 must be divisible by yet another number.

More questions? xD

User avatar
Coco
Beylerbey
Beylerbey
Posts: 63
Joined: February 1st, 2013, 3:58 pm

Re: Math problems

Postby Coco » June 15th, 2017, 1:54 am

Not related to topic, but just for fun, let's check out who thinks as a programmer and who as a mathematician. Write a simple code that sums the all previous numbers (and that number). For example sum(10) would be 1+2+3+...+10.

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 2979
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: Math problems

Postby Norbert » June 15th, 2017, 6:26 pm

Coco wrote:Not related to topic, but just for fun, let's check out who thinks as a programmer and who as a mathematician. Write a simple code that sums the all previous numbers (and that number). For example sum(10) would be 1+2+3+...+10.


As a programmer, when I need to use (that kind of) math, I Google. Then I find something like this, (N(N + 1))/2, and test+use that. Frequently, I search for a couple of solutions, read up on what's most accurate, fastest, recommended. In fact, even for very simple programming tasks I often look up things. Simply because what I know and remember may work but could be deprecated; could have new, better alternatives.

User avatar
Zaknafein
Sheikh
Sheikh
Posts: 47
Joined: May 1st, 2014, 11:40 pm
Location: Menorca

Re: Math problems

Postby Zaknafein » June 15th, 2017, 8:24 pm

Coco wrote:How many numbers exist between 1 and 1.000.000 that are divisible by either 11 or 13, and no other number (except 1, and themself, of course)?

Then we call that this number has P property
Norbert wrote:No idea if there's a mathematical way to determine this.

I'll try to proof it. Let 1<=N<=1.000.000 an integer. N=q1k1...qrkr in an unique way.
(https://en.wikipedia.org/wiki/Fundament ... arithmetic)

If N has P property, there is some qi = 11 or 13. Then, there isn't any qj != 11 and 13. In other way, we have that qj != 11, 13, 1, N, that divides N, in contradiction with P property of N.

So, N = 11a13b, where a,b>=0.

If a or b >=3, we have that 112 or 132 != N and divides N, in contradiction.

Then we have a,b<=2.

We also proof that:

If a=2, then b=0 for similar reason.
If b=2, then a=0 for similar reason.
a+b>=1

Finally, (a,b)=(1,0),(1,1),(0,1),(2,0) or (0,2), and N = 11, 143, 13, 121 or 169.

User avatar
Coco
Beylerbey
Beylerbey
Posts: 63
Joined: February 1st, 2013, 3:58 pm

Re: Math problems

Postby Coco » June 16th, 2017, 10:00 am

N(N+1) /2 would be math way. I remembered this after i wrote a small code which iterated through each number and adding it to the final sum. Then I figured this out and thought how math can sometimes be helpful (otherwise its a useless piece of crap :) ).
Now Im trying to figure out a way to sum all even (and only even) numbers via some formula, even if input is odd number. So if input is 7 for example the output should be 2+4+6=12. If input is 6,the result should be the same.

User avatar
Coco
Beylerbey
Beylerbey
Posts: 63
Joined: February 1st, 2013, 3:58 pm

Re: Math problems

Postby Coco » June 16th, 2017, 12:30 pm

Ratios between sums of even and odd numbers, their progression and difference towards the given number are interesting...


Return to “Off-Topic”

Who is online

Users browsing this forum: No registered users and 2 guests