-1

Hi there I am new to this.

Code:

display(Math('4^4.2'))

Output:

enter image description here

What am I doing wrong. The decimal is not up on the exponents

I have tried to keep the exponents nicely formatted including the decimals but the decimals came down.

3
  • 1
    Try '4^{4.2}'. Commented Nov 19, 2023 at 8:11
  • 1
    post the code and not the pictures of code. Users need to be able to replicate the problem quickly. Text allows for quick copy and pictures do not. how to ask Commented Nov 19, 2023 at 13:17
  • 1
    Also remember to properly tag your post. This looks like a Jupyter notebook. Commented Nov 19, 2023 at 23:26

2 Answers 2

1

there are a few ways of achieving a power (exponent) in python.

here are the two most common ways.

  • use the ** and not ^.
  • use the pow() function
result = 4**4.2
print(result)
result = pow(4, 4.2)
print(result)
answered Nov 19, 2023 at 13:21
Sign up to request clarification or add additional context in comments.

2 Comments

I think they're using MathJax or some variant, so they're not looking for actual arithmetic exponent, but just for pretty displaying of equations. Their question is not really related to python at all.
@Stef, you could be right. i am answering on the basis that python is a tag and i see a jupyter notebook in the image provided. If it is mathjax, then it is a different language JavaScript ...
0

LaTeX doesn't automatically add parentheses like python does. How does it know that (2^2).4 isn't a new notation? Generally you should put braces around the exponent and other things:

2^{2.4}
answered Nov 20, 2023 at 11:42

1 Comment

Please offer a better way to write this statement.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.