- #1
robax25
- 238
- 3
how I print x^2/3
Here is my code
Here is my code
Matlab:
x=-100:100;
y=x.^(2/3),
plot(x,y)
x=-100:100;
y=x.^(2/3),
plot(x,y)
It is hard to help you without more details.robax25 said:Matlab does not display right graph. I think that it displays wrong.
x=-100:100;
y=real(x.^(2/3)) %%Real part only
plot(x,y)
The function of x^2/3 is to raise any given number, x, to the power of 2/3 or to find the square root of x^2.
To print x^2/3 using a simple function, you can use the following code:
print(x**(2/3))
First, you need to declare the value of x. Then, use the exponent operator (** or ^) to raise x to the power of 2/3. Finally, use the print function to display the result.
Yes, a simple function may not be able to print x^2/3 if the value of x is a negative number. This is because raising a negative number to a fractional power results in an imaginary number which cannot be printed.
To print x^2/3 for negative values of x, you can use the complex number function in Python. The code will look like this:
print(complex(x)**(2/3))
This will return the complex number equivalent of x^2/3.