Solve Quick Mathematica Issue with HypothesisTesting

  • Context: Mathematica 
  • Thread starter Thread starter HJ Farnsworth
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary
SUMMARY

The discussion addresses a specific issue in Mathematica regarding the extraction of numerical values from symbolic expressions. The user, HJ Farnsworth, seeks a method to retrieve the number from the output of the function NormalPValue[-2], which returns a symbolic expression in the form OneSidedPValue → .0227501. The solution provided involves defining a function myf[t_] that uses replacement rules to de-reference the symbolic output, allowing the user to obtain the desired numerical value directly.

PREREQUISITES
  • Familiarity with Mathematica syntax and functions
  • Understanding of symbolic expressions in Mathematica
  • Knowledge of replacement rules in Mathematica
  • Basic experience with the HypothesisTesting package in Mathematica
NEXT STEPS
  • Explore the use of replacement rules in Mathematica for symbolic manipulation
  • Learn about the HypothesisTesting package and its functions in Mathematica
  • Investigate other methods to extract numerical values from symbolic expressions in Mathematica
  • Study advanced function definitions in Mathematica for custom data retrieval
USEFUL FOR

Mathematica users, statisticians, data analysts, and anyone working with symbolic computation who needs to extract numerical results from complex expressions.

HJ Farnsworth
Messages
126
Reaction score
1
Greetings,

I have a nagging issue that keeps annoying me in Mathematica.

If a Mathematica function outputs a number I want in the form "variable→number", is there a function I could use or something simple I could type to get the number itself, rather than in the Root[variable, number] form?

Here's an example. I type:

Needs["HypothesisTesting`"]
a=NormalPValue[-2]

and Mathematica outputs:

OneSidedPValue → .0227501

I'm looking for a function f where, if I type:

f[a]

Then Mathematica will output:

.0227501

Thanks for any help you can give.

-HJ Farnsworth
 
Physics news on Phys.org
You need to de-reference it:

Needs["HypothesisTesting`"]
a = NormalPValue[-2]

myf[t_] := OneSidedPValue /. NormalPValue[t]
 
That worked, thank you.

-HJ Farnsworth
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
8K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 12 ·
Replies
12
Views
5K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 22 ·
Replies
22
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K