Questions tagged [real-number]
40 questions
3
votes
1 answer
Matlab function that generates random real numbers in a closed interval
It's there any function in Matlab that generates random real numbers in a closed interval. I found something with unifrnd() but it's generating numbers in an open interval.
If I use unifrnd(x,y); I get (x,y) interval, instead of [x,y].

Alex Chihaia
- 103
- 2
- 15
3
votes
1 answer
How to automatically prove simple equality of real numbers in Coq?
What I am looking for is an auto-like tactic that can prove simple equalities like:
1/2 = 2/4
So far, what I've tried manually is to use ring_simplify and field_simplify to prove equalities. Even this doesn't work out well (Coq 8.5b3). The example…

thor
- 21,418
- 31
- 87
- 173
3
votes
1 answer
How to simplify real number terms in Coq?
I am trying to do simple proofs for real numbers with Coq. For example, I want to prove the average of two non-negative numbers is also non-negative.
Example test: forall r1 r2:R, r1 >= 0 -> r2 >= 0 -> (r1 + r2)/2 >= 0.
My first step is to prove r1…

thor
- 21,418
- 31
- 87
- 173
2
votes
2 answers
In Coq, are there tactics for working with Rabs, Rineq?
I am new to Coq, and my primary interest is in using it to do simple real analysis problems. For a first exercise, I managed to bash through a proof that x^2+2x tends to 0 as x tends to 0. See code below.
This seems pretty clunky, and I would be…

anon
- 235
- 2
- 9
2
votes
1 answer
Coq Real numbers -lexing and parsing 3.14
With Reals library imported
Require Import Reals.
How can I define constants such as 3.14 or 10.1 and use them for function definition or computation ?

FZed
- 520
- 3
- 10
1
vote
2 answers
How to format output in R containing both integers and real numbers?
The output of my code is following:
print(c(ax,bx,cx,dx))
>[1] 232.0000 2.0000 0.6578 1.2356
where in all the cases, the first two numbers are integers, and the rest are real. What should I include in the print statement, such that the output…

Pratik Mullick
- 55
- 6
1
vote
0 answers
How to typecheck real numbers, and type-safely compare them to ints
I have a function that inputs a real number. In practice it might be an int or a float. and I want it to check if it is >0
For example
def f(x):
return x > 0
Now I want that function to be type checked. Since I wanted x to be any real number, I…

tbrugere
- 755
- 7
- 17
1
vote
3 answers
How to check if the value of string variable is double
I am trying to check if the value of a string variable is double.
I have seen this existing question (Checking if a variable is of data type double) and it's answers and they are great but I have a different question.
public static bool…

Chimebuka Okwuokenye
- 177
- 1
- 14
1
vote
1 answer
ML a real list return a real number
I am currently working on a ML small project and learning how to work with it, but here are some problems that I'm facing but cannot find any source online.
I want to have a function to return the last number of the list, which is a real number…

Lawrence Ho Chun Kit
- 31
- 5
0
votes
0 answers
Read exact data from csv file in Fortran
I want to read and store the data from the csv file in Fortran but the stored data does not have the same decimal place and digits as the original data. I want to read and store the same value which will be used in calculation in other programs.
The…

Mark
- 35
- 4
0
votes
0 answers
Convert int to float in asm
Input are interger numbers and after calculation, i need the output is real number.
How can I do it?
Like when I enter 1,23,123 and the ouput of second calculation is -33 while the actual result is -33.3
include \masm32\include\masm32rt.inc
…

Sơn Nguyễn
- 1
- 1
0
votes
1 answer
Sql query with variables (real or integer)
I'm learning python... I tried to execute sql queries with parameters without success...
I tried:
from tkinter import*
import tkinter as tk
from tkinter import ttk
import sqlite3
realNumber = 2.0
database = sqlite3.connect('NumDB.db')
cursor =…

leo
- 3
- 2
0
votes
1 answer
The function unique in R is not working for real numbers
I have a data frame that looks like following:
> con.hull.mod
x y
1 2.5558145 4.1739617
2 5.0180096 5.4267733
3 5.0180096 5.4267733
4 6.2151346 6.0358932
5 6.3582981 6.1087375
6 6.3582053 5.8702711
7 6.3574907 4.0355980
8 …

Pratik Mullick
- 55
- 6
0
votes
1 answer
How to convert real number between 0 to 1 into binary in Javascript?
I am trying to convert a real number (a) which is between zero and one to an array of bits.
I have tried this:
let a = 0.625
let b = []
while (a != 0) {
if ((a * 2) >= 1) {
b.push(1)
a = a - 1
}
else {
…
0
votes
0 answers
Regular expression for the set of all C real numbers
all the following patterns need to be accepted: 0, +0,-0, any integer, any integer preceded by + or - sign.
.3, 3.14, +3.14159, -3.14159, 0.123, -0.123, .123, +.123
12e+2, 7e-4, 6.3e2, 6.3e+2, 6.3e-2, -6.3e+2
I am a little bit confused about how to…

Dhruvil
- 1
- 3