I know how to calculate this with pen and paper but would like to do the same in mathematica. However I’m new to mathematica so I have no idea where I’m supposed to start. Watched a couple of YouTube videos but none explain how I can calculate the probability of getting a flush from 52 cards by searching through each 5 card combination. The flush should be determined using the three community cards and two holecards just like in Texas hold em.

# Tag: calculate

## Is there a tool to calculate row size and which columns would go in_row_data? [closed]

I just watched a course about how MS SQL tables are stored on the disk and a big portion of that were the IN_ROW_DATA and etc., explaining how fixed-width columns are always in teh IN_ROW_DATA and if any other overflow they get put in the OUT_ROW_DATA and etc.

The lector showed a visual aid of how you can calculate which columns would end in the IN_ROW_DATA when deisgning the table (assuming you knew what you were doing and the data it’s going to store) is there some tool or website that can show similar information before the table is created?

I was thinking of a tool/site where I enter what columns I am thinking of making and it tell me based on that how many would be in the IN_ROW, how many in the OUT_ROW, how many bites a row *could* take, etc.

## How do I calculate Field of View and camera position from 2 images?

I am trying to re-construct the camera logic of RE4 that is applied when the player aims a gun.

I have attached a hack to RE4 which enables the user to change the camera’s FOV. Because of that I already know that the FOV for aiming with a gun is 50. The FOV during normal gameplay is 75.

I have then taken 2 screenshots:

- Screenshot #1 shows normal / idle gameplay
- Screenshot #2 shows aiming gun gameplay

These are the 2 screenshots. The red frame indicates the area that is still visible when the player aims. As one can see, the left side is heavily cropped while the right side is not cropped at all. This makes me wonder what the logic is here.

I have tried to replicate this behaviour, but I don’t manage to make my scene look exactely like that.

I would therefore like to ask if there is perhaps a mathematical approach that I can use to calculate the camera position offset that is being applied when the player aims his gun.

Thank you!

## Most efficient way to calculate user compatibility from per user

I’m looking for an efficient way to calculate user to user compatibility.

A user has various preferences:

- age range (min & max integer)
- various choice based categories (multiple choice)
- distance max
- correlated desire (probably most complex; a user can hate/love/curious about "giving" say a "hug" and is thus looking for a user who love/curious about "receiving" a "hug"; in my actual application it’s not "hug" and some users are only interested in giving and some only in receiving)

Example user preference: age: between 21 and 50, gender: female, hair color: brown, interested in: reading, nature, giving "hugs": loves, receiving "hugs": hates

I’m open to any data structure that would assist the matching, but right now I have tables like "gender", "interests", "desires", and tables joining to users like "users_genders" (user_id, gender_id) to indicate what user is what gender, etc.

Ideally I’m looking to calculate a compatibility % but even just getting a list of users who are compatible enough would be acceptable

My previous approach was to have a function that took two user IDs returning the % compatibility between the two. Then for each user I’d loop through all other users, calling that function to calculate compatibility. Then I’d store this data in a table (user_id1, user_id2, compatibility). This "worked" and resulted in fast lookups that could even be sorted by compatibility (a definite plus but not required) but quickly created a HUGE table that crashed with <100K users. The table crashed because it became extremely large. I’m ideally looking for an approach that doesn’t use N*(N-1) rows for N users.

Doing the math, I see why, since I’m doing N*(N-1) compare & stores for N users.

I suppose I could try to address that by splitting the compatibility table by user so each table would have at most N-1 rows, but this isn’t ideal

The other approach I can think of is to turn the preference criteria into SQL. This wouldn’t easily get me a percentage score but at least I could get all matches compatible enough for a user (maybe removing conditions and trying again if no results)

My current approach is in MySQL. But I’m open to a different DB.

I found these related questions on Stackoverflow (though they really seem they belong more here)

https://stackoverflow.com/questions/27928548/representing-compatibility-between-two-users-in-mysql

https://stackoverflow.com/questions/31919589/how-to-get-the-best-match-without-looping-through-the-entire-database

which all seem to indicate that the (user_id1, user_id2, compatibility) table is probably my best bet, but I’m hoping that’s changed since these were asked or db wizards here have better ideas

## How to calculate the derivative of the solution of ParametricNDSolveValue?

Consider the following code:

`Sol = ParametricNDSolveValue[{e1'[t] == s e2[t], e2'[t] == -s e1[t],e1[0] == 1, e2[0] == 0}, {e1, e2}, {t, 0, 1}, s] fun[t_, s_] := Through[Sol[s][t]][[1]]; Plot[fun[t, 1], {t, 0, 10}] dfun[t_, s_] = Derivative[1, 0][fun][t, s] Plot[dfun[t, 10], {t, 0, 1}] `

The aim is to find and plot the derivative in `t`

of `fun`

, but I get the output:

`s'[t] `

and a line along the x axis as a plot, which is the wrong solution.

How do I find the derivative of the solution of `ParametricNDSolveValue`

?

**EDIT** To be clear: I need to keep `s`

as a parameter, I know that if I write `dfun[t_] = D[Through[Sol[1][t]][[1]], t]`

I can plot the deirvative, but I do not want to fix the value of `s`

## Calculate days between to dates postgresql

I’m having a problem:

I’m trying to calculate days between two dates.

Let’s say I have the date **‘2005-05-25 06:04:08’** and I want to count how many days are from that day to the current date.

I tried doing:

`SELECT DATE_PART('day', AGE(CURRENT_TIMESTAMP, '2005-05-25 06:04:08'::timestamp )) AS days; `

But for some reason this returns 11, it’s not taking into count the HUGE difference in years. How can I solve this?

## Calculate Percentage (No reserve Price. You can have this just for $1)

**Why are you selling this site?**

Need to work on other websites

**How is it monetized?**

currently its not

**Does this site come with any social media accounts?**

no

**How much time does this site take to run?**

you just need to drive traffic to it. No work required

**What challenges are there with running this site?**

No challenges. You need to bring traffic and earn money through adsense.

## Calculate Percentage

**Why are you selling this site?**

Need to work on other websites

**How is it monetized?**

currently its not

**Does this site come with any social media accounts?**

no

**How much time does this site take to run?**

you just need to drive traffic to it. No work required

**What challenges are there with running this site?**

No challenges. You need to bring traffic and earn money through adsense.

## How to calculate the chances of reaching a certain success level prior to failed channeling?

In Warhammer 4e casters can use channeling in order to gain success level prior to casting a spell. Success levels are essentially for every 10 you exceed the skill number you gain a success level and they keep piling up till you make a failed roll.

As a wizard I am trying to figure out how to calculate the probability of piling up enough SL’s before failing channeling and suffering a miscast.

What I wish to ask if how can I calculate my odds of reaching a certain SL prior to suffering a miscast (Making a failed roll) and losing all of my SL? (Note that the system uses a d100 and you try to roll below your skill.)

## How to calculate the delivery of a touch spell using the familiar?

Familiar Conduit text reads

Under your tutelage, your familiar has grown attuned to the hidden currents of the world and can serve as a conduit for your magic. If the next action you use is to Cast a Spell that has a range, the spell uses the familiar as its origin point.

Touch is a range, but familiars do not have the required stats to make an attack. How does one calculate the success or failure?