Questions tagged [math-functions]
56 questions
0
votes
1 answer
How to increase readability when using powers in C#
I use a lot of powers in a script for Unity, so I want to reduce the code needed for raising a variable to a power.
For small powers, I could use Mathf.Pow(a,2) = a*a, but I am looking for maybe something better or else I'll do my " a * a * a * a *…

hey
- 13
- 4
0
votes
5 answers
Calculating the angle between two vectors
If tried searching the internet but I couldn't find the anwser.
I'm trying to calculate the angle between 2 vectors, seen from the first vector.
So if vector 1 is at 0,0 and vector 2 is at 1,1 the heading would be 45.
at 1,0 it would be 90.
at -1,0…

Mark
- 132
- 3
- 13
0
votes
0 answers
Polynomials implemented with queues
I have to implement a program that computes the value of the polynomial given a value X, inverts the polynomial, the addition, the subtraction and the multiplication of two polynomials. The two polynomials can have different degrees and
not all…

Ruxandra N.
- 11
- 1
-1
votes
1 answer
How to plot negative values in the base of an exponent
I want to plot f(x) = x^(2/3) using python, however, I'm only able to get it to plot for the positive values of x.
Does anyone have any ideas where I'm going wrong?
import numpy as np
import matplotlib.pyplot as plt
# Define the function
def f(x):
…

smdr
- 15
- 3
-1
votes
1 answer
fast double exp2 function in C
I need a version of the following fast exp2 function working in double precision, can you help me ? Please don't answer saying that it is an approximation so a double version is pointless and casting the result to (double) is enough..thanks. The…

elena
- 233
- 1
- 7
-1
votes
1 answer
Error: attribute d: Expected number, " M397,NaN L397,0 A0,0,…"
i have this error when I try to put a value in the field radius and innerRadius value (in a Solid Gauge, amchart)
Error: attribute d: Expected number, " M397,NaN L397,0 A0,0,…".
I tried to find some topic with the error in common this but i…

khalD
- 317
- 5
- 15
-1
votes
1 answer
For loop with a mathemtical expression involved
I am trying to utilize the Math.Cos() function in c# to print a range of of values from 0 to 2pi increasing by .1pi, so 20 iterations. The problem is I cannot get my x value to change as the for loop is executing.
public void Cos()
{
…

pijoborde
- 29
- 7
-1
votes
2 answers
How to perform a math function like divide on two js objects with different properties
Say I have a js object like this;
{'tv':390, 'table':200, 'cup':270, 'chair':325, 'door':300, 'books':290, 'radio':345}
and a second object like so;
{0:30, 1:25, 2:20, 3:35, 4:30, 5:10, 6:15}
How can I for instance perform a division on the first…

Clint_A
- 518
- 2
- 11
- 35
-1
votes
1 answer
What is general name of described math function
I need to know the name of this function, please help.
The idea of this function is that you have some number and you need to finding two biggest numbers from fibonacci sequence which you need to add to get this number. And method returns to you…

Andrey Dubok
- 51
- 7
-1
votes
1 answer
why Math.round not worked correctly for me in jquery?
I have 2 number that I use Math.round to round it,for example I want if my number is 900.20 it rounded to 900.00 and if 12.80 it rounded to 13.
I use Math.round but 900.20 rounded to 910.00 but 12.8 rounded to 13 correctly.
var num1=900.20;
var…

Motion
- 116
- 1
- 11
-2
votes
1 answer
How to plot a math function from a string
I have a string, "x * (x - 32 ( 2 /x) )", which represents a math function. How can I use python and matplotlib to convert this string into an array of points to plot?

Fabrício
- 91
- 2
- 7