The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 erfc(complex number)?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

aekalavya

USA
9 Posts

Posted - 12/03/2009 :  7:49:42 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.0 SR6
Operating System: Xp sp3

Friends,
I have an issue to use Erfc with complex numbers.
My code goes like,

#include <origin.h>
#include <oc_nag8.h>
#include <complex.h>
void _nlsfcomp_err_func1(
// Fit Parameter(s):
double x1, double D1, double g1, double c1,
// Independent Variable(s):
double x,
// Dependent Variable(s):
double& y)
{
// Beginning of editable part
// Beginning of editable part
complex z1,y1,e1;
z1=-(x1-1i*D1-x)/g1;
e1= erfc(z1);
y1=c1*1i*sqrt(Pi)/g1*exp(-z1^2)*e1;
y=y1.m_im;


// End of editable part
}

If I give a double value to erfc() argument, it compiles fine.
Since z1 is complex, it is showing error such as :Error, cannot convert argument in function call
Can we work with erfc() using complex arguments by adding some additional header files?
I also tried nag_erfc(), the problem is still there,

-Shiva

Iris_Bai

China
Posts

Posted - 12/03/2009 :  9:05:45 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Please try nag_complex_erfc.


#include <oc_nag8.h>
void test_complex()
{
	complex cc;
	cc = 1+2i;
	
	NagError fail;
	complex cc2 = nag_complex_erfc(cc, &fail);
	out_complex("", cc2);
}


Iris
Go to Top of Page

aekalavya

USA
9 Posts

Posted - 12/07/2009 :  3:45:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Iris.
I was not aware of that function before.
It works great.
Next step is to include one more variable. I am working on it. And let you know the result.
thank you very much for the hint.

-Shiva
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000