c开多次根号函数

tiger_my 2008-04-22 05:10:10
如何写一个函数为多次开根号 例如:求6的根号3次方 很急......
...全文
1877 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
UltraBejing 2008-05-01
  • 打赏
  • 举报
回复
什么呀
lisheng053758 2008-04-26
  • 打赏
  • 举报
回复
直接用pow就ok啦
andy_cai 2008-04-26
  • 打赏
  • 举报
回复
研究的话用泰勒级数展开实现
使用的话直接用pow函数
Guassfans 2008-04-26
  • 打赏
  • 举报
回复
化成方程:x^3-6=0
求方程之根
#include<iostream>
#include<math.h>
using namespace std;
double myfun(double x,double a,int n) //x^n=a => x^n-a=0
{
double res=1;
for (int i=1;i<=n;i++)
{
res=res*x;
}
return (res-a);
}
double myfun0(double x)
{
return (x*x*x-6);
}

double SimpsonRoot(double x0)
{
double tol=1,root,r1,y,z;
root=x0;
while(tol>0.000001)
{
r1=root;
y=myfun0(r1)+r1;
z=myfun0(y)+y;
root=r1-(y-r1)*(y-r1)/(z-2*y+r1);
tol=abs(root-r1);
}
return root;
}

int main()
{
double x0=1;

cout<<SimpsonRoot(x0);
return 1;
}

星羽 2008-04-26
  • 打赏
  • 举报
回复

Copy Code
// crt_pow.c

#include <math.h>
#include <stdio.h>

int main( void )
{
double x = 6.0, y = 1.0 / 3.0, z;

z = pow( x, y );
printf( "%.1f to the power of %.1f is %.1f\n", x, y, z );
}


Alix-Lei 2008-04-22
  • 打赏
  • 举报
回复
pow()可以实现吧
fallening 2008-04-22
  • 打赏
  • 举报
回复
学过微积分的话自己展开就是了
tiger_my 2008-04-22
  • 打赏
  • 举报
回复
非常谢谢上面的3位楼主
jieao111 2008-04-22
  • 打赏
  • 举报
回复
自己搜pow()函数
baihacker 2008-04-22
  • 打赏
  • 举报
回复
#include <stdio.h>
#include <math.h>

int main()
{
printf("%lf", pow(6.0, 1.0/3));
return 0;
}
mathe 2008-04-22
  • 打赏
  • 举报
回复
pow(6,1.0/3)

70,037

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧