Open In App

Calculate exponential of a value in Julia – exp(), exp10(), exp2(), expm1() and frexp() Methods

Last Updated : 26 Mar, 2020
Improve
Improve
Like Article
Like
Save
Share
Report
The exp() is an inbuilt function in julia which is used to calculate the natural base exponential of the specified number.
Syntax: exp(x) Parameters:
  • x: Specified values.
Returns: It returns the calculated natural base exponential of the specified number.
Example:
# Julia program to illustrate 
# the use of exp() method
  
# Getting the natural base exponential
# of the specified number.
println(exp(0))
println(exp(1))
println(exp(5))
println(exp(-1))

                    
Output:
1.0
2.718281828459045
148.4131591025766
0.36787944117144233

exp10()

The exp10() is an inbuilt function in julia which is used to calculate the base 10 exponential of the specified number.
Syntax: exp10(x) Parameters:
  • x: Specified values.
Returns: It returns the calculated base 10 exponential of the specified number.
Example:
# Julia program to illustrate 
# the use of exp10() method
  
# Getting the base 10 exponential
# of the specified number.
println(exp10(0))
println(exp10(1))
println(exp10(10))
println(exp10(-1))

                    
Output:
1.0
10.0
1.0e10
0.1

exp2()

The exp2() is an inbuilt function in julia which is used to calculate the base 2 exponential of the specified number.
Syntax: exp2(x) Parameters:
  • x: Specified values.
Returns: It returns the calculated base 2 exponential of the specified number.
Example:
# Julia program to illustrate 
# the use of exp2() method
  
# Getting the base 2 exponential
# of the specified number.
println(exp2(0))
println(exp2(1))
println(exp2(2))
println(exp2(-1))

                    
Output:
1.0
2.0
4.0
0.5

expm1()

The expm1() is an inbuilt function in julia which is used to accurately calculate e^x-1.
Syntax: expm1(x) Parameters:
  • x: Specified values.
Returns: It returns the calculated value of e^x-1.
Example:
# Julia program to illustrate 
# the use of expm1() method
  
# Getting the accurate value
# of given expression
println(expm1(0))
println(expm1(1))
println(expm1(2))
println(expm1(-1))

                    
Output:
0.0
1.718281828459045
6.38905609893065
-0.6321205588285577

frexp()

The frexp() is an inbuilt function in julia which is used to return (x, exp), where x is given and having a magnitude in the interval [1/2, 1) or 0.
Syntax: frexp(x) Parameters:
  • x: Specified values in the interval [1/2, 1) or 0.
Returns: It returns (x, exp), where x is given and having a magnitude in the interval [1/2, 1) or 0.
Example:
# Julia program to illustrate 
# the use of frexp() method
  
# Getting (x, exp), where
# x is given and having a magnitude
# in the interval [1 / 2, 1) or 0.
println(frexp(0.6))
println(frexp(0.5))
println(frexp(0.7))
println(frexp(0.9999))

                    
Output:
(0.6, 0)
(0.5, 0)
(0.7, 0)
(0.9999, 0)


Similar Reads

Calculate logarithm of a value in Julia - log(), log10(), log1p() and log2() Methods
The log() is an inbuilt function in julia which is used to compute the natural logarithm of the specified value or throw domain error for the parameter of negative Real value. Syntax: log(x) Parameters: x: Specified values. Returns: It returns the natural logarithm of the specified value or throw domain error for the parameter of negative Real valu
3 min read
Julia continue Keyword | Continue iterating to next value of a loop in Julia
Keywords in Julia are predefined words that have a definite meaning to the compiler. These keywords can’t be used to name variables. 'continue' keyword in Julia skips the statement immediately after the continue statement. Whenever the continue keyword is executed, the compiler immediately stops iterating over further values and sends the execution
1 min read
Getting lowest and highest value of a Data type in Julia - typemin() and typemax() Methods
The typemin() is an inbuilt function in julia which is used to return the lowest value representable by the specified numeric DataType. Syntax: typemin(T) Parameters: T: Specified numeric DataType. Returns: It returns the lowest value representable by the specified numeric DataType. Example 1: # Julia program to illustrate # the use of typemin() me
1 min read
Accessing value of a specified key in Julia - get(), get!() and getkey() Methods
The get() is an inbuilt function in julia which is used to return the value stored for the specified key, or the given default value if no mapping for the key is present. Syntax: get(collection, key, default) Parameters: collection: Specified collection. key: Specified key present in the collection. default: Specified default value which is returne
3 min read
Julia end Keyword | Marking end of blocks in Julia
Keywords in Julia are reserved words that have a pre-defined meaning to the compiler. These keywords can't be used as a variable name. 'end' keyword in Julia is used to mark the end of a block of statements. This block can be of any type like struct, loop, conditional statement, module, etc. Syntax: block_type block_name Statement Statement end Exa
1 min read
Julia function keyword | Create user-defined functions in Julia
Keywords are the reserved words in Julia which have a predefined meaning to the compiler. These keywords are used to reduce the number of lines in code. Keywords in Julia can't be used as variable names. 'function' keyword is used to create user-defined functions in Julia. These functions are reusable codes that can be called from anywhere in the c
1 min read
Julia break Keyword | Exiting from a loop in Julia
Keywords in Julia are predefined words that have a definite meaning to the compiler. These keywords can't be used to name variables. 'break' keyword in Julia is used to exit from a loop immediately. Whenever the break keyword is executed, the compiler immediately stops iterating over further values and sends the execution pointer out of the loop. S
1 min read
Julia local Keyword | Creating a local variable in Julia
Keywords in Julia are reserved words whose value is pre-defined to the compiler and can not be changed by the user. These words have a specific meaning and perform their specific operation on execution.'local' keyword in Julia is used to create a variable of a limited scope whose value is local to the scope of the block in which it is defined. Synt
2 min read
Julia global Keyword | Creating a global variable in Julia
Keywords in Julia are reserved words whose value is pre-defined to the compiler and can not be changed by the user. These words have a specific meaning and perform their specific operation on execution. 'global' keyword in Julia is used to access a variable that is defined in the global scope. It makes the variable where it is used as its current s
2 min read
Getting inverse sine and inverse hyperbolic sine in Julia - asin(), asinh() and asind() Methods
The asin() is an inbuilt function in julia which is used to calculate inverse sine of the specified value and output is in radians. Syntax: asin(x) Parameters: x: Specified values. Returns: It returns the calculated inverse sine of the specified value and output is in radians. Example: # Julia program to illustrate # the use of asin() method # Gett
2 min read
Article Tags :