Python Forum
python 3 math formulas where to use ()
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python 3 math formulas where to use ()
#1
I am having trouble using math formulas for 3d geometric shapes in python.

for example a tetrahedon:
The formula to find the edge is:
a = √2 (3v)^1/3

So in python 3:
A = math.sqrt (2) * (3*v)** (1/3)

How do I know the 1/3 should have been in () ?
I just keep guessing what to group together to get it to have the correct output.

I am trying to understand when and where to use (); when the math formula did not even have it.
I understand multiplication is not implied in python but not sure what other rules there are for converting math formulas to use in scripts.

If you google regular tetrahedron edge formula you will see the formula.
google formula

Thanks

Any help will be greatly appreciated.
Reply
#2
Take a look here https://docs.python.org/3/reference/expr...precedence
Just like you have to memorize that multiplication happens before addition in math, these may be worth memorizing.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Updating formulas in Excel - best solution MasterOfDestr 4 561 Mar-11-2024, 01:02 PM
Last Post: MasterOfDestr
  plotting based on the results of mathematical formulas Timur 1 296 Feb-08-2024, 07:22 PM
Last Post: Gribouillis
  How to do "fixed size" (wrapping) math in Python? AlexanderWulf 13 1,735 Jul-19-2023, 04:13 PM
Last Post: deanhystad
  Math python question Deonvek 6 1,090 Apr-05-2023, 09:27 PM
Last Post: deanhystad
  math.log versus math.log10 stevendaprano 10 2,315 May-23-2022, 08:59 PM
Last Post: jefsummers
  Math Package in python Uma 1 1,462 Dec-12-2021, 02:01 PM
Last Post: jefsummers
  openpyxl insert list with formulas Irv1n 1 1,518 Sep-16-2021, 08:10 AM
Last Post: Irv1n
  Why getting ValueError : Math domain error in trig. function, math.asin() ? jahuja73 3 3,707 Feb-24-2021, 05:09 PM
Last Post: bowlofred
  "SyntaxError: invalid syntax" running code in Doing Math With Python b saucerdesigner 2 2,703 Nov-03-2020, 04:23 PM
Last Post: saucerdesigner
  Help with a query - to show possible formulas Yanos 1 1,741 Nov-02-2020, 12:18 AM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020