Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7085099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:22:59+00:00 2026-05-28T07:22:59+00:00

I am experience a problem calculating the result when putting a vector to the

  • 0

I am experience a problem calculating the result when putting a vector to the power of a decimal. The problem is more specifically that negative numbers in the vector come back as NAN. This also happens if I assign the negative number to a variable. Some examples to explain:

> -5.718301^2.85
[1] -143.9498

> test<--5.718301
> test
[1] -5.718301
> test^2.85
[1] NaN

> c(5.718301)^2.85
[1] 143.9498
> c(-5.718301)^2.85
[1] NaN

Can anyone explain to me why this happens? And any way around it? The vector in question may have positive and negative values, therefore, I can’t assign a negative sign after.

Thanks in advance,
Aran

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:22:59+00:00Added an answer on May 28, 2026 at 7:22 am

    There is no real valued solution to (-5.718301)^2.85 and so NaN is the correct answer.

    > (-5.718301)^2.85
    [1] NaN
    

    What you are attempting here is akin to asking for the square root of a negative number.

    When you successfully evaluated

    -5.718301^2.85
    

    the precedence of the operators meant that this was equivalent to

    -(5.718301^2.85)
    

    and of course that is well-defined.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I experience the following problem while using legacy VC6. I just cann't switch to
There is very strange assembly reference problem and loading problem I experience with my
When coding, what in your experience is a better approach? Break the problem down
My personal experience is that regexs solve problems that can't be efficiently solved any
I've experienced a couple of days ago, that a problem with the name of
we use the nunit.exe application to run our (integration)test Now i experience the problem
I'm using seam page navigation rules. and did not experience any problem with adding
I have a weird problem in asp.NET when calculating how many hours we need
Possible Duplicate: Learning efficient algorithms I recently came across an problem that was solved
I know many people experience this problem, but the solutions I found online do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.