Questions tagged [math-functions]
56 questions
0
votes
1 answer
how to plot functions containing variables in function-plot?
I have the code to generate a sine wave in the javascript library- function-plot:
functionPlot({
target: '#domain',
yAxis: {domain: [-1, 1]},
xAxis: {domain: [8, 24]},
data: [{
fn: 'sin(x)'
}]
})
But it doesn't generate a graph…

Sophile
- 287
- 3
- 16
0
votes
0 answers
Adjust sigmoid function parameters
I have a function which consists of 3 linear functions, and looks like that:
The function is defined this way:
t0 = 0.0
t1 = 0.069 #lowest threshold
t2 = 0.17 #highest threshold
t3 = 1.0
y0 = 0.0
y1 = 0.7
y2 = 2.8
y3 = 4
tt = np.linspace(0,…

omri
- 25
- 4
0
votes
1 answer
Why is the Cos function in C# giving me wrong answers?
I have a method, in which I am using the Cos() Function from the namespace "Mathf".
Sadly, when I give, for example the in put of 45 it returns 0,52532, which is wrong. Using a calculator I get the correct answer of 6.283185 Radians.
float angle =…

0q_
- 74
- 4
0
votes
0 answers
C# Lower Math.Infinity
how can I change the Mathf.Infinity to make the Raycast length be something like 0.1 Meters?
// Fire a ray through the scene at the mouse position and place the target where it hits
RaycastHit hit;
if…

Gregger
- 3
- 1
0
votes
0 answers
Algorithm for a Pow2() function for fractions?
Does anyone know an algorithm for a Pow2() function for fractions?
For a function of the following form, where BigRational stands for any rational number type, with arbitrarily large integers for numerator and denominator:
BigRational…

Christian Ohle
- 143
- 1
- 4
0
votes
4 answers
Square and Sum of User Inputted List
I want to print the sum and a squared version of an inputted list by a user. I am able to get the sum but not the list printed out squared. Ex. 1,2,3,4,5 .... 1,4,9,16,25
import math
#This defines the sumList function
def sumList(nums):
total =…

RoG
- 3
- 1
0
votes
2 answers
Integrating 2 Mathematical Equations in 1 C
I have written a program to calculate y values according to given x values for the function y = (sqrt(3+x^2))/(20x^2+sqrt(x)). Using two counters, one for x values [i], and one for y values [n]. My x values show up fine, however, the y values return…

soundsfierce
- 45
- 2
- 9
0
votes
1 answer
Using Mathf.Clamp causes me camera to start at the minimum angle that it allows
Somewhat new to Unity and C#, trying to let the camera move around for the user to see the room. It's kind of like a visual novel so I only want a specific part of the room to be visible.
This is what I have so far. It works perfectly but it…

Uzair Ashraf
- 1,171
- 8
- 20
0
votes
1 answer
How do I reverse this ln power function of a slider?
I was able to translate this from LTSpice potentiometer code by Helmut Sennewald.
But math is not my thing so I'm not sure if it is possible to reverse this so that if given point on
ln segment algorithm would return corresponding value on original…

Tonecops
- 127
- 9
0
votes
1 answer
Postgresql return values on a reducing balance
I have a query that returns items a person has paid for, the price of that item and the balance. My problem is there are situations where a person may make 2 payments for one item (make a payment, and another payment of the balance later). So the…

Clint_A
- 518
- 2
- 11
- 35
0
votes
0 answers
Math.getExponent function
I am trying to use the below code for one of my apps, and it requires the use of the exponential function:
YPO = ((590 * (Math.getExponent((n2 / n1) * 258.2))) / 1.12) / 60;
Where n1 and n2 are any number between 0.1 to 0.9
The problem is I am…

Ashish
- 9
- 3
0
votes
1 answer
Issue with Math rounding in JS failing to actually provide a whole number in favor of a decimal answer
So I set this up for a bit of simple math to add a little flair to a madlibs game. Yet everytime I run this I get a decimal answer rather than a whole number, Math.round(x, n) doesn't work either. Is there some improper syntax or something I'm…

Luis Raiju Colon
- 11
- 3
0
votes
1 answer
Unity 3d, Mathf.Clamp automatically returning values
I am developing some logic and realized that clamp function not clamping rotation properly. It is always returning max rotation that I have put in the limit.
Then i made another simple logic to check what is wrong. I came to know that the, Clamp…

Bilal Mirza
- 233
- 1
- 3
- 14
0
votes
2 answers
Complex mathematical horizontal parallax easing function
I'm currently diving into parallax effects on the web.
Parallax scrolling is a technique in computer graphics and web design, where background images move by the camera slower than foreground images, creating an illusion of depth in a 2D scene and…

Jesse van der Pluijm
- 703
- 1
- 7
- 20
0
votes
1 answer
Coding a Math Equation
So I'm trying to code this equation using java:
I'm taking a, b, and c from the user.
This is the code I have so far:
import java.util.Scanner;
class QaudraticFunction{
public static void main(String []args){
Scanner input = new…

Vishal
- 110
- 2
- 11