Mathematica Solve Quick Mathematica Issue with HypothesisTesting

  • Thread starter Thread starter HJ Farnsworth
  • Start date Start date
  • Tags Tags
    Mathematica
AI Thread Summary
In Mathematica, to extract a number from a function output formatted as "variable→number," you can use a de-referencing technique. By defining a custom function, such as myf[t_] := OneSidedPValue /. NormalPValue[t], you can input your variable and receive the desired numerical output directly. This approach effectively converts the output from the Root format to just the number.
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
2
Views
3K
Replies
1
Views
2K
Replies
6
Views
8K
Replies
5
Views
3K
Replies
12
Views
5K
Replies
22
Views
3K
Replies
3
Views
3K
Replies
2
Views
3K
Back
Top