## Square root

Forum for users that want to write their own custom queries against the PT database either via the Structured Query Language (SQL) or using the PT3 custom stats/reports interface.

Moderator: Moderators

### Square root

Probably a silly question. Is there a square root function available to use for custom stats?
preparac

Posts: 323
Joined: Thu May 15, 2008 6:23 am

### Re: Square root

There isn't a square root function that I'm aware of, but you can use the 'power' operator; ^
e.g. 3 ^ 2 = 3 to the power 2 = 9
9 ^ 0.5 = square root of 9 = 3.
WhiteRider
Moderator

Posts: 53569
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

### Re: Square root

cool thanks!
preparac

Posts: 323
Joined: Thu May 15, 2008 6:23 am

### Re: Square root

WhiteRider wrote:There isn't a square root function that I'm aware of, but you can use the 'power' operator; ^
e.g. 3 ^ 2 = 3 to the power 2 = 9
9 ^ 0.5 = square root of 9 = 3.

Hmm, this doesn't work. I wrote "format_number (cnt_holecards ^ 2 - 0.664, 0, false, false)" for a report, dealing with confidence
intervals, and got a warning of "expression is NOT valid".
Dan_Jazz_Man

Posts: 466
Joined: Sun Feb 03, 2008 5:58 pm

### Re: Square root

Dan_Jazz_Man wrote:
WhiteRider wrote:There isn't a square root function that I'm aware of, but you can use the 'power' operator; ^
e.g. 3 ^ 2 = 3 to the power 2 = 9
9 ^ 0.5 = square root of 9 = 3.

EDIT: Hmm, this doesn't work. I wrote "format_number (cnt_holecards ^ 0.5 - 0.664, 0, false, false)" for a report, dealing with confidence
intervals, and got a warning of "expression is NOT valid".
Dan_Jazz_Man

Posts: 466
Joined: Sun Feb 03, 2008 5:58 pm

### Re: Square root

Possibly this doesn't work in the Statistics tab - try doing your calculation in your cnt_holecards column.
WhiteRider
Moderator

Posts: 53569
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

### Re: Square root

I'm sorry, I don't understand what you mean.
I have a column in a report for showing the expected number of times a pocket pair improves on the flop, and also
left and right values of a 95% confidence interval. So here's what I want to write:
format ('{1}, {2}. {3},
format_number (cnt_holecards * 0.1175 - (cnt_holecards ^ 0.5) * 2 * 0.332, 0, false, false),
format_number (cnt_holecards * 0.1175, 0, false, false),
format_number (cnt_holecards * 0.1175 + (cnt_holecards ^ 0.5) * 2 * 0.332, 0, false, false) )

How can I do it differently?
Dan_Jazz_Man

Posts: 466
Joined: Sun Feb 03, 2008 5:58 pm

### Re: Square root

I think you need to put your square root calculation in the Column "cnt_holecards" - or actually you may need to create a new column for each calculation; cnt_holecards_root for instance, where the Value Expression in the column has the ^ 0.5 added to whatever is already in the cnt_holecards column.
WhiteRider
Moderator

Posts: 53569
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

### Re: Square root

This doesn't work either. I created a cnt_holecard_sqrt column and tried to write the following expression for it:
cnt_holecard ^ 0.5
PT gives a warning message of "NOT a valid SQL expression".
Dan_Jazz_Man

Posts: 466
Joined: Sun Feb 03, 2008 5:58 pm

### Re: Square root

Earlier you were referring to cnt_holecards not cnt_holecard -- could this perhaps be the problem now?
Moderator

Posts: 54435
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Next