Graphics, Figures & TablesTikZ: (-1)^0

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
topsquark
Posts: 71
Joined: Wed Oct 05, 2022 10:30 pm

TikZ: (-1)^0

Post by topsquark »

I hate to keep coming back for every little question, but...

Code: Select all

\usepackage{fp}
\usetikzlibrary{math, fixedpointarithmetic}
\begin{tikzpicture} [fixed point arithmetic]
     \tikzmath {
          \j=(-1)^0;
     };
\end{tikzpicture}
I keep getting the error "FP error: Logarithm of negative value!." If the power 0 was a bit off (even 0.0) I could see it, but defining the -1 and 0 to be integer values doesn't change anything.

I realize I'm straining the TikZ system with the Math in this program I'm trying to write but what is going on here??

Thanks!

-Dan

Addendum: Sorry folks! I'm doing something wrong with the \usepackage{fp} line, I think. How do I add that to the preamble on this site?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

TikZ: (-1)^0

Post by Stefan Kottwitz »

Hi Dan,

just make it a normal small but full example, such as

Code: Select all

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{math, fixedpointarithmetic}
\usepackage{fp}
\begin{document}
\begin{tikzpicture} [fixed point arithmetic]
     \tikzmath {
          %\j=(-1)^0;
          \j=(1)^0;% just for testing
     };
     \node {Value: \j};
\end{tikzpicture}
\end{document}
Then everybody can run and edit your example with a single click in the forum. You could also edit the other new post with that complicated code.

Regarding the problem, I guess it calculates it that way: exp(0*log(-1)) and so we have the logarithm issue.

Stefan
LaTeX.org admin
topsquark
Posts: 71
Joined: Wed Oct 05, 2022 10:30 pm

TikZ: (-1)^0

Post by topsquark »

Stefan Kottwitz wrote:Hi Dan,

just make it a normal small but full example, such as

Code: Select all

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{math, fixedpointarithmetic}
\usepackage{fp}
\begin{document}
\begin{tikzpicture} [fixed point arithmetic]
     \tikzmath {
          %\j=(-1)^0;
          \j=(1)^0;% just for testing
     };
     \node {Value: \j};
\end{tikzpicture}
\end{document}
Then everybody can run and edit your example with a single click in the forum. You could also edit the other new post with that complicated code.

Stefan
Okay. I see what you are saying. I had thought the preamble the site tacked on was strictly automatic. I'll start adding that on.

Thanks!

-Dan
topsquark
Posts: 71
Joined: Wed Oct 05, 2022 10:30 pm

TikZ: (-1)^0

Post by topsquark »

Stefan Kottwitz wrote: Regarding the problem, I guess it calculates it that way: exp(0*log(-1)) and so we have the logarithm issue.

Stefan
That would be a serious bummer. If that's the case then I can't calculate the coefficient block in the other thread. At least not directly. I'll have to work on that.

Thanks again!

-Dan
Post Reply